Status
status.h and status.c files define status structs and form in which firmware parameters are stored and periodically sent via LoRa and as BLE advertisement.
Status form
Status can consit of several building blocks, defined by FW and tracker type. Each building block is a byte array, where each byte reperesents a values as defined in governing status structre.
Total status cannot exceed 24 - DEVICE_NAME_LEN bytes, as this is the maximum length of BLE advertisment packet. Currently max length is set to 19 bytes.
Main status
Main building block is defined by statusData_t struct:
that can be compressed in byte array by
Individual values are defined as:
reset_cause - TBD
system_functions_errors - TBD
battery = (battery_mV - 2500)/10
charging_voltage - TBD
temperature - TBD
uptime - uptime in hours, with 255 turnaround
acc_x - abs(acc_x*10)
acc_y - abs(acc_y*10)
acc_z - abs(acc_z*10)
Total length of main status part is 9 bytes.
LR status
If #define STATUS_LR
is enabled, additional LR chip status block is added.
where:
satellites - nr. of satellites used in last LR fix
last_fix - TBD
Total length of LR buildning block is 2 bytes.
UBLOX status
If #define STATUS_UBLOX
is enabled, additional UBLOX chip status block is added.
where:
lat - latitude defined as:
lat[0] = (lat+90)*1000 >> 16
lat[1] = (lat+90)*1000 >> 8
lat[2] = (lat+90)*1000
lon - longitude defined as:
lon[0] = (lat+180)*1000 >> 16
lon[1] = (lat+180)*1000 >> 8
lat[2] = (lat+180)*1000
time - TBD
Total length of UBLOX status is 8 bytes.
Functions
Get status
To obtain new status message for either BLE advertisement or LR status send, int get_status_message(uint8_t *message, uint8_t max_len)
function updates all values with int update_status_message(bool lr_status, bool ublox_status)
function and returns message length.
max_len
can be passed as an argument, as maximal length of message depends on the send format. If status message is too long, only max_len
message will be returned.
Last updated