L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
Loading...
Searching...
No Matches
systemParams_t Struct Reference

System configuration parameters – persisted in NFC EEPROM at address 0. The structure contains all modifiable variables/settings of system, can be read/writa via NFC tool or LoRa special read/write process The structure is 90 bytes (SZ_SYSTEMPARAMS) with a CRC8 byte at the end. Fields marked RO are written by the firmware; fields marked RW can be updated by a phone app via the NFC EEPROM or via LoRa special process. More...

#include <mysensors_base.h>

Data Fields

char Sign [5]
uint8_t AppVersion [2]
uint32_t SensTimeoutMeasure
uint16_t SensAltitude
uint8_t SensSendInOnePacket
uint8_t SensAvailableSensors
uint8_t MemsStoreSensorData
uint16_t MemsMaxSensorData
uint16_t MemsCurrentCountSensorData
uint8_t LoRaPort
uint8_t LoRaRepeatTryConnect
uint8_t LoRaAdaptiveDataRate
uint8_t LoRaDataRate
uint8_t LoRaTxPower
uint8_t LoRaClass
uint8_t LoRaRegion
uint8_t HWBatteryLevelStatus
uint16_t HWBatteryMV
uint8_t HWDevEUI [8]
uint8_t HWAppEUI [8]
uint8_t HWAppKEY [16]
uint32_t HWDevADDR
uint8_t DevRestart
uint8_t DevReset
uint8_t DevOnOff
uint8_t Dummy [20]
uint8_t Crc

Detailed Description

System configuration parameters – persisted in NFC EEPROM at address 0. The structure contains all modifiable variables/settings of system, can be read/writa via NFC tool or LoRa special read/write process The structure is 90 bytes (SZ_SYSTEMPARAMS) with a CRC8 byte at the end. Fields marked RO are written by the firmware; fields marked RW can be updated by a phone app via the NFC EEPROM or via LoRa special process.

The following code is used for checking the structure validity:

if (strcmp(_systemParams.Sign, SYSTEMPARAMS_SIGN) != 0 || _systemParams.AppVersion[1] != SYSTEMPARAMS_APPVER01)
{
.... the structure is not valid
}
// crc checking
{
.... the structure is not valid
}
systemParams_t _systemParams
uint8_t systemParams_CheckCRC(const systemParams_t *par)
Verify the CRC field of a systemParams_t structure.
#define SYSTEMPARAMS_SIGN
4-byte ASCII signature stored at offset 0 of systemParams_t to validate data integrity.
#define SYSTEMPARAMS_APPVER01
Application firmware major version number (plain integer) - check of validity struct together with SY...
Note
Do not reorder fields – the phone app and MQTT server rely fixed offsets.

Definition at line 141 of file mysensors_base.h.

Field Documentation

◆ AppVersion

uint8_t systemParams_t::AppVersion[2]

RO Firmware version bytes [major, minor] (see SYSTEMPARAMS_APPVER00/01)


sensor settings

Definition at line 145 of file mysensors_base.h.

◆ Crc

uint8_t systemParams_t::Crc

CRC8 of bytes 0..(SZ_SYSTEMPARAMS-2); must be the last field

Definition at line 189 of file mysensors_base.h.

Referenced by systemParams_CheckCRC().

◆ DevOnOff

uint8_t systemParams_t::DevOnOff

RW 0 – device wakes periodically by RTC timer; 1 – stay on (default 0)


dummy

Definition at line 183 of file mysensors_base.h.

◆ DevReset

uint8_t systemParams_t::DevReset

RW Write 1 from phone app to reset to factory defaults on next poll

Definition at line 182 of file mysensors_base.h.

◆ DevRestart

uint8_t systemParams_t::DevRestart

RW Write 1 from phone app to trigger a software restart on next poll

Definition at line 181 of file mysensors_base.h.

◆ Dummy

uint8_t systemParams_t::Dummy[20]

RW Reserved for future use; initialised to 0

Definition at line 187 of file mysensors_base.h.

◆ HWAppEUI

uint8_t systemParams_t::HWAppEUI[8]

RW LoRaWAN JoinEUI / AppEUI (default: all zeros)

Definition at line 175 of file mysensors_base.h.

◆ HWAppKEY

uint8_t systemParams_t::HWAppKEY[16]

RW LoRaWAN AppKey used for OTAA join (change before deployment)

Definition at line 176 of file mysensors_base.h.

◆ HWBatteryLevelStatus

uint8_t systemParams_t::HWBatteryLevelStatus

RO Battery charge level on a 1–254 scale (1 = very low, 254 = full)

Definition at line 172 of file mysensors_base.h.

◆ HWBatteryMV

uint16_t systemParams_t::HWBatteryMV

RO Battery voltage in millivolts

Definition at line 173 of file mysensors_base.h.

◆ HWDevADDR

uint32_t systemParams_t::HWDevADDR

RO LoRaWAN DevAddr assigned after a successful OTAA join


device settings

Definition at line 177 of file mysensors_base.h.

◆ HWDevEUI

uint8_t systemParams_t::HWDevEUI[8]

RO DevEUI derived from chip UID (format: [45 87 F2][4-byte UID][crc8])

Definition at line 174 of file mysensors_base.h.

◆ LoRaAdaptiveDataRate

uint8_t systemParams_t::LoRaAdaptiveDataRate

RW 1 – enable ADR (DataRate field is then ignored); 0 – fixed DR (default 1)

Definition at line 164 of file mysensors_base.h.

◆ LoRaClass

uint8_t systemParams_t::LoRaClass

RW LoRaWAN device class: 0=Class A (default), 1=Class B, 2=Class C

Definition at line 167 of file mysensors_base.h.

◆ LoRaDataRate

uint8_t systemParams_t::LoRaDataRate

RW Fixed data rate when ADR is disabled (0=DR_0 slowest … 5=DR_5 fastest)

Definition at line 165 of file mysensors_base.h.

◆ LoRaPort

uint8_t systemParams_t::LoRaPort

RW LoRaWAN uplink port (min 1, default 2, max 223; ports ≥224 are reserved)

Definition at line 162 of file mysensors_base.h.

◆ LoRaRegion

uint8_t systemParams_t::LoRaRegion

RW LoRaWAN region index (default 5 = EU868; range 0–9)


hardware settings

Definition at line 168 of file mysensors_base.h.

◆ LoRaRepeatTryConnect

uint8_t systemParams_t::LoRaRepeatTryConnect

RW Number of join retries after duty-cycle back-off (default 10, max 20)

Definition at line 163 of file mysensors_base.h.

◆ LoRaTxPower

uint8_t systemParams_t::LoRaTxPower

RW TX power index (0=max power … 7=min power, default 0)

Definition at line 166 of file mysensors_base.h.

◆ MemsCurrentCountSensorData

uint16_t systemParams_t::MemsCurrentCountSensorData

RO Number of sensor records currently stored in the queue


LoRaWan settings

Definition at line 158 of file mysensors_base.h.

◆ MemsMaxSensorData

uint16_t systemParams_t::MemsMaxSensorData

RO Maximum number of sensor records the flash circular queue can hold

Definition at line 157 of file mysensors_base.h.

◆ MemsStoreSensorData

uint8_t systemParams_t::MemsStoreSensorData

RW 1 – store readings in external flash; 0 – transmit only (default 1)

Definition at line 156 of file mysensors_base.h.

◆ SensAltitude

uint16_t systemParams_t::SensAltitude

RW Elevation above sea level in metres used for sea-level pressure correction

Definition at line 150 of file mysensors_base.h.

◆ SensAvailableSensors

uint8_t systemParams_t::SensAvailableSensors

RW Bitmask of sensors to poll (see systemParams_Sensors_t); default 0x1F (all)


memory settings

Definition at line 152 of file mysensors_base.h.

◆ SensSendInOnePacket

uint8_t systemParams_t::SensSendInOnePacket

RW 1 – pack all sensor values into one uplink; 0 – send separately (default 0)

Definition at line 151 of file mysensors_base.h.

◆ SensTimeoutMeasure

uint32_t systemParams_t::SensTimeoutMeasure

RW Sensor measurement interval in ms (min 30 s, default 10 min, max 18 h)

Definition at line 149 of file mysensors_base.h.

◆ Sign

char systemParams_t::Sign[5]

< header - identification of structure, sign & version RO Magic signature "MTTV" – used to detect uninitialized memory

Definition at line 144 of file mysensors_base.h.


The documentation for this struct was generated from the following file: