Browse Source

set max sleep time

main
Hendrik Langer 5 years ago
parent
commit
4ccc1976c4
  1. 5
      src/main.cpp

5
src/main.cpp

@ -147,8 +147,8 @@ void inline lightsleep() {
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); gpio_pin_wakeup_enable(GPIO_ID_PIN(GEIGER_PIN), GPIO_PIN_INTR_LOLEVEL);
wifi_fpm_set_wakeup_cb(fpm_wakup_cb_func1); wifi_fpm_set_wakeup_cb(fpm_wakup_cb_func1);
wifi_fpm_do_sleep(0xFFFFFFF); // Sleep for longest possible time wifi_fpm_do_sleep((uint32_t)postingInterval*1000); // 0xFFFFFFF: Sleep for longest possible time
//delay(1); //delay(500);
} }
void ICACHE_FLASH_ATTR getValuesJSON(char* buffer, const size_t buf_len, int format) { void ICACHE_FLASH_ATTR getValuesJSON(char* buffer, const size_t buf_len, int format) {
@ -373,7 +373,6 @@ void ICACHE_FLASH_ATTR sendValues() {
net.setInsecure(); net.setInsecure();
mqttclient.begin(mqttserver, 8883, net); mqttclient.begin(mqttserver, 8883, net);
int tries = 0;
constexpr unsigned int retry_delay = 500; constexpr unsigned int retry_delay = 500;
for (int tries=0; tries<5 && !mqttclient.connect(mqttusername, mqttusername, mqttpassword); tries++ ) { for (int tries=0; tries<5 && !mqttclient.connect(mqttusername, mqttusername, mqttpassword); tries++ ) {
DEBUG_MSG("."); DEBUG_MSG(".");

Loading…
Cancel
Save