Merge pull request #483 from cyberman54/development

minor bug fixes
This commit is contained in:
Verkehrsrot 2019-11-09 11:22:19 +01:00 committed by GitHub
commit fdd61881f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 6 deletions

View File

@ -23,6 +23,9 @@
// time sync via LoRaWAN network, note: not supported by TTNv2 // time sync via LoRaWAN network, note: not supported by TTNv2
//#define LMIC_ENABLE_DeviceTimeReq 1 //#define LMIC_ENABLE_DeviceTimeReq 1
// use callback event handlers, not onEvent() reference
#define LMIC_ENABLE_onEvent 0
// This tells LMIC to make the receive windows bigger, in case your clock is // This tells LMIC to make the receive windows bigger, in case your clock is
// faster or slower. This causes the transceiver to be earlier switched on, // faster or slower. This causes the transceiver to be earlier switched on,
// so consuming more power. You may sharpen (reduce) this value if you are // so consuming more power. You may sharpen (reduce) this value if you are

View File

@ -89,9 +89,7 @@ void lora_setupForNetwork(bool preJoin) {
// other regions, this will need to be changed. // other regions, this will need to be changed.
LMIC_selectSubBand(1); LMIC_selectSubBand(1);
#elif CFG_LMIC_EU_like #elif CFG_LMIC_EU_like
// setting for TheThingsNetwork // settings for TheThingsNetwork
// TTN uses SF9, not SF12, for RX2 window
LMIC.dn2Dr = EU868_DR_SF9;
// Enable link check validation // Enable link check validation
LMIC_setLinkCheckMode(true); LMIC_setLinkCheckMode(true);
#endif #endif

View File

@ -246,7 +246,7 @@ int do_ota_update() {
goto retry; goto retry;
} }
#ifdef HAS_LED #if (HAS_LED != NOT_A_PIN)
#ifndef LED_ACTIVE_LOW #ifndef LED_ACTIVE_LOW
if (!Update.begin(contentLength, U_FLASH, HAS_LED, HIGH)) { if (!Update.begin(contentLength, U_FLASH, HAS_LED, HIGH)) {
#else #else

View File

@ -34,8 +34,15 @@ void do_after_reset(int reason) {
RTC_runmode = RUNMODE_POWERCYCLE; RTC_runmode = RUNMODE_POWERCYCLE;
break; break;
case SW_CPU_RESET: // 0x0c Software reset CPU
// keep previous runmode (could be RUNMODE_UPDATE)
break;
case DEEPSLEEP_RESET: // 0x05 Deep Sleep reset digital core case DEEPSLEEP_RESET: // 0x05 Deep Sleep reset digital core
RTC_runmode = RUNMODE_WAKEUP; RTC_runmode = RUNMODE_WAKEUP;
#if (HAS_LORA)
// to be done: restore LoRaWAN channel configuration and datarate here
#endif
break; break;
case SW_RESET: // 0x03 Software reset digital core case SW_RESET: // 0x03 Software reset digital core
@ -46,11 +53,11 @@ void do_after_reset(int reason) {
case RTCWDT_SYS_RESET: // 0x09 RTC Watch dog Reset digital core case RTCWDT_SYS_RESET: // 0x09 RTC Watch dog Reset digital core
case INTRUSION_RESET: // 0x0a Instrusion tested to reset CPU case INTRUSION_RESET: // 0x0a Instrusion tested to reset CPU
case TGWDT_CPU_RESET: // 0x0b Time Group reset CPU case TGWDT_CPU_RESET: // 0x0b Time Group reset CPU
case SW_CPU_RESET: // 0x0c Software reset CPU
case RTCWDT_CPU_RESET: // 0x0d RTC Watch dog Reset CPU case RTCWDT_CPU_RESET: // 0x0d RTC Watch dog Reset CPU
case EXT_CPU_RESET: // 0x0e for APP CPU, reseted by PRO CPU case EXT_CPU_RESET: // 0x0e for APP CPU, reseted by PRO CPU
case RTCWDT_RTC_RESET: // 0x10 RTC Watch dog reset digital core and rtc mode case RTCWDT_RTC_RESET: // 0x10 RTC Watch dog reset digital core and rtc mode
default: default:
RTC_runmode = RUNMODE_POWERCYCLE;
break; break;
} }
@ -66,6 +73,9 @@ void enter_deepsleep(const int wakeup_sec, const gpio_num_t wakeup_gpio) {
#if (HAS_LORA) #if (HAS_LORA)
if (os_queryTimeCriticalJobs(ms2osticks(10000))) if (os_queryTimeCriticalJobs(ms2osticks(10000)))
return; return;
// to be done: save LoRaWAN channel configuration here
#endif #endif
// set up power domains // set up power domains