Closed bgoodwine closed 1 year ago
i2c_esp32.py
to be functions for import in other programscheckin()
, send_to_sdr(message)
, send_imu_update(imu_data)
, etc.)num_bytes
for all messagesPi initial messages:
0:
- general checking request 1:sensor_id
- restart sensor corresponding to sensor_id
2:sensor_id
- shutdown sensor corresponding to sensor_id
3:[num_bytes]
- misc. message from Pi to ESP32Pi responses to message transmission requests:
0:2
- start relay of message to be sent to SDR (after receiving 0:2:[num_bytes]
from ESP32)0:3
- start relay of solar panel efficiency report (sent after receiving 0:3:[num_bytes]
from ESP32)0:4
- start relay of misc. message from ESP32 (sent after receiving 0:4:[num_bytes]
from ESP32)ESP32 response to general checkin:
0:0
- not tumbling0:1
- tumbling alert0:2:[num_bytes]
- a message of num_bytes
bytes is waiting to be relayed to the Pi for transmission through the SDR0:3:[num_bytes]
- solar panel efficiency report of num_bytes
bytes is waiting to be relayed to the Pi 0:4:[num_bytes]
- misc. message available for relay from ESP32 to Pi ESP32 response to restart/shutdown commands:
1:0:[sensor_id]
- successfully restarted sensor of sensor_id
1:1:[sensor_id]
- failed to restart sensor of sensor_id
2:0:[sensor_id]
- successfully shutdown sensor of sensor_id
2:1:[sensor_id]
- failed to shutdown sensor of sensor_id
ESP32 data relay messages will be repeated until all bytes have been transmitted:
0:2:[message]
- packetized data for transmission through SDR0:3:[message]
- solar panel efficiency report 0:4:[message]
- misc. message from ESP32 to Pi
Note: the preceding opcode and delimiter will be included in the num_bytes
originally sent. Read byte at a time with smbus
read_byte(i2c_addr, force=None)
Read a single byte from a device.
Return type int
Parameters
• i2c_addr (int) – i2c address
• force (Boolean) –
Returns Read byte value
Lots of functionality added with #13 closed :) What's still left:
checkin()
a request from function
Protocol Draft 1
Pi initial requests:
0:
= request for general checkin1:[IMU data]
= IMU data that the ESP32 should either confirm or alert mismatching data2:[num_bytes]
= transmit message via SDR3:sensor_id
= restart sensor corresponding tosensor_id
4:sensor_id
= shutdown sensor corresponding tosensor_id
0:2
= start relay of available SDR message (sent after receiving0:2
from ESP32)0:3
= start relay of solar panel efficiency report (sent after receiving0:3
from ESP32)ESP32 response to general checkin:
0:0
= not tumbling0:1
= tumbling alert0:2:[num_bytes]
= message from SDR waiting to be relayed0:3:[num_bytes]
= solar panel efficiency report available for relayESP32 response to IMU data:
1:0
= IMU data is good1:1
= IMU data does not match1:report:[solar panel report]
= solar panel efficiency report2:num_bytes
= number of bytes in message received from the SDR, which the ESP32 will next relay to the Pi2:[message]
= message relayed to Pi, will only benum_bytes
longESP32 data relay:
2:[message]
- SDR message to relay, repeat untilnum_bytes
has been sent (-2 for each sent message)3:[report]
- solar panel efficiency report to relay, repeat untilnum_bytes
has been sent (-2 for each sent message)Originally posted by @bgoodwine in https://github.com/bgoodwine/SeniorDesign/issues/2#issuecomment-1438757839