mirror of https://github.com/arendst/Tasmota.git
parent
46fae91e10
commit
c18ed34685
|
@ -197,7 +197,8 @@ int LoRaClass::endPacket(bool async)
|
||||||
if (!async) {
|
if (!async) {
|
||||||
// wait for TX done
|
// wait for TX done
|
||||||
while ((readRegister(REG_IRQ_FLAGS) & IRQ_TX_DONE_MASK) == 0) {
|
while ((readRegister(REG_IRQ_FLAGS) & IRQ_TX_DONE_MASK) == 0) {
|
||||||
yield();
|
// yield();
|
||||||
|
delay(0); // Prevent watchdog crashes
|
||||||
}
|
}
|
||||||
// clear IRQ's
|
// clear IRQ's
|
||||||
writeRegister(REG_IRQ_FLAGS, IRQ_TX_DONE_MASK);
|
writeRegister(REG_IRQ_FLAGS, IRQ_TX_DONE_MASK);
|
||||||
|
|
|
@ -34,12 +34,9 @@
|
||||||
|
|
||||||
#define DRV_DEMO_MAX_DRV_TEXT 16
|
#define DRV_DEMO_MAX_DRV_TEXT 16
|
||||||
|
|
||||||
const uint16_t DRV_DEMO_VERSION = 0x0105; // Latest driver version (See settings deltas below)
|
|
||||||
|
|
||||||
// Global structure containing driver saved variables
|
// Global structure containing driver saved variables
|
||||||
struct {
|
struct {
|
||||||
uint32_t crc32; // To detect file changes
|
uint32_t crc32; // To detect file changes
|
||||||
uint16_t version; // To detect driver function changes
|
|
||||||
char drv_text[DRV_DEMO_MAX_DRV_TEXT][10];
|
char drv_text[DRV_DEMO_MAX_DRV_TEXT][10];
|
||||||
} DrvDemoSettings;
|
} DrvDemoSettings;
|
||||||
|
|
||||||
|
@ -65,7 +62,6 @@ bool DrvDemoLoadData(void) {
|
||||||
if (!root) { return false; }
|
if (!root) { return false; }
|
||||||
|
|
||||||
DrvDemoSettings.crc32 = root.getUInt(PSTR("Crc"), DrvDemoSettings.crc32);
|
DrvDemoSettings.crc32 = root.getUInt(PSTR("Crc"), DrvDemoSettings.crc32);
|
||||||
DrvDemoSettings.version = root.getUInt(PSTR("Version"), DrvDemoSettings.version);
|
|
||||||
JsonParserArray arr = root[PSTR("Text")];
|
JsonParserArray arr = root[PSTR("Text")];
|
||||||
if (arr) {
|
if (arr) {
|
||||||
for (uint32_t i = 0; i < DRV_DEMO_MAX_DRV_TEXT; i++) {
|
for (uint32_t i = 0; i < DRV_DEMO_MAX_DRV_TEXT; i++) {
|
||||||
|
@ -80,10 +76,8 @@ bool DrvDemoLoadData(void) {
|
||||||
bool DrvDemoSaveData(void) {
|
bool DrvDemoSaveData(void) {
|
||||||
Response_P(PSTR("{\"" XDRV_122_KEY "\":{"
|
Response_P(PSTR("{\"" XDRV_122_KEY "\":{"
|
||||||
"\"Crc\":%u,"
|
"\"Crc\":%u,"
|
||||||
"\"Version\":%u,"
|
|
||||||
"\"Text\":["),
|
"\"Text\":["),
|
||||||
DrvDemoSettings.crc32,
|
DrvDemoSettings.crc32);
|
||||||
DrvDemoSettings.version);
|
|
||||||
for (uint32_t i = 0; i < DRV_DEMO_MAX_DRV_TEXT; i++) {
|
for (uint32_t i = 0; i < DRV_DEMO_MAX_DRV_TEXT; i++) {
|
||||||
ResponseAppend_P(PSTR("%s\"%s\""),
|
ResponseAppend_P(PSTR("%s\"%s\""),
|
||||||
(i)?",":"",
|
(i)?",":"",
|
||||||
|
@ -109,7 +103,6 @@ void DrvDemoSettingsLoad(bool erase) {
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR("DRV: " D_USE_DEFAULTS));
|
AddLog(LOG_LEVEL_INFO, PSTR("DRV: " D_USE_DEFAULTS));
|
||||||
|
|
||||||
memset(&DrvDemoSettings, 0x00, sizeof(DrvDemoSettings));
|
memset(&DrvDemoSettings, 0x00, sizeof(DrvDemoSettings));
|
||||||
DrvDemoSettings.version = DRV_DEMO_VERSION;
|
|
||||||
// Init any other parameter in struct DrvDemoSettings
|
// Init any other parameter in struct DrvDemoSettings
|
||||||
snprintf_P(DrvDemoSettings.drv_text[0], sizeof(DrvDemoSettings.drv_text[0]), PSTR("Azalea"));
|
snprintf_P(DrvDemoSettings.drv_text[0], sizeof(DrvDemoSettings.drv_text[0]), PSTR("Azalea"));
|
||||||
|
|
||||||
|
@ -123,25 +116,6 @@ void DrvDemoSettingsLoad(bool erase) {
|
||||||
DrvDemoDeleteData();
|
DrvDemoDeleteData();
|
||||||
}
|
}
|
||||||
else if (DrvDemoLoadData()) {
|
else if (DrvDemoLoadData()) {
|
||||||
if (DrvDemoSettings.version != DRV_DEMO_VERSION) { // Fix version dependent changes
|
|
||||||
|
|
||||||
// *** Start fix possible setting deltas ***
|
|
||||||
if (DrvDemoSettings.version < 0x0103) {
|
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR("CFG: Update oldest version restore"));
|
|
||||||
|
|
||||||
snprintf_P(DrvDemoSettings.drv_text[1], sizeof(DrvDemoSettings.drv_text[1]), PSTR("Begonia"));
|
|
||||||
}
|
|
||||||
if (DrvDemoSettings.version < 0x0104) {
|
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR("CFG: Update old version restore"));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** End setting deltas ***
|
|
||||||
|
|
||||||
// Set current version and save settings
|
|
||||||
DrvDemoSettings.version = DRV_DEMO_VERSION;
|
|
||||||
DrvDemoSettingsSave();
|
|
||||||
}
|
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR("CFG: Demo loaded from file"));
|
AddLog(LOG_LEVEL_INFO, PSTR("CFG: Demo loaded from file"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue