bugfix progversion handling in configmanager

This commit is contained in:
cyberman54 2021-12-24 15:15:28 +01:00
parent a7bc2be9b7
commit d8210d3ec3
2 changed files with 9 additions and 7 deletions

View File

@ -55,7 +55,7 @@ enum snifftype_t { MAC_SNIFF_WIFI, MAC_SNIFF_BLE, MAC_SNIFF_BLE_ENS };
// using packed to avoid compiler padding, because struct will be memcpy'd to
// byte array
typedef struct __attribute__((packed)) {
char version[10]; // Firmware version
char version[10] = ""; // Firmware version
uint8_t loradr; // 0-15, lora datarate
uint8_t txpower; // 2-15, lora tx power
uint8_t adrmode; // 0=disabled, 1=enabled

View File

@ -32,7 +32,9 @@ static uint8_t buffer[cfgLen + cfgLen2];
// 3. magicByte [cfgLen2 bytes, containing a fixed identifier]
static void defaultConfig(configData_t *myconfig) {
memcpy(myconfig->version, &PROGVERSION, 10); // Firmware version
strncpy(myconfig->version, PROGVERSION,
sizeof(myconfig->version) - 1); // Firmware version
// device factory settings
myconfig->loradr = LORADRDEFAULT; // 0-15, lora datarate, see paxcounter.conf