-
Notifications
You must be signed in to change notification settings - Fork 2
particle
The particle.io library is a thin interface to the (particle.io cli)[https://docs.particle.io/reference/developer-tools/cli/#particle-usb].
There is a command which will invoke your browser there.
This will require javascript, npm, and dfu-utils to start. Follow their instructions for installation.
Once the particle cli is working as expected, SPR can then utilize the cli to make it easier to work with boards adhoc or repeatedly in a process.
This library uses the /device path created by the device library as it's working directory.
There are a number of messages and other settings found in various places in the config. The with stack is created with all of these locations. The Particle name space has a function, initialize to initialize a default with stack. This should be done only once per session.
pb/initialize
as/flat-with
on a fresh execution will show the data needed for everything.
Once done, current with will be /device and it will have been set with empty device values by pb/clear.
As the process progresses the data stored in /device such as id, and path will be used by various functions.
Doing an pb/get followed
by pop results . Will result in the device id, path and name being
populated.
Doing an dev/input-serial will give a prompt for a serial number.
pop results serial
will place the serial number given into /device/serial.
The process continues from there.
Here is a sample startup session.
SPR:> pb/init-with
/config/dialogs
-------------------------
title
msg
yn_msg
yn_fail_msg
plugin_start
ready_to_test
ready_to_flash
process_failed
process_success
process_finish
continue
start_again
continue_to_next
input_please
input_regex
input_is_correct
input_must
hellomsg
/config/device/serial
-------------------------
baudrate
input_regex
input_please
/config/device/waiting
-------------------------
timeout
pause_time
/config/device/handshake
-------------------------
init_string
response_string
fail_regex
done_regex
do_qqc_regex
do_qqc_func
/config/particle
-------------------------
product
images
/device
-------------------------
id
last_id
type
serial
name
path
SPR:> with-stack
/device
/config/particle
/config/device/handshake
/config/device/waiting
/config/device/serial
/config/dialogs
/home
/
SPR:> with
/device
-------------------------
id
last_id
type
serial
name
path
SPR:> show
/device
id: ''
last_id: ''
name: ''
path: ''
serial: ''
type: ''
SPR:> as/flat-with
baudrate: 9600
continue: Ready to Continue ?
continue_to_next: 'Choice? Press Y/y to do it again: '
do_qqc_func: dev/input-serial
do_qqc_regex: ^I:Now Setting Serial Number
done_regex: ^I:Test All Done
fail_regex: ^F:.*
hellomsg: You have received this message because your autoexec attribute is set to
'hello' or None, or can't be found. Maybe make some new commands to create some
processes. When you get a command you want to run automatically set autoexec exec/autoexec
in the config file to it's name. Here are the commands the interpreter currently
recognizes.
id: ''
images:
flash: R5Bin.bin
test: R5Test.bin
tinker: tinker-0.8.0-rc.27-boron.bin
init_string: Some handshake string
input_is_correct: This entry is correct ?
input_must: 'Entry must match regex:'
input_please: Please input an 8 digit serial number
input_regex: ^\d{8}$
last_id: ''
msg: Just in case msg is empty.
name: ''
path: ''
pause_time: 5
plugin_start: Plug in a new device, press OK to start
process_failed: Process Failed!
process_finish: Turn the Power Switch Off and Disconnect the Battery and USB.
process_success: Process Succeeded!
product: XXXXX
ready_to_flash: Ready to flash.
ready_to_test: Ready to test.
response_string: some response string
serial: ''
start_again: 'Do it again ? '
timeout: 30
title: The Simple Process REPL
type: ''
yn_fail_msg: 'This fails if you do not say yes. ? Y/N: '
yn_msg: 'Did you expect this message? Y/N: '
SPR:> pb/get
Found 1 device connected via serial:
/dev/ttyACM0 - Boron - e00fce681ef0d2e53379dcf0
SPR:> show
/device
id: ''
last_id: ''
name: ''
path: ''
results:
- id: e00fce681ef0d2e53379dcf0
name: Boron
path: /dev/ttyACM0
serial: ''
type: ''
SPR:> pop results .
SPR:> show
/device
id: e00fce681ef0d2e53379dcf0
last_id: ''
name: Boron
path: /dev/ttyACM0
results: []
serial: ''
type: ''
# an example of using an input form to get a value.
SPR:> dev/input-serial
SPR:> show
/device
id: e00fce681ef0d2e53379dcf0
last_id: ''
name: Boron
path: /dev/ttyACM0
results:
- '11112222'
serial: ''
type: ''
SPR:> pop results serial
SPR:> show
/device
id: e00fce681ef0d2e53379dcf0
last_id: ''
name: Boron
path: /dev/ttyACM0
results: []
serial: '11112222'
type: ''