feature/http_call_send_json #3

Merged
f merged 56 commits from feature/http_call_send_json into master 2022-11-27 11:02:22 +01:00
3 changed files with 38 additions and 2 deletions
Showing only changes of commit 35c62fbce2 - Show all commits

View file

@ -5,7 +5,7 @@
#define WIFI_AUTOCONNECT_TIMEOUT_S 120
#define WIFI_CONFIG_PORTAL_TIMEOUT_S 120
#define UPDATE_SENSOR_INTERVAL_S 180
#define UPDATE_SENSOR_INTERVAL_S 300
#define UPDATE_WEBSERVER_INTVERVAL_S 1 // Do not change, bigger values will prevent using webupdater webinterface
#define DELAY_LOOP_MS 100
#define POWERSAVING_SLEEP_S 600

View file

@ -318,10 +318,20 @@ void loop()
void _loop()
{
#ifdef WEBUPDATER_FEATURE
if ((update_webserver_cnt + (UPDATE_WEBSERVER_INTVERVAL_S * 1000)) <= millis())
{
//debug("web updater call");
update_webserver_cnt = millis();
doWebUpdater();
}
#endif
switch (fsm_state)
{
case FSM_STATE_WU:
/*
//debug("web updater call if required");
#ifdef WEBUPDATER_FEATURE
if ((update_webserver_cnt + (UPDATE_WEBSERVER_INTVERVAL_S * 1000)) <= millis())
@ -331,6 +341,7 @@ void _loop()
doWebUpdater();
}
#endif
*/
fsm_state = FSM_STATE_WSE;
break;

View file

@ -2,7 +2,8 @@
#include "config_user.h"
#include "config.h"
unsigned int anemometerRotations = 0;
unsigned int anemometerRotations = 0;
uint32_t start_meas_wind_time = 0;
ICACHE_RAM_ATTR void _anemometerInterrupt()
{
@ -12,6 +13,7 @@ ICACHE_RAM_ATTR void _anemometerInterrupt()
#endif
}
/*
float wind_speed()
{
anemometerRotations = 0;
@ -32,3 +34,26 @@ float wind_speed()
return tmp_speed;
}
*/
void start_measure_wind()
{
start_meas_wind_time = millis();
anemometerRotations = 0;
interruptNumber = digitalPinToInterrupt(ANEMOMETER_PIN);
}
boolean check_measure_wind_done()
{
if (start_meas_wind + WIND_SENSOR_MEAS_TIME_S <= millis())
{
detachInterrupt(interruptNumber);
return true;
}
return false;
}
float stop_measure_wind()
{
return (float)anemometerRotations * WINDSPEED_FACTOR;
}