Open SloMusti opened 6 years ago
Additionally needed:
r:<reboot duration in uint32_t>
for setting reboot duration wait
w:<next wakeup in unit32_t>
for setting when the system should be waken up next
The logic operates such: Pira smart wakes up the Pi after off period has expired or after the next wakeup time has expired. THe off-period is a safeguard, pi should schedule the next wakeup earlier then that in most cases
Configuration through UART has been implemented. Following commands are available:
t:<uint32_t>
- time in epoch format, set date/time
p:<uint32_t>
- configure ON time (safeguard)
s:<uint32_t>
- configure OFF time (safeguard)
r:<uint32_t>
- reboot wait period
w:<uint32_t>
- period for next wakeup
c:<uint32_t>
- other commands - implemented, but NOT USED currently
Branch: develop SHA1: c1271981cf112c769761df7969538948f40b1e90
@SloMusti please test after hex file has been provided.
@SloMusti maybe we need some return information if commands are received successfully? Effect of the commands can be observed only through operation or by reading some parameters through BLE.
Do we also need wakeup period and reboot period as separate commands through BLE? I will implement command interface through strings, but maybe separate commands would be useful also?
@gorankecman, is the data sent from pirasmart to rpi in the format as well, I believe we are sending data back as string, so this should be unified to common format.
@gorankecman reporting needs to be configured for this to be tested
Following commands are sent from Pira Smart device to UART every second:
t:<uint32_t><LF>
Time in epoch format, seconds
o:<uint32_t><LF>
General status value -> time left until next sleep - 'o' stands for overview since 'p' and 's' are occupied
b:<uint32_t><LF>
Battery level in ADC units
p:<uint32_t><LF>
On time threshold value
s:<uint32_t><LF>
Off time threshold value
r:<uint32_t><LF>
Reboot period duration
w:<uint32_t><LF>
Next wakeup period duration
a:<uint32_t><LF>
RPi status pin value
Following commands can be received and parsed through UART (all commands are 7B long):
t:<uint32_t><LF>
For setting date/time
p:<uint32_t><LF>
For setting ON time threshold
s:<uint32_t><LF>
For setting OFF time threshold
r:<uint32_t><LF>
For setting reboot duration
w:<uint32_t><LF>
For setting when the system should be waken up next
c:<uint32_t><LF>
- Reaction still not implemented! - NOT USED
Implement setting the time and other parameter through serial, the simplest option would be to use the same format as for receiving:
t:<epoch in uint32_t>
for setting date/timep:<on time in uint32_t>
for setting on times:<off time in uint32_t>
for setting off timec:<command in uint8_t>
for sending commands, for example 0x00 - no command,