|
|
@ -144,15 +144,17 @@ void inline lightsleep() { |
|
|
|
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T); |
|
|
|
wifi_fpm_open(); // Enables force sleep
|
|
|
|
GPIO_DIS_OUTPUT(GPIO_ID_PIN(GEIGER_PIN)); |
|
|
|
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U,FUNC_GPIO13); // PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U,FUNC_GPIO13);
|
|
|
|
//PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U,FUNC_GPIO13);
|
|
|
|
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U,FUNC_GPIO13); |
|
|
|
gpio_pin_wakeup_enable(GPIO_ID_PIN(GEIGER_PIN), GPIO_PIN_INTR_LOLEVEL); |
|
|
|
wifi_fpm_set_wakeup_cb(fpm_wakup_cb_func1); |
|
|
|
Serial.flush(); |
|
|
|
delay(1); |
|
|
|
wifi_fpm_do_sleep(0xFFFFFFF); // Sleep for longest possible time // this does not work: (uint32_t)postingInterval*1000
|
|
|
|
delay(1); // go to sleep now
|
|
|
|
DEBUG_MSG("[DEBUG] woken\n"); |
|
|
|
//wifi_fpm_do_wakeup();
|
|
|
|
wifi_fpm_close(); |
|
|
|
//wifi_fpm_do_wakeup(); // wake from modem sleep
|
|
|
|
wifi_fpm_close(); // disable force sleep function
|
|
|
|
} |
|
|
|
|
|
|
|
void ICACHE_FLASH_ATTR getValuesJSON(char* buffer, const size_t buf_len, int format) { |
|
|
@ -379,7 +381,9 @@ void ICACHE_FLASH_ATTR sendValues() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#if ESP_SDK_VERSION_NUMBER >= 0x020200 |
|
|
|
net.setInsecure(); |
|
|
|
#endif |
|
|
|
mqttclient.begin(mqttserver, 8883, net); |
|
|
|
constexpr unsigned int retry_delay = 500; |
|
|
|
for (int tries=0; tries<5 && !mqttclient.connect(mqttusername, mqttusername, mqttpassword); tries++ ) { |
|
|
|