mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-10-26 22:10:45 +00:00
[Build] Change 'unsigned long' to 'uint32_t'
This commit is contained in:
1 parent
233602d268
commit
157a954e5d
139 files changed
+401
-394
No files matched your search
@@ -170,12 +170,12 @@ uint8_t rn2xx3::get_busy_count() const
|
||||
return _rn2xx3_handler.get_busy_count();
|
||||
}
|
||||
|
||||
rn2xx3_handler::RN_state rn2xx3::wait_command_finished(unsigned long timeout)
|
||||
rn2xx3_handler::RN_state rn2xx3::wait_command_finished(uint32_t timeout)
|
||||
{
|
||||
return _rn2xx3_handler.wait_command_finished(timeout);
|
||||
}
|
||||
|
||||
rn2xx3_handler::RN_state rn2xx3::wait_command_accepted(unsigned long timeout)
|
||||
rn2xx3_handler::RN_state rn2xx3::wait_command_accepted(uint32_t timeout)
|
||||
{
|
||||
return _rn2xx3_handler.wait_command_accepted(timeout);
|
||||
}
|
||||
@@ -226,7 +226,7 @@ bool rn2xx3::setDR(int dr)
|
||||
return _rn2xx3_handler.setDR(dr);
|
||||
}
|
||||
|
||||
void rn2xx3::sleep(long msec)
|
||||
void rn2xx3::sleep(int32_t msec)
|
||||
{
|
||||
// FIXME TD-er: Must make this a command that waits for other commands to be finished first.
|
||||
_rn2xx3_handler._serial.print(F("sys sleep "));
|
||||
|
||||
@@ -210,9 +210,9 @@ public:
|
||||
|
||||
uint8_t get_busy_count() const;
|
||||
|
||||
rn2xx3_handler::RN_state wait_command_finished(unsigned long timeout = 10000);
|
||||
rn2xx3_handler::RN_state wait_command_finished(uint32_t timeout = 10000);
|
||||
|
||||
rn2xx3_handler::RN_state wait_command_accepted(unsigned long timeout = 10000);
|
||||
rn2xx3_handler::RN_state wait_command_accepted(uint32_t timeout = 10000);
|
||||
|
||||
bool command_finished() const;
|
||||
|
||||
@@ -266,7 +266,7 @@ public:
|
||||
* The RN2xx3 accepts values from 100 to 4294967296.
|
||||
* Rumour has it that you need to do a autobaud() after the module wakes up again.
|
||||
*/
|
||||
void sleep(long msec);
|
||||
void sleep(int32_t msec);
|
||||
|
||||
/*
|
||||
* Send a raw command to the RN2xx3 module.
|
||||
|
||||
@@ -16,7 +16,7 @@ String rn2xx3_handler::sendRawCommand(const __FlashStringHelper* command)
|
||||
|
||||
String rn2xx3_handler::sendRawCommand(const String& command)
|
||||
{
|
||||
unsigned long timer = millis();
|
||||
uint32_t timer = millis();
|
||||
|
||||
if (!prepare_raw_command(command)) {
|
||||
setLastError(F("sendRawCommand: Prepare fail"));
|
||||
@@ -199,10 +199,10 @@ rn2xx3_handler::RN_state rn2xx3_handler::async_loop()
|
||||
return get_state();
|
||||
}
|
||||
|
||||
rn2xx3_handler::RN_state rn2xx3_handler::wait_command_finished(unsigned long timeout)
|
||||
rn2xx3_handler::RN_state rn2xx3_handler::wait_command_finished(uint32_t timeout)
|
||||
{
|
||||
// Still use a timeout to prevent endless loops, although the state machine should always obey the set timeouts.
|
||||
unsigned long start_timer = millis();
|
||||
uint32_t start_timer = millis();
|
||||
|
||||
while ((millis() - start_timer) < timeout) {
|
||||
async_loop();
|
||||
@@ -213,10 +213,10 @@ rn2xx3_handler::RN_state rn2xx3_handler::wait_command_finished(unsigned long tim
|
||||
return get_state();
|
||||
}
|
||||
|
||||
rn2xx3_handler::RN_state rn2xx3_handler::wait_command_accepted(unsigned long timeout)
|
||||
rn2xx3_handler::RN_state rn2xx3_handler::wait_command_accepted(uint32_t timeout)
|
||||
{
|
||||
// Still use a timeout to prevent endless loops, although the state machine should always obey the set timeouts.
|
||||
unsigned long start_timer = millis();
|
||||
uint32_t start_timer = millis();
|
||||
|
||||
while ((millis() - start_timer) < timeout) {
|
||||
async_loop();
|
||||
@@ -709,7 +709,7 @@ const String& rn2xx3_handler::get_received_data() const {
|
||||
return _receivedData;
|
||||
}
|
||||
|
||||
const String& rn2xx3_handler::get_received_data(unsigned long& duration) const {
|
||||
const String& rn2xx3_handler::get_received_data(uint32_t& duration) const {
|
||||
duration = millis() - _start_prep;
|
||||
return _receivedData;
|
||||
}
|
||||
@@ -960,7 +960,7 @@ bool rn2xx3_handler::read_line()
|
||||
return false;
|
||||
}
|
||||
|
||||
void rn2xx3_handler::set_timeout(unsigned long timeout)
|
||||
void rn2xx3_handler::set_timeout(uint32_t timeout)
|
||||
{
|
||||
_timeout = timeout;
|
||||
_start = millis();
|
||||
|
||||
@@ -46,12 +46,12 @@ public:
|
||||
RN_state async_loop();
|
||||
|
||||
// Wait for the command to be handled completely (including reply in RX2 window)
|
||||
RN_state wait_command_finished(unsigned long timeout = 10000);
|
||||
RN_state wait_command_finished(uint32_t timeout = 10000);
|
||||
|
||||
// Shorter wait, to be used in async mode.
|
||||
// This will return early when the message cannot be sent (e.g. due to duty cycle exceeded)
|
||||
// It will return when the state waiting for reply_received_rx2 has been reached, or the command has finished (due to error)
|
||||
RN_state wait_command_accepted(unsigned long timeout = 10000);
|
||||
RN_state wait_command_accepted(uint32_t timeout = 10000);
|
||||
|
||||
// Check whether a command has finished.
|
||||
bool command_finished() const;
|
||||
@@ -175,7 +175,7 @@ public:
|
||||
// Get the received data
|
||||
const String& get_received_data() const;
|
||||
|
||||
const String& get_received_data(unsigned long& duration) const;
|
||||
const String& get_received_data(uint32_t& duration) const;
|
||||
|
||||
// Get the downlink message, received during RX2 after TX command.
|
||||
const String& get_rx_message() const;
|
||||
@@ -221,7 +221,7 @@ private:
|
||||
// read all available data from serial until '\n'
|
||||
bool read_line();
|
||||
|
||||
void set_timeout(unsigned long timeout);
|
||||
void set_timeout(uint32_t timeout);
|
||||
|
||||
bool time_out_reached() const;
|
||||
|
||||
@@ -259,9 +259,9 @@ private:
|
||||
String _sendData; // Complete command to send to the module
|
||||
String _rxMessenge; // Message received (during RX2 window) after a TX
|
||||
String _lastError; // Last error message received from module (or set by user)
|
||||
unsigned long _start_prep = 0; // timestamp of preparing command
|
||||
unsigned long _start = 0; // timestamp of last set timeout
|
||||
unsigned long _timeout = 100; // timeout duration
|
||||
uint32_t _start_prep = 0; // timestamp of preparing command
|
||||
uint32_t _start = 0; // timestamp of last set timeout
|
||||
uint32_t _timeout = 100; // timeout duration
|
||||
uint32_t _rxdelay1 = 5000; // delay from last moment of sending to receive RX1 window
|
||||
uint32_t _rxdelay2 = 6000; // delay from last moment of sending to receive RX2 window
|
||||
uint8_t _busy_count = 0; // Number of times the module replied with "busy"
|
||||
|
||||
@@ -55,7 +55,7 @@ String rn2xx3_helper::base16decode(const String& input_c)
|
||||
toDo[0] = input[i * 2];
|
||||
toDo[1] = input[i * 2 + 1];
|
||||
toDo[2] = '\0';
|
||||
unsigned long out = strtoul(toDo, 0, 16);
|
||||
uint32_t out = strtoul(toDo, 0, 16);
|
||||
|
||||
if (out <= 0xFF)
|
||||
{
|
||||
|
||||
@@ -11,12 +11,12 @@ boolean printToWebJSON = false;
|
||||
|
||||
|
||||
|
||||
unsigned long timermqtt_interval = 100;
|
||||
unsigned long lastSend = 0;
|
||||
unsigned long lastWeb = 0;
|
||||
uint32_t timermqtt_interval = 100;
|
||||
uint32_t lastSend = 0;
|
||||
uint32_t lastWeb = 0;
|
||||
|
||||
unsigned long wdcounter = 0;
|
||||
unsigned long timerAwakeFromDeepSleep = 0;
|
||||
uint32_t wdcounter = 0;
|
||||
uint32_t timerAwakeFromDeepSleep = 0;
|
||||
|
||||
|
||||
#if FEATURE_ADC_VCC
|
||||
|
||||
@@ -75,14 +75,14 @@ extern boolean printToWebJSON;
|
||||
|
||||
|
||||
// FIXME TD-er: Must move this to some proper class (ESPEasy_Scheduler ?)
|
||||
extern unsigned long timermqtt_interval;
|
||||
extern uint32_t timermqtt_interval;
|
||||
|
||||
|
||||
extern unsigned long lastSend;
|
||||
extern unsigned long lastWeb;
|
||||
extern uint32_t lastSend;
|
||||
extern uint32_t lastWeb;
|
||||
|
||||
extern unsigned long wdcounter;
|
||||
extern unsigned long timerAwakeFromDeepSleep;
|
||||
extern uint32_t wdcounter;
|
||||
extern uint32_t timerAwakeFromDeepSleep;
|
||||
|
||||
|
||||
#if FEATURE_ADC_VCC
|
||||
|
||||
@@ -357,7 +357,7 @@ uint32_t getEEPROMMaxSlots() {
|
||||
const uint32_t eepromSize = getEEPROMSize(static_cast<EEPROMExternal_Type_e>(Settings.EEPROMExternalType()));
|
||||
|
||||
if (eepromSize) {
|
||||
const uint32_t slotMax = (unsigned long)(((eepromSize - EEPROM_CUSTOM_START_OFFSET) / EEPROM_CUSTOM_DIVISOR) / sizeof_eeprom_slot);
|
||||
const uint32_t slotMax = (uint32_t)(((eepromSize - EEPROM_CUSTOM_START_OFFSET) / EEPROM_CUSTOM_DIVISOR) / sizeof_eeprom_slot);
|
||||
|
||||
return slotMax;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ struct WiFi_AP_Candidate {
|
||||
# endif // if ESP_IDF_VERSION_MAJOR >= 5
|
||||
# endif // ifdef ESP32
|
||||
|
||||
unsigned long last_seen = 0u;
|
||||
uint32_t last_seen = 0u;
|
||||
MAC_address bssid;
|
||||
int8_t rssi{};
|
||||
uint8_t channel{};
|
||||
|
||||
@@ -535,7 +535,8 @@ bool NWPluginCall(NWPlugin::Function Function, EventStruct *event, String& str)
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
case NWPlugin::Function::NWPLUGIN_MAX_FUNCTION:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -545,7 +545,7 @@ String formatScanResult(int i, const String& separator, int32_t& rssi) {
|
||||
}
|
||||
|
||||
void logConnectionStatus() {
|
||||
static unsigned long lastLog = 0;
|
||||
static uint32_t lastLog = 0;
|
||||
|
||||
if ((lastLog != 0) && (timePassedSince(lastLog) < 1000)) {
|
||||
return;
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ if (!try_connect_host(cpluginID, client, ControllerSettings, F("TELNT: ")))
|
||||
// addLog(LOG_LEVEL_ERROR, log);
|
||||
client.print(" \n");
|
||||
|
||||
unsigned long timer = millis() + 200;
|
||||
uint32_t timer = millis() + 200;
|
||||
|
||||
while (!client_available(client) && !timeOutReached(timer)) {
|
||||
delay(1);
|
||||
|
||||
+2
-2
@@ -61,7 +61,7 @@ boolean Blynk_keep_connection_c015(int controllerIndex,
|
||||
ControllerSettingsStruct& ControllerSettings);
|
||||
|
||||
|
||||
static unsigned long _C015_LastConnectAttempt[CONTROLLER_MAX] = { 0, 0, 0 };
|
||||
static uint32_t _C015_LastConnectAttempt[CONTROLLER_MAX] = { 0, 0, 0 };
|
||||
|
||||
void CPlugin_015_handleInterrupt() {
|
||||
// This cplugin uses modified blynk library.
|
||||
@@ -447,7 +447,7 @@ boolean Blynk_send_c015(const String& value, int vPin, unsigned int clientTimeou
|
||||
{
|
||||
Blynk.virtualWrite(vPin, value);
|
||||
|
||||
unsigned long timer = millis() + clientTimeout;
|
||||
uint32_t timer = millis() + clientTimeout;
|
||||
|
||||
while (!timeOutReached(timer)) {
|
||||
backgroundtasks();
|
||||
|
||||
+1
-1
@@ -405,7 +405,7 @@ bool do_process_c018_delay_queue(cpluginID_t cpluginID, const Queue_element_base
|
||||
|
||||
if (success) {
|
||||
if (airtime_ms > 0.0f) {
|
||||
ADD_TIMER_STAT(C018_AIR_TIME, static_cast<unsigned long>(airtime_ms * 1000));
|
||||
ADD_TIMER_STAT(C018_AIR_TIME, static_cast<uint32_t>(airtime_ms * 1000));
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
String log = F("LoRaWAN : Payload Length: ");
|
||||
|
||||
+1
-1
@@ -463,7 +463,7 @@ if (!C023_data->command_finished()) {
|
||||
|
||||
if (success) {
|
||||
if (airtime_ms > 0.0f) {
|
||||
ADD_TIMER_STAT(C023_AIR_TIME, static_cast<unsigned long>(airtime_ms * 1000));
|
||||
ADD_TIMER_STAT(C023_AIR_TIME, static_cast<uint32_t>(airtime_ms * 1000));
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
String log = F("LoRaWAN : Payload Length: ");
|
||||
|
||||
+1
-1
@@ -877,7 +877,7 @@ boolean Plugin_016(uint8_t function, struct EventStruct *event, String& string)
|
||||
|
||||
# if !P016_SEND_IR_TO_CONTROLLER
|
||||
{
|
||||
unsigned long IRcode = results.value;
|
||||
uint32_t IRcode = results.value;
|
||||
UserVar.setSensorTypeLong(event->TaskIndex, IRcode);
|
||||
}
|
||||
# endif // if !P016_SEND_IR_TO_CONTROLLER
|
||||
|
||||
+3
-3
@@ -229,7 +229,7 @@ bool P017_handle_timer_in(struct EventStruct *event)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
static unsigned long tempcounter = 0;
|
||||
static uint32_t tempcounter = 0;
|
||||
static uint8_t errorCount = 0;
|
||||
|
||||
switch (event->Par1) {
|
||||
@@ -341,13 +341,13 @@ bool P017_handle_timer_in(struct EventStruct *event)
|
||||
DIRECT_pinWrite(P017_DEBUG_LOGIC_ANALYZER_PIN_INIT, 1);
|
||||
# endif // ifdef P017_DEBUG_LOGIC_ANALYZER_PIN_INIT
|
||||
|
||||
unsigned long key = uid[0];
|
||||
uint32_t key = uid[0];
|
||||
|
||||
for (uint8_t i = 1; i < 4; ++i) {
|
||||
key <<= 8;
|
||||
key += uid[i];
|
||||
}
|
||||
const unsigned long old_key = UserVar.getSensorTypeLong(event->TaskIndex);
|
||||
const uint32_t old_key = UserVar.getSensorTypeLong(event->TaskIndex);
|
||||
bool new_key = false;
|
||||
|
||||
if (old_key != key) {
|
||||
|
||||
+2
-2
@@ -163,10 +163,10 @@ boolean Plugin_040(uint8_t function, struct EventStruct *event, String& string)
|
||||
|
||||
// endof workaround
|
||||
|
||||
unsigned long key = 0, old_key = 0;
|
||||
uint32_t key = 0, old_key = 0;
|
||||
old_key = UserVar.getSensorTypeLong(event->TaskIndex);
|
||||
|
||||
for (uint8_t i = 1; i < 5; ++i) { key = key | (((unsigned long)code[i] << ((4 - i) * 8))); }
|
||||
for (uint8_t i = 1; i < 5; ++i) { key = key | (((uint32_t)code[i] << ((4 - i) * 8))); }
|
||||
bool new_key = false;
|
||||
|
||||
if (old_key != key) {
|
||||
|
||||
@@ -229,15 +229,15 @@ boolean Plugin_043(uint8_t function, struct EventStruct *event, String& string)
|
||||
{
|
||||
if (P043_MAX_SETTINGS == 0) { P043_MAX_SETTINGS = P043_DEFAULT_MAX; }
|
||||
|
||||
unsigned long clockEvent = (unsigned long)node_time.minute() % 10
|
||||
| (unsigned long)(node_time.minute() / 10) << 4
|
||||
| (unsigned long)(node_time.hour() % 10) << 8
|
||||
| (unsigned long)(node_time.hour() / 10) << 12
|
||||
| (unsigned long)node_time.weekday() << 16;
|
||||
uint32_t clockEvent = (uint32_t)node_time.minute() % 10
|
||||
| (uint32_t)(node_time.minute() / 10) << 4
|
||||
| (uint32_t)(node_time.hour() % 10) << 8
|
||||
| (uint32_t)(node_time.hour() / 10) << 12
|
||||
| (uint32_t)node_time.weekday() << 16;
|
||||
|
||||
for (uint8_t x = 0; x < P043_MAX_SETTINGS; x++)
|
||||
{
|
||||
unsigned long clockSet = Cache.getTaskDevicePluginConfigLong(event->TaskIndex, x);
|
||||
uint32_t clockSet = Cache.getTaskDevicePluginConfigLong(event->TaskIndex, x);
|
||||
|
||||
# ifndef PLUGIN_BUILD_MINIMAL_OTA
|
||||
|
||||
|
||||
@@ -129,10 +129,10 @@ P046_data_struct*P046_data = nullptr;
|
||||
// TODO TD-er: Not sure what to do with these, since interrupt driven data + callback functions should be fast and small
|
||||
// Not sure if it is possible to share it with other instances.
|
||||
// Vars used for interpreting the data:
|
||||
volatile unsigned long Plugin_046_lastrainctr; // Keep track of wdcounter (1/2 min tick)
|
||||
volatile uint32_t Plugin_046_lastrainctr; // Keep track of wdcounter (1/2 min tick)
|
||||
volatile int Plugin_046_lastraincount; // Last rain count
|
||||
volatile float Plugin_046_rainmmph = 0;
|
||||
volatile unsigned long Plugin_046_laststrikectr; // Keep track of wdcounter (1/2 min tick)
|
||||
volatile uint32_t Plugin_046_laststrikectr; // Keep track of wdcounter (1/2 min tick)
|
||||
volatile unsigned int Plugin_046_laststrikecount; // Last number of strikes
|
||||
volatile int Plugin_046_strikesph = 0;
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ HLW8012 *Plugin_076_hlw = nullptr;
|
||||
OversamplingHelper<float>p076_values[P076_NR_OUTPUT_OPTIONS]{};
|
||||
int StoredTaskIndex = -1;
|
||||
uint8_t p076_read_stage{};
|
||||
unsigned long p076_timer{};
|
||||
uint32_t p076_timer{};
|
||||
|
||||
// Forward declaration helper function
|
||||
const __FlashStringHelper* p076_getQueryString(uint8_t value_nr,
|
||||
|
||||
@@ -272,7 +272,7 @@ boolean Plugin_091(uint8_t function, struct EventStruct *event, String& string)
|
||||
Plugin_091_cmddbl = PCONFIG(3);
|
||||
Plugin_091_ipd = PCONFIG(4);
|
||||
const int bauds[] = { 9600, 19200, 115200, 1200, 2400, 4800, 38400, 57600 };
|
||||
unsigned long Plugin_091_speed = bauds[PCONFIG(2)];
|
||||
uint32_t Plugin_091_speed = bauds[PCONFIG(2)];
|
||||
ESPEASY_SERIAL_0.begin(Plugin_091_speed, SERIAL_8N1);
|
||||
log += strformat(F(" LCTech %d baud %d btn"), Plugin_091_speed, Plugin_091_numrelay);
|
||||
} else
|
||||
@@ -692,7 +692,7 @@ boolean Plugin_091(uint8_t function, struct EventStruct *event, String& string)
|
||||
if (Plugin_091_globalpar0 < SER_SWITCH_LCTECH) {
|
||||
par3 = Plugin_091_globalpar1;
|
||||
}
|
||||
unsigned long timer = event->Par3 * 1000;
|
||||
uint32_t timer = event->Par3 * 1000;
|
||||
|
||||
sendmcucommand(rnum, rcmd, Plugin_091_globalpar0, par3); // init state
|
||||
// Scheduler.setPluginTimer(timer, PLUGIN_ID_091, rnum, !rcmd);
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@
|
||||
// PCONFIG(n) : stores an integer (8)
|
||||
// PCONFIG_FLOAT : stors a float (4)
|
||||
// PCONFIG_LONG : stores a long (4, shared with PCONFIG_ULONG)
|
||||
// PCONFIG_ULONG : stores an unsigned long (4, shared with PCONFIG_LONG)
|
||||
// PCONFIG_ULONG : stores an uint32_t (4, shared with PCONFIG_LONG)
|
||||
# define P145_PCONFIG_RLOAD PCONFIG_FLOAT(0)
|
||||
# define P145_PCONFIG_RZERO PCONFIG_FLOAT(1)
|
||||
# define P145_PCONFIG_REF PCONFIG_FLOAT(2)
|
||||
|
||||
@@ -114,7 +114,7 @@ bool Blynk_get(const String& command, controllerIndex_t controllerIndex, float *
|
||||
bool success = !MustCheckReply;
|
||||
|
||||
if (MustCheckReply || data) {
|
||||
unsigned long timer = millis() + ClientTimeout;
|
||||
uint32_t timer = millis() + ClientTimeout;
|
||||
|
||||
while (!client_available(client) && !timeOutReached(timer)) {
|
||||
delay(1);
|
||||
@@ -180,7 +180,7 @@ bool Blynk_get(const String& command, controllerIndex_t controllerIndex, float *
|
||||
client.stop();
|
||||
|
||||
// important - backgroundtasks - free mem
|
||||
unsigned long timer = millis() + 10;
|
||||
uint32_t timer = millis() + 10;
|
||||
|
||||
while (!timeOutReached(timer)) {
|
||||
backgroundtasks();
|
||||
|
||||
@@ -126,7 +126,7 @@ const __FlashStringHelper * Command_MemInfo_detail(struct EventStruct *event, co
|
||||
|
||||
const __FlashStringHelper * Command_Background(struct EventStruct *event, const char *Line)
|
||||
{
|
||||
unsigned long timer = millis() + parseCommandArgumentInt(Line, 1);
|
||||
uint32_t timer = millis() + parseCommandArgumentInt(Line, 1);
|
||||
|
||||
serialPrintln(F("start"));
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@ const __FlashStringHelper * Command_GPIO_PWM(struct EventStruct *event, const ch
|
||||
const __FlashStringHelper * Command_GPIO_Tone(struct EventStruct *event, const char *Line)
|
||||
{
|
||||
// play a tone on pin par1, with frequency par2 and duration in msec par3.
|
||||
unsigned long duration = event->Par3;
|
||||
uint32_t duration = event->Par3;
|
||||
bool mustScheduleToneOff = false;
|
||||
|
||||
if (duration > 50) {
|
||||
|
||||
@@ -310,7 +310,7 @@ String Command_Wifi_OTA_hosted_mcu(
|
||||
|
||||
// Prevent reading more data than expected
|
||||
if (size > len) {
|
||||
addLog(LOG_LEVEL_ERROR, strformat(F("ERROR: Update received extra bytes: %lu!"), (unsigned long)size - len));
|
||||
addLog(LOG_LEVEL_ERROR, strformat(F("ERROR: Update received extra bytes: %lu!"), (uint32_t)size - len));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ struct EventStruct;
|
||||
// Do NOT change order of members!
|
||||
struct C016_binary_element {
|
||||
TaskValues_Data_t values{};
|
||||
unsigned long unixTime{};
|
||||
uint32_t unixTime{};
|
||||
taskIndex_t TaskIndex{ INVALID_TASK_INDEX };
|
||||
pluginID_t pluginID{ INVALID_PLUGIN_ID };
|
||||
Sensor_VType sensorType{ Sensor_VType::SENSOR_TYPE_NONE };
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
|
||||
TaskValues_Data_t values{};
|
||||
|
||||
unsigned long unixTime = 0;
|
||||
uint32_t unixTime = 0;
|
||||
Sensor_VType sensorType{ Sensor_VType::SENSOR_TYPE_NONE };
|
||||
uint8_t valueCount{};
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
virtual const UnitMessageCount_t* getUnitMessageCount() const = 0;
|
||||
virtual UnitMessageCount_t * getUnitMessageCount() = 0;
|
||||
|
||||
unsigned long _timestamp;
|
||||
uint32_t _timestamp;
|
||||
controllerIndex_t _controller_idx;
|
||||
taskIndex_t _taskIndex;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ struct C018_ConfigStruct
|
||||
char DeviceAddr[C018_DEVICE_ADDR_LEN] = { 0 };
|
||||
char NetworkSessionKey[C018_NETWORK_SESSION_KEY_LEN] = { 0 };
|
||||
char AppSessionKey[C018_APP_SESSION_KEY_LEN] = { 0 };
|
||||
unsigned long baudrate = 57600;
|
||||
uint32_t baudrate = 57600;
|
||||
int8_t rxpin = -1;
|
||||
int8_t txpin = -1;
|
||||
int8_t resetpin = -1;
|
||||
|
||||
@@ -50,7 +50,7 @@ struct C023_ConfigStruct
|
||||
char DeviceAddr[C023_DEVICE_ADDR_LEN] = { 0 };
|
||||
char NetworkSessionKey[C023_NETWORK_SESSION_KEY_LEN] = { 0 };
|
||||
char AppSessionKey[C023_APP_SESSION_KEY_LEN] = { 0 };
|
||||
unsigned long baudrate = 9600;
|
||||
uint32_t baudrate = 9600;
|
||||
int8_t rxpin = -1;
|
||||
int8_t txpin = -1;
|
||||
int8_t resetpin = -1;
|
||||
|
||||
@@ -31,7 +31,7 @@ void C018_data_struct::reset() {
|
||||
autobaud_success = false;
|
||||
}
|
||||
|
||||
bool C018_data_struct::init(const uint8_t port, const int8_t serial_rx, const int8_t serial_tx, unsigned long baudrate,
|
||||
bool C018_data_struct::init(const uint8_t port, const int8_t serial_rx, const int8_t serial_tx, uint32_t baudrate,
|
||||
bool joinIsOTAA, taskIndex_t sampleSet_Initiator, int8_t reset_pin) {
|
||||
if ((serial_rx < 0) || (serial_tx < 0)) {
|
||||
// Both pins are needed, or else no serial possible
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
bool init(const uint8_t port,
|
||||
const int8_t serial_rx,
|
||||
const int8_t serial_tx,
|
||||
unsigned long baudrate,
|
||||
uint32_t baudrate,
|
||||
bool joinIsOTAA,
|
||||
taskIndex_t sampleSet_Initiator,
|
||||
int8_t reset_pin);
|
||||
@@ -117,7 +117,7 @@ private:
|
||||
String cacheDevAddr;
|
||||
String cacheHWEUI;
|
||||
String cacheSysVer;
|
||||
unsigned long _baudrate = 57600;
|
||||
uint32_t _baudrate = 57600;
|
||||
uint8_t sampleSetCounter = 0;
|
||||
taskIndex_t sampleSetInitiator = INVALID_TASK_INDEX;
|
||||
int8_t _resetPin = -1;
|
||||
|
||||
@@ -35,7 +35,7 @@ bool C023_data_struct::init(
|
||||
const uint8_t port = config.serialPort;
|
||||
const int8_t serial_rx = config.rxpin;
|
||||
const int8_t serial_tx = config.txpin;
|
||||
unsigned long baudrate = config.baudrate;
|
||||
uint32_t baudrate = config.baudrate;
|
||||
bool joinIsOTAA = (config.getJoinMethod() == LoRa_Helper::LoRaWAN_JoinMethod::OTAA);
|
||||
int8_t reset_pin = config.resetpin;
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ private:
|
||||
|
||||
|
||||
ESPeasySerial *_easySerial = nullptr;
|
||||
unsigned long _baudrate = 9600;
|
||||
uint32_t _baudrate = 9600;
|
||||
uint8_t sampleSetCounter = 0;
|
||||
taskIndex_t sampleSetInitiator = INVALID_TASK_INDEX;
|
||||
int8_t _resetPin = -1;
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
struct EventStructCommandWrapper {
|
||||
EventStructCommandWrapper() : id(0) {}
|
||||
|
||||
EventStructCommandWrapper(unsigned long i, EventStruct&& e) : id(i), event(std::move(e)) {}
|
||||
EventStructCommandWrapper(uint32_t i, EventStruct&& e) : id(i), event(std::move(e)) {}
|
||||
|
||||
unsigned long id;
|
||||
uint32_t id;
|
||||
String cmd;
|
||||
String line;
|
||||
EventStruct event;
|
||||
|
||||
@@ -62,7 +62,7 @@ private:
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
String LogString; // for debug logging
|
||||
# endif // ifndef BUILD_NO_DEBUG
|
||||
unsigned long timeout = 0; // send and read timeout
|
||||
uint32_t timeout = 0; // send and read timeout
|
||||
MODBUS_states_t TXRXstate = MODBUS_IDLE; // state for handle() state machine
|
||||
unsigned int RXavailable = 0;
|
||||
unsigned int payLoad = 0; // number of bytes to receive as payload. Payload may come as seperate frame.
|
||||
|
||||
@@ -19,9 +19,9 @@ bool NTP_candidate_struct::set(const NodeStruct& node)
|
||||
if (timeSource == timeSource_t::No_time_source) { return false; }
|
||||
|
||||
// Only allow time from p2p nodes who only got it via p2p themselves as "last resource"
|
||||
const unsigned long p2p_source_penalty =
|
||||
const uint32_t p2p_source_penalty =
|
||||
isExternalTimeSource(timeSource) ? 0 : 10000;
|
||||
const unsigned long time_wander_other =
|
||||
const uint32_t time_wander_other =
|
||||
p2p_source_penalty +
|
||||
computeExpectedWander(timeSource, node.lastUpdated); // node.lastUpdated is already set to "time passed since" when sent
|
||||
|
||||
@@ -33,7 +33,7 @@ bool NTP_candidate_struct::set(const NodeStruct& node)
|
||||
clear();
|
||||
}
|
||||
|
||||
if ((_time_wander < 0) || (time_wander_other < static_cast<unsigned long>(_time_wander))) {
|
||||
if ((_time_wander < 0) || (time_wander_other < static_cast<uint32_t>(_time_wander))) {
|
||||
_time_wander = time_wander_other;
|
||||
_unix_time_sec = node.unix_time_sec;
|
||||
_unix_time_frac = node.unix_time_frac;
|
||||
|
||||
@@ -552,13 +552,13 @@ NodesMap::const_iterator NodesHandler::find(uint8_t unit_nr) const
|
||||
return _nodes.find(unit_nr);
|
||||
}
|
||||
|
||||
bool NodesHandler::refreshNodeList(unsigned long max_age_allowed, unsigned long& max_age)
|
||||
bool NodesHandler::refreshNodeList(uint32_t max_age_allowed, uint32_t& max_age)
|
||||
{
|
||||
max_age = 0;
|
||||
bool nodeRemoved = false;
|
||||
|
||||
for (auto it = _nodes.begin(); it != _nodes.end();) {
|
||||
unsigned long age = it->second.getAge();
|
||||
uint32_t age = it->second.getAge();
|
||||
if (age > max_age_allowed) {
|
||||
bool mustErase = true;
|
||||
#ifdef USES_ESPEASY_NOW
|
||||
|
||||
@@ -52,8 +52,8 @@ public:
|
||||
// Remove nodes in list older than max_age_allowed (msec)
|
||||
// Returns oldest age, max_age (msec) not removed from the list.
|
||||
// Return true if a node has been removed.
|
||||
bool refreshNodeList(unsigned long max_age_allowed,
|
||||
unsigned long& max_age);
|
||||
bool refreshNodeList(uint32_t max_age_allowed,
|
||||
uint32_t& max_age);
|
||||
|
||||
|
||||
const NodeStruct * getPreferredNode() const;
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
|
||||
bool lastTimeValidDistanceExpired() const;
|
||||
|
||||
unsigned long get_lastTimeValidDistance() const {
|
||||
uint32_t get_lastTimeValidDistance() const {
|
||||
return _lastTimeValidDistance;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ private:
|
||||
void setRSSI(NodeStruct *node,
|
||||
int rssi);
|
||||
|
||||
unsigned long _lastTimeValidDistance = 0;
|
||||
uint32_t _lastTimeValidDistance = 0;
|
||||
|
||||
uint8_t _distance = 255; // Cached value
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
// Rules Timer use
|
||||
// ***************
|
||||
systemTimerStruct::systemTimerStruct(int recurringCount, unsigned long msecFromNow, unsigned int timerIndex, int alternateInterval) :
|
||||
systemTimerStruct::systemTimerStruct(int recurringCount, uint32_t msecFromNow, unsigned int timerIndex, int alternateInterval) :
|
||||
_recurringCount(recurringCount), _interval(msecFromNow), _timerIndex(timerIndex), _remainder(0), _loopCount(1), _alternateInterval(
|
||||
alternateInterval)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
// Rules Timer use
|
||||
// ***************
|
||||
systemTimerStruct(int recurringCount,
|
||||
unsigned long msecFromNow,
|
||||
uint32_t msecFromNow,
|
||||
unsigned int timerIndex,
|
||||
int alternateInterval = 0);
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
void markNextRecurring();
|
||||
|
||||
unsigned long getInterval() const {
|
||||
uint32_t getInterval() const {
|
||||
return _alternateState ? _alternateInterval : _interval;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ std::map<int, TimingStats> pluginStats;
|
||||
std::map<int, TimingStats> controllerStats;
|
||||
std::map<int, TimingStats> networkStats;
|
||||
std::map<TimingStatsElements, TimingStats> miscStats;
|
||||
unsigned long timingstats_last_reset(0);
|
||||
uint32_t timingstats_last_reset(0);
|
||||
|
||||
|
||||
void TimingStats::add(int32_t duration_usec) {
|
||||
|
||||
@@ -204,7 +204,7 @@ extern std::map<int, TimingStats> pluginStats;
|
||||
extern std::map<int, TimingStats> controllerStats;
|
||||
extern std::map<int, TimingStats> networkStats;
|
||||
extern std::map<TimingStatsElements, TimingStats> miscStats;
|
||||
extern unsigned long timingstats_last_reset;
|
||||
extern uint32_t timingstats_last_reset;
|
||||
|
||||
# define START_TIMER const uint32_t statisticsTimerStart(micros());
|
||||
# define STOP_TIMER_TASK(T, F) stopTimerTask(T, F, statisticsTimerStart);
|
||||
|
||||
@@ -45,7 +45,7 @@ float UserVarStruct::operator[](unsigned int index) const
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long UserVarStruct::getSensorTypeLong(taskIndex_t taskIndex, bool raw) const
|
||||
uint32_t UserVarStruct::getSensorTypeLong(taskIndex_t taskIndex, bool raw) const
|
||||
{
|
||||
const TaskValues_Data_t *data = getRawOrComputed(taskIndex, 0, Sensor_VType::SENSOR_TYPE_ULONG, raw);
|
||||
|
||||
@@ -55,7 +55,7 @@ unsigned long UserVarStruct::getSensorTypeLong(taskIndex_t taskIndex, bool raw)
|
||||
return 0u;
|
||||
}
|
||||
|
||||
void UserVarStruct::setSensorTypeLong(taskIndex_t taskIndex, unsigned long value)
|
||||
void UserVarStruct::setSensorTypeLong(taskIndex_t taskIndex, uint32_t value)
|
||||
{
|
||||
if (validTaskIndex(taskIndex)) {
|
||||
if (Cache.hasFormula(taskIndex, 0)) {
|
||||
|
||||
@@ -40,10 +40,10 @@ struct UserVarStruct {
|
||||
float operator[](unsigned int index) const;
|
||||
|
||||
// Legacy "long" type, which was spread over several floats.
|
||||
unsigned long getSensorTypeLong(taskIndex_t taskIndex,
|
||||
uint32_t getSensorTypeLong(taskIndex_t taskIndex,
|
||||
bool raw = false) const;
|
||||
void setSensorTypeLong(taskIndex_t taskIndex,
|
||||
unsigned long value);
|
||||
uint32_t value);
|
||||
|
||||
#if FEATURE_EXTENDED_TASK_VALUE_TYPES
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
\*********************************************************************************************/
|
||||
|
||||
struct timer_id_couple {
|
||||
timer_id_couple(unsigned long id, unsigned long newtimer) : _id(id), _timer(newtimer) {}
|
||||
timer_id_couple(uint32_t id, uint32_t newtimer) : _id(id), _timer(newtimer) {}
|
||||
|
||||
timer_id_couple(unsigned long id) : _id(id) {
|
||||
timer_id_couple(uint32_t id) : _id(id) {
|
||||
_timer = millis();
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ struct timer_id_couple {
|
||||
bool operator()(const timer_id_couple& item) const;
|
||||
|
||||
|
||||
unsigned long _id{};
|
||||
unsigned long _timer{};
|
||||
uint32_t _id{};
|
||||
uint32_t _timer{};
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -43,18 +43,18 @@ void TaskValues_Data_t::copyValue(const TaskValues_Data_t& other, uint8_t varNr,
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long TaskValues_Data_t::getSensorTypeLong() const
|
||||
uint32_t TaskValues_Data_t::getSensorTypeLong() const
|
||||
{
|
||||
const uint16_t low = getFloat(0);
|
||||
const uint16_t high = getFloat(1);
|
||||
unsigned long value = high;
|
||||
uint32_t value = high;
|
||||
|
||||
value <<= 16;
|
||||
value |= low;
|
||||
return value;
|
||||
}
|
||||
|
||||
void TaskValues_Data_t::setSensorTypeLong(unsigned long value)
|
||||
void TaskValues_Data_t::setSensorTypeLong(uint32_t value)
|
||||
{
|
||||
setFloat(0, value & 0xFFFF);
|
||||
setFloat(1, (value >> 16) & 0xFFFF);
|
||||
|
||||
@@ -16,8 +16,8 @@ struct alignas(uint32_t) TaskValues_Data_t {
|
||||
|
||||
void copyValue(const TaskValues_Data_t& other, uint8_t varNr, Sensor_VType sensorType);
|
||||
|
||||
unsigned long getSensorTypeLong() const;
|
||||
void setSensorTypeLong(unsigned long value);
|
||||
uint32_t getSensorTypeLong() const;
|
||||
void setSensorTypeLong(uint32_t value);
|
||||
|
||||
#if FEATURE_EXTENDED_TASK_VALUE_TYPES
|
||||
int32_t getInt32(uint8_t varNr) const;
|
||||
|
||||
@@ -1267,11 +1267,11 @@ bool GetTLS_Certificate(String& cert, bool caRoot)
|
||||
/*********************************************************************************************\
|
||||
* send specific sensor task data, effectively calling PluginCall(PLUGIN_READ...)
|
||||
\*********************************************************************************************/
|
||||
void SensorSendTask(struct EventStruct *event, unsigned long timestampUnixTime) {
|
||||
void SensorSendTask(struct EventStruct *event, uint32_t timestampUnixTime) {
|
||||
SensorSendTask(event, timestampUnixTime, millis());
|
||||
}
|
||||
|
||||
void SensorSendTask(struct EventStruct *event, unsigned long timestampUnixTime, unsigned long lasttimer)
|
||||
void SensorSendTask(struct EventStruct *event, uint32_t timestampUnixTime, uint32_t lasttimer)
|
||||
{
|
||||
if (!validTaskIndex(event->TaskIndex)) {
|
||||
return;
|
||||
|
||||
@@ -92,8 +92,8 @@ bool GetTLS_Certificate(String& cert, bool caRoot);
|
||||
/*********************************************************************************************\
|
||||
* send specific sensor task data, effectively calling PluginCall(PLUGIN_READ...)
|
||||
\*********************************************************************************************/
|
||||
void SensorSendTask(struct EventStruct *event, unsigned long timestampUnixTime = 0);
|
||||
void SensorSendTask(struct EventStruct *event, unsigned long timestampUnixTime, unsigned long lasttimer);
|
||||
void SensorSendTask(struct EventStruct *event, uint32_t timestampUnixTime = 0);
|
||||
void SensorSendTask(struct EventStruct *event, uint32_t timestampUnixTime, uint32_t lasttimer);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -101,7 +101,7 @@ void rulesProcessing(const String& event) {
|
||||
checkRAM(F("rulesProcessing"));
|
||||
#endif // ifndef BUILD_NO_RAM_TRACKER
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
const unsigned long timer = millis();
|
||||
const uint32_t timer = millis();
|
||||
#endif // ifndef BUILD_NO_DEBUG
|
||||
// #ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
|
||||
@@ -46,12 +46,12 @@ void updateLoopStats() {
|
||||
return; // No loop should take > 10 sec.
|
||||
}
|
||||
|
||||
if (shortestLoop > static_cast<unsigned long>(usecSince)) {
|
||||
if (shortestLoop > static_cast<uint32_t>(usecSince)) {
|
||||
shortestLoop = usecSince;
|
||||
loopCounterMax = 30 * 1000000 / usecSince;
|
||||
}
|
||||
|
||||
if (longestLoop < static_cast<unsigned long>(usecSince)) {
|
||||
if (longestLoop < static_cast<uint32_t>(usecSince)) {
|
||||
longestLoop = usecSince;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ void serialPrintln() {
|
||||
}
|
||||
|
||||
|
||||
void serialPrint(unsigned long value) {
|
||||
void serialPrint(uint32_t value) {
|
||||
serialPrint(String(value));
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ void serialPrintln() {
|
||||
serialPrint(String(value));
|
||||
}
|
||||
|
||||
void serialPrintln(unsigned long value) {
|
||||
void serialPrintln(uint32_t value) {
|
||||
serialPrintln(String(value));
|
||||
}
|
||||
*/
|
||||
@@ -26,11 +26,11 @@ void serialPrintln();
|
||||
/*
|
||||
void serialPrint(char c);
|
||||
|
||||
void serialPrint(unsigned long value);
|
||||
void serialPrint(uint32_t value);
|
||||
|
||||
void serialPrint(long value);
|
||||
|
||||
void serialPrintln(unsigned long value);
|
||||
void serialPrintln(uint32_t value);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ bool C016_getTaskSample(C016_binary_element& element) {
|
||||
}
|
||||
|
||||
struct EventStruct C016_getTaskSample(
|
||||
unsigned long& timestamp,
|
||||
uint32_t& timestamp,
|
||||
uint8_t & valueCount,
|
||||
float & val1,
|
||||
float & val2,
|
||||
|
||||
@@ -29,7 +29,7 @@ bool C016_deleteAllCacheBlocks();
|
||||
bool C016_getTaskSample(C016_binary_element& element);
|
||||
|
||||
struct EventStruct C016_getTaskSample(
|
||||
unsigned long& timestamp,
|
||||
uint32_t& timestamp,
|
||||
uint8_t & valueCount,
|
||||
float & val1,
|
||||
float & val2,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
/********************************************************************************************\
|
||||
Generate a tone of specified frequency on pin
|
||||
\*********************************************************************************************/
|
||||
bool tone_espEasy(int8_t _pin, unsigned int frequency, unsigned long duration) {
|
||||
bool tone_espEasy(int8_t _pin, unsigned int frequency, uint32_t duration) {
|
||||
if (!validGpio(_pin)) { return false; }
|
||||
|
||||
// Duty cycle can be used as some kind of volume.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
\*********************************************************************************************/
|
||||
bool tone_espEasy(int8_t _pin,
|
||||
unsigned int frequency,
|
||||
unsigned long duration);
|
||||
uint32_t duration);
|
||||
|
||||
/********************************************************************************************\
|
||||
Play RTTTL string on specified pin
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
# include "../Helpers/StringConverter.h"
|
||||
|
||||
|
||||
CUL_time_filter_struct::CUL_time_filter_struct(uint32_t checksum, unsigned long UnixTimeExpiration)
|
||||
CUL_time_filter_struct::CUL_time_filter_struct(uint32_t checksum, uint32_t UnixTimeExpiration)
|
||||
: _checksum(checksum), _UnixTimeExpiration(UnixTimeExpiration) {}
|
||||
|
||||
String CUL_interval_filter_getExpiration_log_str(const P094_filter& filter)
|
||||
{
|
||||
const unsigned long expiration = filter.computeUnixTimeExpiration();
|
||||
const uint32_t expiration = filter.computeUnixTimeExpiration();
|
||||
|
||||
if ((expiration != 0) && (expiration != 0xFFFFFFFF)) {
|
||||
struct tm exp_tm;
|
||||
@@ -67,7 +67,7 @@ bool CUL_interval_filter::filter(const mBusPacket_t& packet, const P094_filter&
|
||||
_mBusFilterMap.erase(it);
|
||||
}
|
||||
|
||||
const unsigned long expiration = filter.computeUnixTimeExpiration();
|
||||
const uint32_t expiration = filter.computeUnixTimeExpiration();
|
||||
|
||||
CUL_time_filter_struct item(packet._checksum, expiration);
|
||||
|
||||
@@ -87,7 +87,7 @@ void CUL_interval_filter::purgeExpired()
|
||||
{
|
||||
auto it = _mBusFilterMap.begin();
|
||||
|
||||
const unsigned long currentTime = node_time.getUnixTime();
|
||||
const uint32_t currentTime = node_time.getUnixTime();
|
||||
|
||||
for (; it != _mBusFilterMap.end();) {
|
||||
if (currentTime > it->second._UnixTimeExpiration) {
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
struct CUL_time_filter_struct {
|
||||
CUL_time_filter_struct() = default;
|
||||
CUL_time_filter_struct(uint32_t checksum,
|
||||
unsigned long UnixTimeExpiration);
|
||||
uint32_t UnixTimeExpiration);
|
||||
|
||||
uint32_t _checksum{};
|
||||
unsigned long _UnixTimeExpiration{};
|
||||
uint32_t _UnixTimeExpiration{};
|
||||
};
|
||||
|
||||
typedef uint32_t mBusSerial;
|
||||
|
||||
@@ -211,9 +211,9 @@ float altitudeFromPressure(float atmospheric, float seaLevel)
|
||||
/********************************************************************************************\
|
||||
In memory convert float to long
|
||||
\*********************************************************************************************/
|
||||
unsigned long float2ul(float f)
|
||||
uint32_t float2ul(float f)
|
||||
{
|
||||
unsigned long ul;
|
||||
uint32_t ul;
|
||||
|
||||
memcpy(&ul, &f, 4);
|
||||
return ul;
|
||||
@@ -222,7 +222,7 @@ unsigned long float2ul(float f)
|
||||
/********************************************************************************************\
|
||||
In memory convert long to float
|
||||
\*********************************************************************************************/
|
||||
float ul2float(unsigned long ul)
|
||||
float ul2float(uint32_t ul)
|
||||
{
|
||||
float f;
|
||||
|
||||
|
||||
@@ -57,12 +57,12 @@ float altitudeFromPressure(float atmospheric, float seaLevel);
|
||||
/********************************************************************************************\
|
||||
In memory convert float to long
|
||||
\*********************************************************************************************/
|
||||
unsigned long float2ul(float f);
|
||||
uint32_t float2ul(float f);
|
||||
|
||||
/********************************************************************************************\
|
||||
In memory convert long to float
|
||||
\*******************************************************************************************/
|
||||
float ul2float(unsigned long ul);
|
||||
float ul2float(uint32_t ul);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2009,7 +2009,7 @@ String doSaveToFile(const char *fname, int index, const uint8_t *memAddress, int
|
||||
}
|
||||
#endif // ifndef BUILD_NO_DEBUG
|
||||
delay(1);
|
||||
unsigned long timer = millis() + 50;
|
||||
uint32_t timer = millis() + 50;
|
||||
fs::File f = tryOpenFile(fname, mode);
|
||||
|
||||
if (f) {
|
||||
@@ -2790,7 +2790,7 @@ void deleteBakFiles()
|
||||
bool validateUploadConfigDat(const uint8_t *buf) {
|
||||
bool result = false;
|
||||
struct TempStruct {
|
||||
unsigned long PID;
|
||||
uint32_t PID;
|
||||
int Version;
|
||||
} Temp;
|
||||
|
||||
|
||||
@@ -131,6 +131,8 @@ void run_compiletime_checks() {
|
||||
#ifdef USES_C016
|
||||
check_size<C016_binary_element, 24u>();
|
||||
#endif
|
||||
check_size<ValueStruct, 16u>();
|
||||
check_size<unsigned long, 4u>();
|
||||
|
||||
|
||||
#if FEATURE_NON_STANDARD_24_TASKS && defined(ESP8266)
|
||||
|
||||
@@ -55,7 +55,7 @@ ESPEasy_time::ESPEasy_time() {
|
||||
}
|
||||
|
||||
struct tm ESPEasy_time::addSeconds(const struct tm& ts, int seconds, bool toLocalTime, bool fromLocalTime) const {
|
||||
unsigned long time = makeTime(ts);
|
||||
uint32_t time = makeTime(ts);
|
||||
|
||||
if (fromLocalTime) {
|
||||
time = time_zone.fromLocal(time);
|
||||
@@ -227,17 +227,17 @@ void ESPEasy_time::initTime()
|
||||
now_();
|
||||
}
|
||||
|
||||
unsigned long ESPEasy_time::getLocalUnixTime() const
|
||||
uint32_t ESPEasy_time::getLocalUnixTime() const
|
||||
{
|
||||
return time_zone.toLocal(getUnixTime());
|
||||
}
|
||||
|
||||
unsigned long ESPEasy_time::getLocalUnixTime(uint32_t& unix_time_frac) const
|
||||
uint32_t ESPEasy_time::getLocalUnixTime(uint32_t& unix_time_frac) const
|
||||
{
|
||||
return time_zone.toLocal(getUnixTime(unix_time_frac));
|
||||
}
|
||||
|
||||
unsigned long ESPEasy_time::now_() {
|
||||
uint32_t ESPEasy_time::now_() {
|
||||
bool timeSynced = false;
|
||||
|
||||
if (nextSyncTime <= getUptime_in_sec()) {
|
||||
@@ -378,7 +378,7 @@ unsigned long ESPEasy_time::now_() {
|
||||
ExtRTC_set(static_cast<uint32_t>(unixTime_d + 0.5));
|
||||
#endif // if FEATURE_EXT_RTC
|
||||
{
|
||||
const unsigned long abs_time_offset_ms = std::abs(externalUnixTime_offset_usec) / 1000ll;
|
||||
const uint32_t abs_time_offset_ms = std::abs(externalUnixTime_offset_usec) / 1000ll;
|
||||
|
||||
if (_timeSource == timeSource_t::NTP_time_source) {
|
||||
// May need to lessen the load on the NTP servers, randomize the sync interval
|
||||
@@ -466,7 +466,7 @@ unsigned long ESPEasy_time::now_() {
|
||||
}
|
||||
statusNTPInitialized = true; // @giig1967g: setting system variable %isntp%
|
||||
}
|
||||
return (unsigned long)localSystime;
|
||||
return (uint32_t)localSystime;
|
||||
}
|
||||
|
||||
bool ESPEasy_time::reportNewMinute()
|
||||
@@ -773,7 +773,7 @@ String ESPEasy_time::getDateTimeString_ampm(char dateDelimiter, char timeDelimit
|
||||
/********************************************************************************************\
|
||||
Get current time/date
|
||||
\*********************************************************************************************/
|
||||
int ESPEasy_time::year(unsigned long t)
|
||||
int ESPEasy_time::year(uint32_t t)
|
||||
{
|
||||
struct tm tmp;
|
||||
|
||||
@@ -781,7 +781,7 @@ int ESPEasy_time::year(unsigned long t)
|
||||
return 1900 + tmp.tm_year;
|
||||
}
|
||||
|
||||
int ESPEasy_time::weekday(unsigned long t)
|
||||
int ESPEasy_time::weekday(uint32_t t)
|
||||
{
|
||||
struct tm tmp;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
// This way the unit can do things based on local time even when NTP servers may not respond.
|
||||
// Do not use this when booting from deep sleep.
|
||||
// Only call this once during boot.
|
||||
void restoreLastKnownUnixTime(unsigned long lastSysTime,
|
||||
void restoreLastKnownUnixTime(uint32_t lastSysTime,
|
||||
uint8_t deepSleepState);
|
||||
|
||||
// Set external time source
|
||||
@@ -78,11 +78,11 @@ public:
|
||||
|
||||
void initTime();
|
||||
|
||||
unsigned long getLocalUnixTime() const;
|
||||
unsigned long getLocalUnixTime(uint32_t& unix_time_frac) const;
|
||||
uint32_t getLocalUnixTime() const;
|
||||
uint32_t getLocalUnixTime(uint32_t& unix_time_frac) const;
|
||||
|
||||
// Update and get the current systime
|
||||
unsigned long now_();
|
||||
uint32_t now_();
|
||||
|
||||
// Update time and return whether the minute has changed since last check.
|
||||
bool reportNewMinute();
|
||||
@@ -129,10 +129,10 @@ public:
|
||||
\*********************************************************************************************/
|
||||
|
||||
// Get the year given a Unix time stamp
|
||||
static int year(unsigned long t);
|
||||
static int year(uint32_t t);
|
||||
|
||||
// Get the weekday, given a Unix time stamp
|
||||
static int weekday(unsigned long t);
|
||||
static int weekday(uint32_t t);
|
||||
|
||||
// Convert a weekday number (Sun = 1 ... Sat = 7) to a 3 letter string
|
||||
static String weekday_str(int wday);
|
||||
|
||||
@@ -129,7 +129,7 @@ uint32_t makeTime(const struct tm& tm) {
|
||||
return seconds;
|
||||
}
|
||||
|
||||
void breakTime(unsigned long timeInput, struct tm& tm) {
|
||||
void breakTime(uint32_t timeInput, struct tm& tm) {
|
||||
uint32_t time = (uint32_t)timeInput;
|
||||
|
||||
tm.tm_sec = time % 60;
|
||||
@@ -141,7 +141,7 @@ void breakTime(unsigned long timeInput, struct tm& tm) {
|
||||
tm.tm_wday = ((time + 4) % 7) + 1; // Sunday is day 1
|
||||
|
||||
int year = 1970;
|
||||
unsigned long days = 0;
|
||||
uint32_t days = 0;
|
||||
#ifndef LIMIT_BUILD_SIZE
|
||||
if (time > 20089) {
|
||||
// Skip checking 55 years for being leap year.
|
||||
@@ -270,9 +270,9 @@ String formatDateTimeString(const struct tm& ts, char dateDelimiter, char timeDe
|
||||
/********************************************************************************************\
|
||||
Time computations for rules.
|
||||
\*********************************************************************************************/
|
||||
String timeLong2String(unsigned long lngTime)
|
||||
String timeLong2String(uint32_t lngTime)
|
||||
{
|
||||
unsigned long x = 0;
|
||||
uint32_t x = 0;
|
||||
String time;
|
||||
|
||||
x = (lngTime >> 16) & 0xf;
|
||||
@@ -355,7 +355,7 @@ String timeLong2String(unsigned long lngTime)
|
||||
return time;
|
||||
}
|
||||
|
||||
unsigned long string2TimeLong(const String& str)
|
||||
uint32_t string2TimeLong(const String& str)
|
||||
{
|
||||
// format 0NRSHM000000WWWWAAAABBBBCCCCDDDD
|
||||
// WWWW=weekday, AAAA=hours tens digit, BBBB=hours, CCCC=minutes tens digit DDDD=minutes
|
||||
@@ -364,14 +364,14 @@ unsigned long string2TimeLong(const String& str)
|
||||
|
||||
char command[20];
|
||||
int w, x, y;
|
||||
unsigned long a;
|
||||
uint32_t a;
|
||||
{
|
||||
// Within a scope so the tmpString is only used for copy.
|
||||
String tmpString(str);
|
||||
tmpString.toLowerCase();
|
||||
tmpString.toCharArray(command, 20);
|
||||
}
|
||||
unsigned long lngTime = 0;
|
||||
uint32_t lngTime = 0;
|
||||
String TmpStr1;
|
||||
|
||||
if (GetArgv(command, TmpStr1, 1))
|
||||
@@ -384,7 +384,7 @@ unsigned long string2TimeLong(const String& str)
|
||||
if (y == 0) {
|
||||
y = 0xf; // wildcard is 0xf
|
||||
}
|
||||
lngTime |= (unsigned long)y << 16;
|
||||
lngTime |= (uint32_t)y << 16;
|
||||
}
|
||||
|
||||
if (GetArgv(command, TmpStr1, 2))
|
||||
@@ -458,9 +458,9 @@ unsigned long string2TimeLong(const String& str)
|
||||
/********************************************************************************************\
|
||||
Match clock event
|
||||
\*********************************************************************************************/
|
||||
bool matchClockEvent(unsigned long clockEvent, unsigned long clockSet)
|
||||
bool matchClockEvent(uint32_t clockEvent, uint32_t clockSet)
|
||||
{
|
||||
unsigned long Mask;
|
||||
uint32_t Mask;
|
||||
|
||||
for (uint8_t y = 0; y < 8; y++)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ inline uint64_t getMicros64() {
|
||||
// Returned timediff for millis() is between -24.9 days and +24.9 days.
|
||||
// for micros() is between -35.79 and +35.79 minutes
|
||||
// Returned value is positive when "next" is after "prev"
|
||||
inline int32_t timeDiff(const unsigned long prev, const unsigned long next) {
|
||||
inline int32_t timeDiff(const uint32_t prev, const uint32_t next) {
|
||||
return ((int32_t) (next - prev));
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ inline int32_t usecPassedSince_fast(uint32_t& timestamp) { //-V669
|
||||
|
||||
|
||||
// Check if a certain timeout has been reached.
|
||||
inline bool timeOutReached(unsigned long timer) {
|
||||
inline bool timeOutReached(uint32_t timer) {
|
||||
return timePassedSince(timer) >= 0;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ uint8_t getMonthDays(const struct tm& tm);
|
||||
|
||||
uint32_t makeTime(const struct tm& tm);
|
||||
|
||||
void breakTime(unsigned long timeInput, struct tm& tm);
|
||||
void breakTime(uint32_t timeInput, struct tm& tm);
|
||||
|
||||
/********************************************************************************************\
|
||||
Unix Time formatting
|
||||
@@ -127,16 +127,16 @@ String formatDateTimeString(const struct tm& ts, char dateDelimiter = '-', char
|
||||
// WWWW=weekday, AAAA=hours tens digit, BBBB=hours, CCCC=minutes tens digit DDDD=minutes
|
||||
|
||||
// Convert a 32 bit integer into a string like "Sun,12:30"
|
||||
String timeLong2String(unsigned long lngTime);
|
||||
String timeLong2String(uint32_t lngTime);
|
||||
|
||||
// Convert a string like "Sun,12:30" into a 32 bit integer
|
||||
unsigned long string2TimeLong(const String& str);
|
||||
uint32_t string2TimeLong(const String& str);
|
||||
|
||||
|
||||
/********************************************************************************************\
|
||||
Match clock event
|
||||
\*********************************************************************************************/
|
||||
bool matchClockEvent(unsigned long clockEvent, unsigned long clockSet);
|
||||
bool matchClockEvent(uint32_t clockEvent, uint32_t clockSet);
|
||||
|
||||
|
||||
#endif // HELPERS_ESPEASY_TIME_CALC_H
|
||||
@@ -999,7 +999,7 @@ void setTaskDevice_to_TaskIndex(pluginID_t taskdevicenumber, taskIndex_t taskInd
|
||||
// ********************************************************************************
|
||||
// Initialize task with some default values applicable for almost all tasks
|
||||
// ********************************************************************************
|
||||
void setBasicTaskValues(taskIndex_t taskIndex, unsigned long taskdevicetimer,
|
||||
void setBasicTaskValues(taskIndex_t taskIndex, uint32_t taskdevicetimer,
|
||||
bool enabled, const String& name, const int pins[3]) {
|
||||
if (!validTaskIndex(taskIndex)) { return; }
|
||||
const deviceIndex_t DeviceIndex = getDeviceIndex_from_TaskIndex(taskIndex);
|
||||
|
||||
@@ -126,7 +126,7 @@ void setTaskDevice_to_TaskIndex(pluginID_t taskdevicenumber,
|
||||
// Initialize task with some default values applicable for almost all tasks
|
||||
// ********************************************************************************
|
||||
void setBasicTaskValues(taskIndex_t taskIndex,
|
||||
unsigned long taskdevicetimer,
|
||||
uint32_t taskdevicetimer,
|
||||
bool enabled,
|
||||
const String& name,
|
||||
const int pins[3]);
|
||||
|
||||
@@ -28,7 +28,7 @@ enum class I2C_clear_bus_state {
|
||||
// Changed into a state machine for use in a non blocking way to be used in ESPEasy.
|
||||
I2C_bus_state I2C_check_bus(int8_t scl, int8_t sda) {
|
||||
static I2C_clear_bus_state clearing_state = I2C_clear_bus_state::Start;
|
||||
static unsigned long last_state_change = 0;
|
||||
static uint32_t last_state_change = 0;
|
||||
static int clockCount = 20; // > 2x9 clock
|
||||
|
||||
|
||||
|
||||
@@ -152,9 +152,9 @@ bool remoteConfig(struct EventStruct *event, const String& string)
|
||||
/********************************************************************************************\
|
||||
delay in milliseconds with background processing
|
||||
\*********************************************************************************************/
|
||||
void delayBackground(unsigned long dsdelay)
|
||||
void delayBackground(uint32_t dsdelay)
|
||||
{
|
||||
unsigned long timer = millis() + dsdelay;
|
||||
uint32_t timer = millis() + dsdelay;
|
||||
|
||||
while (!timeOutReached(timer)) {
|
||||
backgroundtasks();
|
||||
|
||||
@@ -60,7 +60,7 @@ bool remoteConfig(struct EventStruct *event,
|
||||
/********************************************************************************************\
|
||||
delay in milliseconds with background processing
|
||||
\*********************************************************************************************/
|
||||
void delayBackground(unsigned long dsdelay);
|
||||
void delayBackground(uint32_t dsdelay);
|
||||
|
||||
/********************************************************************************************\
|
||||
Toggle network enabled state
|
||||
|
||||
@@ -450,7 +450,7 @@ uint8_t ModbusRTU_struct::processCommand() {
|
||||
|
||||
// Read answer from sensor
|
||||
_recv_buf_used = 0;
|
||||
unsigned long timeout = millis() + _modbus_timeout;
|
||||
uint32_t timeout = millis() + _modbus_timeout;
|
||||
bool validPacket = false;
|
||||
bool invalidDueToTimeout = false;
|
||||
|
||||
|
||||
@@ -469,8 +469,8 @@ String getTypeStringForUnit(uint8_t unit) {
|
||||
\*********************************************************************************************/
|
||||
void refreshNodeList()
|
||||
{
|
||||
unsigned long max_age;
|
||||
const unsigned long max_age_allowed = 10 * 60 * 1000; // 10 minutes
|
||||
uint32_t max_age;
|
||||
const uint32_t max_age_allowed = 10 * 60 * 1000; // 10 minutes
|
||||
|
||||
Nodes.refreshNodeList(max_age_allowed, max_age);
|
||||
|
||||
@@ -623,8 +623,8 @@ uint16_t _respondToPort;
|
||||
|
||||
bool _pending;
|
||||
unsigned short _delay;
|
||||
unsigned long _process_time;
|
||||
unsigned long _notify_time;
|
||||
uint32_t _process_time;
|
||||
uint32_t _notify_time;
|
||||
|
||||
# define SSDP_INTERVAL 1200
|
||||
# define SSDP_PORT 1900
|
||||
@@ -1984,7 +1984,7 @@ bool downloadFile(const String& url, String file_save, const String& user, const
|
||||
const size_t downloadBuffSize = 256;
|
||||
uint8_t buff[downloadBuffSize];
|
||||
size_t bytesWritten = 0;
|
||||
unsigned long timeout = millis() + DOWNLOAD_FILE_TIMEOUT;
|
||||
uint32_t timeout = millis() + DOWNLOAD_FILE_TIMEOUT;
|
||||
|
||||
// get tcp stream
|
||||
WiFiClient *stream = &client;
|
||||
@@ -2083,7 +2083,7 @@ bool downloadFirmware(const String& url, String& file_save, String& user, String
|
||||
const size_t downloadBuffSize = 256;
|
||||
uint8_t buff[downloadBuffSize];
|
||||
size_t bytesWritten = 0;
|
||||
unsigned long timeout = millis() + DOWNLOAD_FILE_TIMEOUT;
|
||||
uint32_t timeout = millis() + DOWNLOAD_FILE_TIMEOUT;
|
||||
|
||||
// get tcp stream
|
||||
WiFiClient *stream = &client;
|
||||
|
||||
@@ -136,8 +136,8 @@ extern uint16_t _respondToPort;
|
||||
|
||||
extern bool _pending;
|
||||
extern unsigned short _delay;
|
||||
extern unsigned long _process_time;
|
||||
extern unsigned long _notify_time;
|
||||
extern uint32_t _process_time;
|
||||
extern uint32_t _notify_time;
|
||||
|
||||
# define SSDP_INTERVAL 1200
|
||||
# define SSDP_PORT 1900
|
||||
|
||||
@@ -203,10 +203,10 @@ void runOncePerSecond()
|
||||
}
|
||||
}
|
||||
|
||||
// unsigned long start = micros();
|
||||
// uint32_t start = micros();
|
||||
String dummy;
|
||||
PluginCall(PLUGIN_ONCE_A_SECOND, 0, dummy);
|
||||
// unsigned long elapsed = micros() - start;
|
||||
// uint32_t elapsed = micros() - start;
|
||||
|
||||
#if FEATURE_NETWORK_STATS
|
||||
for (ESPEasy::net::networkIndex_t x = 0; x < NETWORK_MAX; x++) {
|
||||
@@ -531,7 +531,7 @@ void flushAndDisconnectAllClients() {
|
||||
#if FEATURE_MQTT
|
||||
bool mqttControllerEnabled = validControllerIndex(firstEnabledMQTT_ControllerIndex());
|
||||
#endif //if FEATURE_MQTT
|
||||
unsigned long timer = millis() + 1000;
|
||||
uint32_t timer = millis() + 1000;
|
||||
while (!timeOutReached(timer)) {
|
||||
// call to all controllers (delay queue) to flush all data.
|
||||
CPluginCall(CPlugin::Function::CPLUGIN_FLUSH, 0);
|
||||
|
||||
@@ -37,8 +37,8 @@ bool ruleMatch(String event, String rule) {
|
||||
if (event.substring(0, pos1).equalsIgnoreCase(rule.substring(0, pos2))) // if this is a clock rule
|
||||
{
|
||||
// addLog(LOG_LEVEL_INFO, concat(F("Clock#Time="), rule.substring(pos2 + 1)));
|
||||
unsigned long clockEvent = string2TimeLong(event.substring(pos1 + 1));
|
||||
unsigned long clockSet = string2TimeLong(rule.substring(pos2 + 1));
|
||||
uint32_t clockEvent = string2TimeLong(event.substring(pos1 + 1));
|
||||
uint32_t clockSet = string2TimeLong(rule.substring(pos2 + 1));
|
||||
|
||||
return matchClockEvent(clockEvent, clockSet);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ void ESPEasy_Scheduler::markIntendedReboot(IntendedRebootReason_e reason) {
|
||||
/*********************************************************************************************\
|
||||
* Generic Timer functions.
|
||||
\*********************************************************************************************/
|
||||
void ESPEasy_Scheduler::setNewTimerAt(SchedulerTimerID id, unsigned long timer) {
|
||||
void ESPEasy_Scheduler::setNewTimerAt(SchedulerTimerID id, uint32_t timer) {
|
||||
START_TIMER;
|
||||
msecTimerHandler.registerAt(id.mixed_id, timer);
|
||||
STOP_TIMER(SET_NEW_TIMER);
|
||||
@@ -34,8 +34,8 @@ void ESPEasy_Scheduler::setNewTimerAt(SchedulerTimerID id, unsigned long timer)
|
||||
\*********************************************************************************************/
|
||||
void ESPEasy_Scheduler::handle_schedule() {
|
||||
START_TIMER
|
||||
unsigned long timer = 0;
|
||||
unsigned long mixed_id = 0;
|
||||
uint32_t timer = 0;
|
||||
uint32_t mixed_id = 0;
|
||||
|
||||
if (timePassedSince(last_system_event_run) < 500) {
|
||||
// Make sure system event queue will be looked at every now and then.
|
||||
|
||||
+31
-31
@@ -93,7 +93,7 @@ public:
|
||||
* Generic Timer functions.
|
||||
\*********************************************************************************************/
|
||||
void setNewTimerAt(SchedulerTimerID timerID,
|
||||
unsigned long timer);
|
||||
uint32_t timer);
|
||||
|
||||
static String decodeSchedulerId(SchedulerTimerID timerID);
|
||||
|
||||
@@ -107,34 +107,34 @@ public:
|
||||
* These timers set a new scheduled timer, based on the old value.
|
||||
* This will make their interval as constant as possible.
|
||||
\*********************************************************************************************/
|
||||
void setNextTimeInterval(unsigned long & timer,
|
||||
const unsigned long step);
|
||||
void setNextTimeInterval(uint32_t & timer,
|
||||
const uint32_t step);
|
||||
|
||||
void setNextStrictTimeInterval(unsigned long & timer,
|
||||
const unsigned long step);
|
||||
void setNextStrictTimeInterval(uint32_t & timer,
|
||||
const uint32_t step);
|
||||
|
||||
void setIntervalTimer(SchedulerIntervalTimer_e id);
|
||||
void setIntervalTimerAt(SchedulerIntervalTimer_e id,
|
||||
unsigned long newtimer);
|
||||
uint32_t newtimer);
|
||||
void setIntervalTimerOverride(SchedulerIntervalTimer_e id,
|
||||
unsigned long msecFromNow);
|
||||
uint32_t msecFromNow);
|
||||
|
||||
void scheduleNextDelayQueue(SchedulerIntervalTimer_e id,
|
||||
unsigned long nextTime);
|
||||
uint32_t nextTime);
|
||||
|
||||
void setIntervalTimer(SchedulerIntervalTimer_e id,
|
||||
unsigned long lasttimer);
|
||||
uint32_t lasttimer);
|
||||
|
||||
void sendGratuitousARP_now();
|
||||
|
||||
void process_interval_timer(SchedulerTimerID timerID,
|
||||
unsigned long lasttimer);
|
||||
uint32_t lasttimer);
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Plugin Task Timer (PLUGIN_TASKTIMER_IN)
|
||||
* Can be scheduled per combo taskIndex & Par1 (20 least significant bits)
|
||||
\*********************************************************************************************/
|
||||
void setPluginTaskTimer(unsigned long msecFromNow,
|
||||
void setPluginTaskTimer(uint32_t msecFromNow,
|
||||
taskIndex_t taskIndex,
|
||||
int Par1,
|
||||
int Par2 = 0,
|
||||
@@ -142,7 +142,7 @@ public:
|
||||
int Par4 = 0,
|
||||
int Par5 = 0);
|
||||
|
||||
void setPluginTaskTimer(unsigned long msecFromNow,
|
||||
void setPluginTaskTimer(uint32_t msecFromNow,
|
||||
taskIndex_t taskIndex,
|
||||
const PluginFunctions_e& function,
|
||||
int Par1,
|
||||
@@ -157,12 +157,12 @@ void setPluginTaskTimer(unsigned long msecFromNow,
|
||||
* Network Adapter Timer (NWPLUGIN_TASKTIMER_IN)
|
||||
* Can be scheduled per combo networkIndex & Par1 (20 least significant bits)
|
||||
\*********************************************************************************************/
|
||||
void setNetworkInitTimer(unsigned long msecFromNow,
|
||||
void setNetworkInitTimer(uint32_t msecFromNow,
|
||||
ESPEasy::net::networkIndex_t networkIndex);
|
||||
void setNetworkExitTimer(unsigned long msecFromNow,
|
||||
void setNetworkExitTimer(uint32_t msecFromNow,
|
||||
ESPEasy::net::networkIndex_t networkIndex);
|
||||
|
||||
void setNetworkTimer(unsigned long msecFromNow,
|
||||
void setNetworkTimer(uint32_t msecFromNow,
|
||||
ESPEasy::net::networkIndex_t networkIndex,
|
||||
NWPlugin::Function function,
|
||||
int Par1 = 0,
|
||||
@@ -183,17 +183,17 @@ void setPluginTaskTimer(unsigned long msecFromNow,
|
||||
// @param timerIndex The index of the timer used. (1 ... max)
|
||||
// @param recurringCount Number of times needed to run (-1 for always)
|
||||
// @param startImmediately Run immediately
|
||||
bool setRulesTimer(unsigned long msecFromNow,
|
||||
bool setRulesTimer(uint32_t msecFromNow,
|
||||
unsigned int timerIndex,
|
||||
int recurringCount = 0,
|
||||
bool startImmediately = false);
|
||||
|
||||
void process_rules_timer(SchedulerTimerID timerID,
|
||||
unsigned long lasttimer);
|
||||
uint32_t lasttimer);
|
||||
|
||||
bool pause_rules_timer(unsigned long timerIndex);
|
||||
bool pause_rules_timer(uint32_t timerIndex);
|
||||
|
||||
bool resume_rules_timer(unsigned long timerIndex);
|
||||
bool resume_rules_timer(uint32_t timerIndex);
|
||||
|
||||
|
||||
/*********************************************************************************************\
|
||||
@@ -201,7 +201,7 @@ void setPluginTaskTimer(unsigned long msecFromNow,
|
||||
* Does not reflect a specific task, but rather a plugin.
|
||||
* Can be scheduled per combo deviceIndex & Par1 (20 least significant bits)
|
||||
\*********************************************************************************************/
|
||||
void setPluginTimer(unsigned long msecFromNow,
|
||||
void setPluginTimer(uint32_t msecFromNow,
|
||||
pluginID_t pluginID,
|
||||
int Par1,
|
||||
int Par2 = 0,
|
||||
@@ -216,7 +216,7 @@ void setPluginTaskTimer(unsigned long msecFromNow,
|
||||
* GPIO Timer
|
||||
* Special timer to handle timed GPIO actions
|
||||
\*********************************************************************************************/
|
||||
void setGPIOTimer(unsigned long msecFromNow,
|
||||
void setGPIOTimer(uint32_t msecFromNow,
|
||||
pluginID_t pluginID,
|
||||
int pinnr,
|
||||
int state = 0,
|
||||
@@ -226,7 +226,7 @@ void setPluginTaskTimer(unsigned long msecFromNow,
|
||||
|
||||
void clearGPIOTimer(pluginID_t pluginID, int pinnr);
|
||||
|
||||
void process_gpio_timer(SchedulerTimerID timerID, unsigned long lasttimer);
|
||||
void process_gpio_timer(SchedulerTimerID timerID, uint32_t lasttimer);
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Task Device Timer
|
||||
@@ -235,21 +235,21 @@ void setPluginTaskTimer(unsigned long msecFromNow,
|
||||
* When the plugin task is initialized, a call to schedule_task_device_timer_at_init
|
||||
* will bootstrap this sequence.
|
||||
\*********************************************************************************************/
|
||||
void schedule_task_device_timer_at_init(unsigned long task_index);
|
||||
void schedule_task_device_timer_at_init(uint32_t task_index);
|
||||
|
||||
// Typical use case is to run this when all needed connections are made.
|
||||
void schedule_all_task_device_timers();
|
||||
|
||||
// Schedule a call to SensorSendTask, which calls PLUGIN_READ
|
||||
void schedule_task_device_timer(unsigned long task_index,
|
||||
unsigned long runAt);
|
||||
void schedule_task_device_timer(uint32_t task_index,
|
||||
uint32_t runAt);
|
||||
|
||||
// Reschedule task device timer based on the set task interval.
|
||||
void reschedule_task_device_timer(unsigned long task_index,
|
||||
unsigned long lasttimer);
|
||||
void reschedule_task_device_timer(uint32_t task_index,
|
||||
uint32_t lasttimer);
|
||||
|
||||
void process_task_device_timer(SchedulerTimerID timerID,
|
||||
unsigned long lasttimer);
|
||||
uint32_t lasttimer);
|
||||
|
||||
/*********************************************************************************************\
|
||||
* System Event Timer
|
||||
@@ -324,14 +324,14 @@ private:
|
||||
|
||||
// Map mixed timer ID to system timer struct.
|
||||
// N.B. Must use Mixed timer ID, similar to how it is handled in the scheduler.
|
||||
std::map<unsigned long, systemTimerStruct>systemTimers;
|
||||
std::map<uint32_t, systemTimerStruct>systemTimers;
|
||||
|
||||
msecTimerHandlerStruct msecTimerHandler;
|
||||
|
||||
std::list<EventStructCommandWrapper>ScheduledEventQueue;
|
||||
|
||||
unsigned long last_system_event_run = 0;
|
||||
unsigned long timer_gratuitous_arp_interval = 5000;
|
||||
uint32_t last_system_event_run = 0;
|
||||
uint32_t timer_gratuitous_arp_interval = 5000;
|
||||
};
|
||||
|
||||
#endif // HELPERS_SCHEDULER_H
|
||||
@@ -14,7 +14,7 @@
|
||||
* Special timer to handle timed GPIO actions
|
||||
\*********************************************************************************************/
|
||||
void ESPEasy_Scheduler::setGPIOTimer(
|
||||
unsigned long msecFromNow,
|
||||
uint32_t msecFromNow,
|
||||
pluginID_t pluginID,
|
||||
int pinnr,
|
||||
int state,
|
||||
@@ -79,7 +79,7 @@ void ESPEasy_Scheduler::clearGPIOTimer(pluginID_t pluginID, int pinnr)
|
||||
}
|
||||
}
|
||||
|
||||
void ESPEasy_Scheduler::process_gpio_timer(SchedulerTimerID timerID, unsigned long lasttimer) {
|
||||
void ESPEasy_Scheduler::process_gpio_timer(SchedulerTimerID timerID, uint32_t lasttimer) {
|
||||
auto it = systemTimers.find(timerID.mixed_id);
|
||||
|
||||
if (it == systemTimers.end()) {
|
||||
@@ -91,7 +91,7 @@ void ESPEasy_Scheduler::process_gpio_timer(SchedulerTimerID timerID, unsigned lo
|
||||
// Recurring timer
|
||||
it->second.markNextRecurring();
|
||||
|
||||
unsigned long newTimer = lasttimer;
|
||||
uint32_t newTimer = lasttimer;
|
||||
setNextTimeInterval(newTimer, it->second.getInterval());
|
||||
setNewTimerAt(timerID, newTimer);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// For example running the PLUGIN_FIFTY_PER_SECOND calls probably need to run as fast as possible as they need to fetch data before a buffer
|
||||
// overflow happens.
|
||||
// For those it is more important to actually run it than keeping pace.
|
||||
void ESPEasy_Scheduler::setNextTimeInterval(unsigned long& timer, const unsigned long step) {
|
||||
void ESPEasy_Scheduler::setNextTimeInterval(uint32_t& timer, const uint32_t step) {
|
||||
timer += step;
|
||||
const long passed = timePassedSince(timer);
|
||||
|
||||
@@ -33,7 +33,7 @@ void ESPEasy_Scheduler::setNextTimeInterval(unsigned long& timer, const unsigned
|
||||
return;
|
||||
}
|
||||
|
||||
if (static_cast<unsigned long>(passed) > step) {
|
||||
if (static_cast<uint32_t>(passed) > step) {
|
||||
// No need to keep running behind, start again.
|
||||
timer = millis() + step;
|
||||
return;
|
||||
@@ -45,8 +45,8 @@ void ESPEasy_Scheduler::setNextTimeInterval(unsigned long& timer, const unsigned
|
||||
|
||||
// More strict interval where no time drift is more important than missing a scheduled interval.
|
||||
// For example timing for repeating longPulse where 2 scheduled intervals need to be at constant 'distance' from each other.
|
||||
void ESPEasy_Scheduler::setNextStrictTimeInterval(unsigned long & timer,
|
||||
const unsigned long step) {
|
||||
void ESPEasy_Scheduler::setNextStrictTimeInterval(uint32_t & timer,
|
||||
const uint32_t step) {
|
||||
timer += step;
|
||||
const long passed = timePassedSince(timer);
|
||||
|
||||
@@ -56,7 +56,7 @@ void ESPEasy_Scheduler::setNextStrictTimeInterval(unsigned long & timer,
|
||||
}
|
||||
|
||||
// Try to get in sync again.
|
||||
const unsigned long stepsMissed = static_cast<unsigned long>(passed) / step;
|
||||
const uint32_t stepsMissed = static_cast<uint32_t>(passed) / step;
|
||||
|
||||
timer += (stepsMissed + 1) * step;
|
||||
}
|
||||
@@ -65,14 +65,14 @@ void ESPEasy_Scheduler::setIntervalTimer(SchedulerIntervalTimer_e intervalTimer)
|
||||
setIntervalTimer(intervalTimer, millis());
|
||||
}
|
||||
|
||||
void ESPEasy_Scheduler::setIntervalTimerAt(SchedulerIntervalTimer_e intervalTimer, unsigned long newtimer) {
|
||||
void ESPEasy_Scheduler::setIntervalTimerAt(SchedulerIntervalTimer_e intervalTimer, uint32_t newtimer) {
|
||||
const ConstIntervalTimerID timerID(intervalTimer);
|
||||
|
||||
setNewTimerAt(timerID, newtimer);
|
||||
}
|
||||
|
||||
void ESPEasy_Scheduler::setIntervalTimerOverride(SchedulerIntervalTimer_e intervalTimer, unsigned long msecFromNow) {
|
||||
unsigned long timer = millis();
|
||||
void ESPEasy_Scheduler::setIntervalTimerOverride(SchedulerIntervalTimer_e intervalTimer, uint32_t msecFromNow) {
|
||||
uint32_t timer = millis();
|
||||
|
||||
setNextTimeInterval(timer, msecFromNow);
|
||||
const ConstIntervalTimerID timerID(intervalTimer);
|
||||
@@ -80,16 +80,16 @@ void ESPEasy_Scheduler::setIntervalTimerOverride(SchedulerIntervalTimer_e interv
|
||||
setNewTimerAt(timerID, timer);
|
||||
}
|
||||
|
||||
void ESPEasy_Scheduler::scheduleNextDelayQueue(SchedulerIntervalTimer_e intervalTimer, unsigned long nextTime) {
|
||||
void ESPEasy_Scheduler::scheduleNextDelayQueue(SchedulerIntervalTimer_e intervalTimer, uint32_t nextTime) {
|
||||
if (nextTime != 0) {
|
||||
// Schedule for next process run.
|
||||
setIntervalTimerAt(intervalTimer, nextTime);
|
||||
}
|
||||
}
|
||||
|
||||
void ESPEasy_Scheduler::setIntervalTimer(SchedulerIntervalTimer_e intervalTimer, unsigned long lasttimer) {
|
||||
void ESPEasy_Scheduler::setIntervalTimer(SchedulerIntervalTimer_e intervalTimer, uint32_t lasttimer) {
|
||||
// Set the initial timers for the regular runs
|
||||
unsigned long interval = 0;
|
||||
uint32_t interval = 0;
|
||||
|
||||
switch (intervalTimer) {
|
||||
case SchedulerIntervalTimer_e::TIMER_20MSEC: interval = 20; break;
|
||||
@@ -132,7 +132,7 @@ void ESPEasy_Scheduler::setIntervalTimer(SchedulerIntervalTimer_e intervalTimer,
|
||||
// in the code to find all places that need to be updated too.
|
||||
interval = 1000; break;
|
||||
}
|
||||
unsigned long timer = lasttimer;
|
||||
uint32_t timer = lasttimer;
|
||||
|
||||
setNextTimeInterval(timer, interval);
|
||||
const ConstIntervalTimerID timerID(intervalTimer);
|
||||
@@ -149,7 +149,7 @@ void ESPEasy_Scheduler::sendGratuitousARP_now() {
|
||||
}
|
||||
}
|
||||
|
||||
void ESPEasy_Scheduler::process_interval_timer(SchedulerTimerID timerID, unsigned long lasttimer) {
|
||||
void ESPEasy_Scheduler::process_interval_timer(SchedulerTimerID timerID, uint32_t lasttimer) {
|
||||
// Set the interval timer now, it may be altered by the commands below.
|
||||
// This is the default next-run-time.
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* Network Adapter Timer (NWPLUGIN_TASKTIMER_IN)
|
||||
* Can be scheduled per combo networkIndex & Par1 (20 least significant bits)
|
||||
\*********************************************************************************************/
|
||||
void ESPEasy_Scheduler::setNetworkInitTimer(unsigned long msecFromNow,
|
||||
void ESPEasy_Scheduler::setNetworkInitTimer(uint32_t msecFromNow,
|
||||
ESPEasy::net::networkIndex_t networkIndex)
|
||||
{
|
||||
if (ESPEasy::net::getNWPluginData(networkIndex) == nullptr) {
|
||||
@@ -19,7 +19,7 @@ void ESPEasy_Scheduler::setNetworkInitTimer(unsigned long msecFro
|
||||
}
|
||||
}
|
||||
|
||||
void ESPEasy_Scheduler::setNetworkExitTimer(unsigned long msecFromNow,
|
||||
void ESPEasy_Scheduler::setNetworkExitTimer(uint32_t msecFromNow,
|
||||
ESPEasy::net::networkIndex_t networkIndex)
|
||||
{
|
||||
// First check if there are any pending INIT timers
|
||||
@@ -32,7 +32,7 @@ void ESPEasy_Scheduler::setNetworkExitTimer(unsigned long msecFro
|
||||
setNetworkTimer(msecFromNow, networkIndex, NWPlugin::Function::NWPLUGIN_EXIT);
|
||||
}
|
||||
|
||||
void ESPEasy_Scheduler::setNetworkTimer(unsigned long msecFromNow,
|
||||
void ESPEasy_Scheduler::setNetworkTimer(uint32_t msecFromNow,
|
||||
ESPEasy::net::networkIndex_t networkIndex,
|
||||
NWPlugin::Function function,
|
||||
int Par1,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Plugin Task Timer
|
||||
\*********************************************************************************************/
|
||||
void ESPEasy_Scheduler::setPluginTaskTimer(
|
||||
unsigned long msecFromNow,
|
||||
uint32_t msecFromNow,
|
||||
taskIndex_t taskIndex,
|
||||
int Par1, int Par2, int Par3, int Par4, int Par5)
|
||||
{
|
||||
@@ -19,7 +19,7 @@ void ESPEasy_Scheduler::setPluginTaskTimer(
|
||||
}
|
||||
|
||||
void ESPEasy_Scheduler::setPluginTaskTimer(
|
||||
unsigned long msecFromNow,
|
||||
uint32_t msecFromNow,
|
||||
taskIndex_t taskIndex,
|
||||
const PluginFunctions_e& function,
|
||||
int Par1, int Par2, int Par3, int Par4, int Par5)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Essentially calling PLUGIN_DEVICETIMER_IN
|
||||
* Similar to PLUGIN_TASKTIMER_IN, addressed to a plugin instead of a task.
|
||||
\*********************************************************************************************/
|
||||
void ESPEasy_Scheduler::setPluginTimer(unsigned long msecFromNow, pluginID_t pluginID, int Par1, int Par2, int Par3, int Par4, int Par5)
|
||||
void ESPEasy_Scheduler::setPluginTimer(uint32_t msecFromNow, pluginID_t pluginID, int Par1, int Par2, int Par3, int Par4, int Par5)
|
||||
{
|
||||
// plugin number and par1 form a unique key that can be used to restart a timer
|
||||
// Use deviceIndex instead of pluginID, since the deviceIndex uses less bits.
|
||||
|
||||
@@ -25,7 +25,7 @@ static bool checkRulesTimerIndex(unsigned int timerIndex) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ESPEasy_Scheduler::setRulesTimer(unsigned long msecFromNow, unsigned int timerIndex, int recurringCount, bool startImmediately) {
|
||||
bool ESPEasy_Scheduler::setRulesTimer(uint32_t msecFromNow, unsigned int timerIndex, int recurringCount, bool startImmediately) {
|
||||
if (!checkRulesTimerIndex(timerIndex)) { return false; }
|
||||
|
||||
const RulesTimerID timerID(timerIndex);
|
||||
@@ -37,7 +37,7 @@ bool ESPEasy_Scheduler::setRulesTimer(unsigned long msecFromNow, unsigned int ti
|
||||
return true;
|
||||
}
|
||||
|
||||
void ESPEasy_Scheduler::process_rules_timer(SchedulerTimerID id, unsigned long lasttimer) {
|
||||
void ESPEasy_Scheduler::process_rules_timer(SchedulerTimerID id, uint32_t lasttimer) {
|
||||
auto it = systemTimers.find(id.mixed_id);
|
||||
|
||||
if (it == systemTimers.end()) { return; }
|
||||
@@ -58,7 +58,7 @@ void ESPEasy_Scheduler::process_rules_timer(SchedulerTimerID id, unsigned long l
|
||||
// Reschedule before sending the event, as it may get rescheduled in handling the timer event.
|
||||
if (it->second.isRecurring()) {
|
||||
// Recurring timer
|
||||
unsigned long newTimer = lasttimer;
|
||||
uint32_t newTimer = lasttimer;
|
||||
setNextTimeInterval(newTimer, it->second.getInterval());
|
||||
setNewTimerAt(id, newTimer);
|
||||
it->second.markNextRecurring();
|
||||
@@ -80,7 +80,7 @@ void ESPEasy_Scheduler::process_rules_timer(SchedulerTimerID id, unsigned long l
|
||||
}
|
||||
}
|
||||
|
||||
bool ESPEasy_Scheduler::pause_rules_timer(unsigned long timerIndex) {
|
||||
bool ESPEasy_Scheduler::pause_rules_timer(uint32_t timerIndex) {
|
||||
if (!checkRulesTimerIndex(timerIndex)) { return false; }
|
||||
const RulesTimerID timerID(timerIndex);
|
||||
auto it = systemTimers.find(timerID.mixed_id);
|
||||
@@ -92,7 +92,7 @@ bool ESPEasy_Scheduler::pause_rules_timer(unsigned long timerIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned long timer;
|
||||
uint32_t timer;
|
||||
|
||||
if (msecTimerHandler.getTimerForId(timerID.mixed_id, timer)) {
|
||||
if (it->second.isPaused()) {
|
||||
@@ -112,14 +112,14 @@ bool ESPEasy_Scheduler::pause_rules_timer(unsigned long timerIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ESPEasy_Scheduler::resume_rules_timer(unsigned long timerIndex) {
|
||||
bool ESPEasy_Scheduler::resume_rules_timer(uint32_t timerIndex) {
|
||||
if (!checkRulesTimerIndex(timerIndex)) { return false; }
|
||||
const RulesTimerID timerID(timerIndex);
|
||||
auto it = systemTimers.find(timerID.mixed_id);
|
||||
|
||||
if (it == systemTimers.end()) { return false; }
|
||||
|
||||
unsigned long timer;
|
||||
uint32_t timer;
|
||||
|
||||
if (msecTimerHandler.getTimerForId(timerID.mixed_id, timer)) {
|
||||
if (it->second.isPaused()) {
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* When the plugin task is initialized, a call to schedule_task_device_timer_at_init
|
||||
* will bootstrap this sequence.
|
||||
\*********************************************************************************************/
|
||||
void ESPEasy_Scheduler::schedule_task_device_timer_at_init(unsigned long task_index) {
|
||||
unsigned long runAt = millis();
|
||||
void ESPEasy_Scheduler::schedule_task_device_timer_at_init(uint32_t task_index) {
|
||||
uint32_t runAt = millis();
|
||||
|
||||
if (!isDeepSleepEnabled()) {
|
||||
// Deepsleep is not enabled, add some offset based on the task index
|
||||
@@ -35,7 +35,7 @@ void ESPEasy_Scheduler::schedule_all_task_device_timers() {
|
||||
}
|
||||
}
|
||||
|
||||
void ESPEasy_Scheduler::schedule_task_device_timer(unsigned long task_index, unsigned long runAt) {
|
||||
void ESPEasy_Scheduler::schedule_task_device_timer(uint32_t task_index, uint32_t runAt) {
|
||||
/*
|
||||
String log = F("schedule_task_device_timer: task: ");
|
||||
log += task_index;
|
||||
@@ -70,9 +70,9 @@ void ESPEasy_Scheduler::schedule_task_device_timer(unsigned long task_index, uns
|
||||
}
|
||||
}
|
||||
|
||||
void ESPEasy_Scheduler::reschedule_task_device_timer(unsigned long task_index, unsigned long lasttimer) {
|
||||
void ESPEasy_Scheduler::reschedule_task_device_timer(uint32_t task_index, uint32_t lasttimer) {
|
||||
if (!validTaskIndex(task_index)) { return; }
|
||||
unsigned long newtimer = Settings.TaskDeviceTimer[task_index];
|
||||
uint32_t newtimer = Settings.TaskDeviceTimer[task_index];
|
||||
|
||||
if (newtimer != 0) {
|
||||
newtimer = lasttimer + (newtimer * 1000);
|
||||
@@ -80,7 +80,7 @@ void ESPEasy_Scheduler::reschedule_task_device_timer(unsigned long task_index, u
|
||||
}
|
||||
}
|
||||
|
||||
void ESPEasy_Scheduler::process_task_device_timer(SchedulerTimerID timerID, unsigned long lasttimer) {
|
||||
void ESPEasy_Scheduler::process_task_device_timer(SchedulerTimerID timerID, uint32_t lasttimer) {
|
||||
const TaskDeviceTimerID *tmp = reinterpret_cast<const TaskDeviceTimerID *>(&timerID);
|
||||
const taskIndex_t task_index = tmp->getTaskIndex();
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
# include "../DataStructs/Scheduler_RulesTimerID.h"
|
||||
# include "../DataStructs/Scheduler_SystemEventQueueTimerID.h"
|
||||
# include "../DataStructs/Scheduler_TaskDeviceTimerID.h"
|
||||
# include "../DataStructs/Scheduler_NWPluginTimerID.h"
|
||||
#endif // ifndef BUILD_NO_DEBUG
|
||||
|
||||
String ESPEasy_Scheduler::decodeSchedulerId(SchedulerTimerID timerID) {
|
||||
@@ -51,6 +52,9 @@ String ESPEasy_Scheduler::decodeSchedulerId(SchedulerTimerID timerID) {
|
||||
case SchedulerTimerType_e::TaskDeviceTimer:
|
||||
decoded = reinterpret_cast<const TaskDeviceTimerID *>(&timerID)->decode();
|
||||
break;
|
||||
case SchedulerTimerType_e::NWPLUGIN_TIMER_IN_e:
|
||||
decoded = reinterpret_cast<const NWPluginTimerID *>(&timerID)->decode();
|
||||
break;
|
||||
|
||||
// TD-er: Do not add a default: case here, so the compiler will warn us when we're missing one later.
|
||||
}
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
\*********************************************************************************************/
|
||||
|
||||
// FIXME: change original code so it uses String and String.toInt()
|
||||
unsigned long str2int(const char *string)
|
||||
uint32_t str2int(const char *string)
|
||||
{
|
||||
uint32_t temp = 0;
|
||||
|
||||
validUIntFromString(string, temp);
|
||||
|
||||
return static_cast<unsigned long>(temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
@@ -297,22 +297,22 @@ bool string2float(const String& string, float& floatvalue) {
|
||||
Handling HEX strings
|
||||
\*********************************************************************************************/
|
||||
|
||||
// Convert max. 8 hex decimals to unsigned long
|
||||
unsigned long hexToUL(const String& input_c, size_t nrHexDecimals) {
|
||||
const unsigned long long resULL = hexToULL(input_c, nrHexDecimals);
|
||||
return static_cast<unsigned long>(resULL & 0xFFFFFFFFull);
|
||||
// Convert max. 8 hex decimals to uint32_t
|
||||
uint32_t hexToUL(const String& input_c, size_t nrHexDecimals) {
|
||||
const uint64_t resULL = hexToULL(input_c, nrHexDecimals);
|
||||
return static_cast<uint32_t>(resULL & 0xFFFFFFFFull);
|
||||
}
|
||||
|
||||
unsigned long hexToUL(const String& input_c) {
|
||||
uint32_t hexToUL(const String& input_c) {
|
||||
return hexToUL(input_c, input_c.length());
|
||||
}
|
||||
|
||||
unsigned long hexToUL(const String& input_c, size_t startpos, size_t nrHexDecimals) {
|
||||
uint32_t hexToUL(const String& input_c, size_t startpos, size_t nrHexDecimals) {
|
||||
return hexToUL(input_c.substring(startpos, startpos + nrHexDecimals), nrHexDecimals);
|
||||
}
|
||||
|
||||
// Convert max. 16 hex decimals to unsigned long long (aka uint64_t)
|
||||
unsigned long long hexToULL(const String& input_c, size_t nrHexDecimals) {
|
||||
// Convert max. 16 hex decimals to uint64_t (aka uint64_t)
|
||||
uint64_t hexToULL(const String& input_c, size_t nrHexDecimals) {
|
||||
size_t nr_decimals = nrHexDecimals;
|
||||
|
||||
if (nr_decimals > 16) {
|
||||
@@ -328,11 +328,11 @@ unsigned long long hexToULL(const String& input_c, size_t nrHexDecimals) {
|
||||
return strtoull(input_c.substring(0, nr_decimals).c_str(), 0, 16);
|
||||
}
|
||||
|
||||
unsigned long long hexToULL(const String& input_c) {
|
||||
uint64_t hexToULL(const String& input_c) {
|
||||
return hexToULL(input_c, input_c.length());
|
||||
}
|
||||
|
||||
unsigned long long hexToULL(const String& input_c, size_t startpos, size_t nrHexDecimals) {
|
||||
uint64_t hexToULL(const String& input_c, size_t startpos, size_t nrHexDecimals) {
|
||||
return hexToULL(input_c.substring(startpos, startpos + nrHexDecimals), nrHexDecimals);
|
||||
}
|
||||
|
||||
@@ -404,22 +404,22 @@ String formatToHex_wordarray(const uint16_t* data, size_t size)
|
||||
return res;
|
||||
}
|
||||
|
||||
String formatToHex(unsigned long value,
|
||||
String formatToHex(uint32_t value,
|
||||
const __FlashStringHelper * prefix,
|
||||
unsigned int minimal_hex_digits) {
|
||||
return concat(prefix, formatToHex_no_prefix(value, minimal_hex_digits));
|
||||
}
|
||||
|
||||
String formatToHex(unsigned long value,
|
||||
String formatToHex(uint32_t value,
|
||||
const __FlashStringHelper * prefix) {
|
||||
return formatToHex(value, prefix, 0);
|
||||
}
|
||||
|
||||
String formatToHex(unsigned long value, unsigned int minimal_hex_digits) {
|
||||
String formatToHex(uint32_t value, unsigned int minimal_hex_digits) {
|
||||
return formatToHex(value, F("0x"), minimal_hex_digits);
|
||||
}
|
||||
|
||||
String formatToHex_no_prefix(unsigned long value, unsigned int minimal_hex_digits) {
|
||||
String formatToHex_no_prefix(uint32_t value, unsigned int minimal_hex_digits) {
|
||||
const String fmt = strformat(F("%%0%dX"), minimal_hex_digits);
|
||||
return strformat(fmt, value);
|
||||
}
|
||||
@@ -462,11 +462,11 @@ String formatHumanReadable(uint64_t value,
|
||||
return result;
|
||||
}
|
||||
|
||||
String formatToHex_decimal(unsigned long value) {
|
||||
String formatToHex_decimal(uint32_t value) {
|
||||
return formatToHex_decimal(value, 1);
|
||||
}
|
||||
|
||||
String formatToHex_decimal(unsigned long value, unsigned long factor) {
|
||||
String formatToHex_decimal(uint32_t value, uint32_t factor) {
|
||||
String result = formatToHex(value);
|
||||
|
||||
result += F(" (");
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
\*********************************************************************************************/
|
||||
|
||||
// FIXME: change original code so it uses String and String.toInt()
|
||||
unsigned long str2int(const char *string);
|
||||
uint32_t str2int(const char *string);
|
||||
|
||||
/********************************************************************************************\
|
||||
Check if valid float and convert string to float.
|
||||
@@ -69,23 +69,23 @@ String floatToString(const float& value,
|
||||
Handling HEX strings
|
||||
\*********************************************************************************************/
|
||||
|
||||
// Convert max. 8 hex decimals to unsigned long
|
||||
unsigned long hexToUL(const String& input_c,
|
||||
// Convert max. 8 hex decimals to uint32_t
|
||||
uint32_t hexToUL(const String& input_c,
|
||||
size_t nrHexDecimals);
|
||||
|
||||
unsigned long hexToUL(const String& input_c);
|
||||
uint32_t hexToUL(const String& input_c);
|
||||
|
||||
unsigned long hexToUL(const String& input_c,
|
||||
uint32_t hexToUL(const String& input_c,
|
||||
size_t startpos,
|
||||
size_t nrHexDecimals);
|
||||
|
||||
// Convert max. 16 hex decimals to unsigned long long
|
||||
unsigned long long hexToULL(const String& input_c,
|
||||
// Convert max. 16 hex decimals to uint64_t
|
||||
uint64_t hexToULL(const String& input_c,
|
||||
size_t nrHexDecimals);
|
||||
|
||||
unsigned long long hexToULL(const String& input_c);
|
||||
uint64_t hexToULL(const String& input_c);
|
||||
|
||||
unsigned long long hexToULL(const String& input_c,
|
||||
uint64_t hexToULL(const String& input_c,
|
||||
size_t startpos,
|
||||
size_t nrHexDecimals);
|
||||
|
||||
@@ -110,16 +110,16 @@ String formatULLtoHex_no_prefix(const uint64_t& value, unsigned int minimal_hex_
|
||||
String formatULLtoHex_decimal(const uint64_t& value);
|
||||
|
||||
|
||||
String formatToHex(unsigned long value,
|
||||
String formatToHex(uint32_t value,
|
||||
const __FlashStringHelper * prefix,
|
||||
unsigned int minimal_hex_digits);
|
||||
|
||||
String formatToHex(unsigned long value,
|
||||
String formatToHex(uint32_t value,
|
||||
const __FlashStringHelper * prefix);
|
||||
|
||||
String formatToHex(unsigned long value, unsigned int minimal_hex_digits = 0);
|
||||
String formatToHex(uint32_t value, unsigned int minimal_hex_digits = 0);
|
||||
|
||||
String formatToHex_no_prefix(unsigned long value, unsigned int minimal_hex_digits = 0);
|
||||
String formatToHex_no_prefix(uint32_t value, unsigned int minimal_hex_digits = 0);
|
||||
|
||||
String formatHumanReadable(uint64_t value,
|
||||
uint32_t factor);
|
||||
@@ -128,10 +128,10 @@ String formatHumanReadable(uint64_t value,
|
||||
uint32_t factor,
|
||||
int NrDecimals);
|
||||
|
||||
String formatToHex_decimal(unsigned long value);
|
||||
String formatToHex_decimal(uint32_t value);
|
||||
|
||||
String formatToHex_decimal(unsigned long value,
|
||||
unsigned long factor);
|
||||
String formatToHex_decimal(uint32_t value,
|
||||
uint32_t factor);
|
||||
|
||||
int intFromHexChar(char a);
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ bool safeReadStringUntil(Stream & input,
|
||||
unsigned int timeout)
|
||||
{
|
||||
int c;
|
||||
const unsigned long start = millis();
|
||||
const unsigned long timer = start + timeout;
|
||||
unsigned long backgroundtasks_timer = start + 10;
|
||||
const uint32_t start = millis();
|
||||
const uint32_t timer = start + timeout;
|
||||
uint32_t backgroundtasks_timer = start + 10;
|
||||
|
||||
// FIXME TD-er: Should this also de-allocate internal buffer?
|
||||
str.clear();
|
||||
|
||||
@@ -103,7 +103,7 @@ bool ESPEasy_key_value_store::load(
|
||||
size_t sizePerType{};
|
||||
uint32_t key{};
|
||||
|
||||
const unsigned long start = millis();
|
||||
const uint32_t start = millis();
|
||||
|
||||
while (readPos < startChecksumPos && timePassedSince(start) < 1000) {
|
||||
// This loop always starts at the beginning of a key/value type,
|
||||
|
||||
@@ -88,19 +88,19 @@ bool Internal_GPIO_pulseHelper::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
void Internal_GPIO_pulseHelper::getPulseCounters(unsigned long& pulseCounter, unsigned long& pulseTotalCounter, float& pulseTime_msec)
|
||||
void Internal_GPIO_pulseHelper::getPulseCounters(uint32_t& pulseCounter, uint32_t& pulseTotalCounter, float& pulseTime_msec)
|
||||
{
|
||||
pulseCounter = ISRdata.pulseCounter;
|
||||
pulseTotalCounter = ISRdata.pulseTotalCounter;
|
||||
pulseTime_msec = static_cast<float>(ISRdata.pulseTime) / 1000.0f;
|
||||
}
|
||||
|
||||
void Internal_GPIO_pulseHelper::setPulseCountTotal(unsigned long pulseTotalCounter)
|
||||
void Internal_GPIO_pulseHelper::setPulseCountTotal(uint32_t pulseTotalCounter)
|
||||
{
|
||||
ISRdata.pulseTotalCounter = pulseTotalCounter;
|
||||
}
|
||||
|
||||
void Internal_GPIO_pulseHelper::setPulseCounter(unsigned long pulseCounter, float pulseTime_msec)
|
||||
void Internal_GPIO_pulseHelper::setPulseCounter(uint32_t pulseCounter, float pulseTime_msec)
|
||||
{
|
||||
ISRdata.pulseCounter = pulseCounter;
|
||||
ISRdata.pulseTime = static_cast<uint64_t>(pulseTime_msec * 1000.0f);
|
||||
|
||||
@@ -62,8 +62,8 @@ struct pulseCounterISRdata_t {
|
||||
|
||||
// internal variables for PULSE mode, not used by ISR functions
|
||||
struct pulseModeData_t {
|
||||
unsigned long pulseLowTime = 0; // indicates the length of the most recent stable low pulse (in ms)
|
||||
unsigned long pulseHighTime = 0; // indicates the length of the most recent stable high pulse (in ms)
|
||||
uint32_t pulseLowTime = 0; // indicates the length of the most recent stable low pulse (in ms)
|
||||
uint32_t pulseHighTime = 0; // indicates the length of the most recent stable high pulse (in ms)
|
||||
int currentStableState = 0; // stores current stable pin state. Set in Step 3 when new stable pulse started
|
||||
int lastCheckState = 0; // most recent pin state, that was read. Set in Step1,2,3
|
||||
|
||||
@@ -135,13 +135,13 @@ struct Internal_GPIO_pulseHelper {
|
||||
|
||||
bool init();
|
||||
|
||||
void getPulseCounters(unsigned long& pulseCounter,
|
||||
unsigned long& pulseTotalCounter,
|
||||
void getPulseCounters(uint32_t& pulseCounter,
|
||||
uint32_t& pulseTotalCounter,
|
||||
float & pulseTime_msec);
|
||||
|
||||
void setPulseCountTotal(unsigned long pulseTotalCounter);
|
||||
void setPulseCountTotal(uint32_t pulseTotalCounter);
|
||||
|
||||
void setPulseCounter(unsigned long pulseCounter,
|
||||
void setPulseCounter(uint32_t pulseCounter,
|
||||
float pulseTime_msec = 0.0f);
|
||||
|
||||
void resetPulseCounter();
|
||||
|
||||
@@ -36,7 +36,7 @@ GPIO_plugin_helper_data_t::GPIO_plugin_helper_data_t(
|
||||
_longpressFired(false)
|
||||
{
|
||||
// store millis for debounce, doubleclick and long press
|
||||
const unsigned long cur_millis = millis();
|
||||
const uint32_t cur_millis = millis();
|
||||
|
||||
_debounceTimer = cur_millis; // debounce timer
|
||||
_doubleClickTimer = cur_millis; // doubleclick timer
|
||||
@@ -144,11 +144,11 @@ void GPIO_plugin_helper_data_t::tenPerSecond(
|
||||
_longpressTimer = millis();
|
||||
_longpressFired = false;
|
||||
|
||||
const unsigned long debounceTime = timePassedSince(_debounceTimer);
|
||||
const uint32_t debounceTime = timePassedSince(_debounceTimer);
|
||||
|
||||
if (debounceTime >= _debounceInterval_ms) // de-bounce check
|
||||
{
|
||||
const unsigned long deltaDC = timePassedSince(_doubleClickTimer);
|
||||
const uint32_t deltaDC = timePassedSince(_doubleClickTimer);
|
||||
|
||||
if ((deltaDC >= _doubleClickMaxInterval_ms) ||
|
||||
(_doubleClickCounter == 3))
|
||||
@@ -293,7 +293,7 @@ void GPIO_plugin_helper_data_t::tenPerSecond(
|
||||
// Reset SafeButton counter
|
||||
_safeButtonCounter = 0;
|
||||
|
||||
const unsigned long deltaLP = timePassedSince(_longpressTimer);
|
||||
const uint32_t deltaLP = timePassedSince(_longpressTimer);
|
||||
|
||||
if (deltaLP >= _longpressMinInterval_ms)
|
||||
{
|
||||
|
||||
@@ -15,20 +15,20 @@
|
||||
eco_mode = enabled;
|
||||
}
|
||||
|
||||
void msecTimerHandlerStruct::registerAt(unsigned long id, unsigned long timer) {
|
||||
void msecTimerHandlerStruct::registerAt(uint32_t id, uint32_t timer) {
|
||||
timer_id_couple item(id, timer);
|
||||
|
||||
insert(item);
|
||||
}
|
||||
|
||||
void msecTimerHandlerStruct::remove(unsigned long id) {
|
||||
void msecTimerHandlerStruct::remove(uint32_t id) {
|
||||
timer_id_couple item(id, 0);
|
||||
remove(item);
|
||||
}
|
||||
|
||||
// Check if timeout has been reached and also return its set timer.
|
||||
// Return 0 if no item has reached timeout moment.
|
||||
unsigned long msecTimerHandlerStruct::getNextId(unsigned long& timer) {
|
||||
uint32_t msecTimerHandlerStruct::getNextId(uint32_t& timer) {
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
++get_called;
|
||||
#endif
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
|
||||
|
||||
bool msecTimerHandlerStruct::getTimerForId(unsigned long id, unsigned long& timer) const {
|
||||
bool msecTimerHandlerStruct::getTimerForId(uint32_t id, uint32_t& timer) const {
|
||||
for (auto it = _timer_ids.begin(); it != _timer_ids.end(); ++it) {
|
||||
if (it->_id == id) {
|
||||
timer = it->_timer;
|
||||
|
||||
@@ -13,19 +13,19 @@ struct msecTimerHandlerStruct {
|
||||
|
||||
void setEcoMode(bool enabled);
|
||||
|
||||
void registerAt(unsigned long id,
|
||||
unsigned long timer);
|
||||
void registerAt(uint32_t id,
|
||||
uint32_t timer);
|
||||
|
||||
void remove(unsigned long id);
|
||||
void remove(uint32_t id);
|
||||
|
||||
// Check if timeout has been reached and also return its set timer.
|
||||
// Return 0 if no item has reached timeout moment.
|
||||
unsigned long getNextId(unsigned long& timer);
|
||||
uint32_t getNextId(uint32_t& timer);
|
||||
|
||||
// Check if a give ID is scheduled and if so, return the set timer.
|
||||
// N.B. the ID is the mixed ID.
|
||||
bool getTimerForId(unsigned long id,
|
||||
unsigned long& timer) const;
|
||||
bool getTimerForId(uint32_t id,
|
||||
uint32_t& timer) const;
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
String getQueueStats();
|
||||
#endif
|
||||
@@ -46,9 +46,9 @@ private:
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
// Statistics
|
||||
unsigned long get_called{};
|
||||
unsigned long get_called_ret_id{};
|
||||
unsigned long max_queue_length{};
|
||||
uint32_t get_called{};
|
||||
uint32_t get_called_ret_id{};
|
||||
uint32_t max_queue_length{};
|
||||
#endif
|
||||
|
||||
// Compute idle system time
|
||||
|
||||
@@ -250,7 +250,7 @@ bool NPlugin_001_send(const NotificationSettingsStruct& notificationsettings, St
|
||||
|
||||
// Must retrieve SMTP Reply Packet. Data not used, ignored.
|
||||
if (!failFlag) {
|
||||
const unsigned long timer = millis() + clientTimeout;
|
||||
const uint32_t timer = millis() + clientTimeout;
|
||||
String replyStr;
|
||||
String catStr;
|
||||
|
||||
@@ -425,7 +425,7 @@ bool NPlugin_001_MTA(WiFiClient& client, const String& aStr, uint16_t aWaitForPa
|
||||
}
|
||||
|
||||
// Wait For Response
|
||||
const unsigned long timer = millis() + timeout;
|
||||
const uint32_t timer = millis() + timeout;
|
||||
backgroundtasks();
|
||||
|
||||
do { // FIXME TD-er: Why this while loop??? makes no sense as it will only be run once
|
||||
|
||||
@@ -7,7 +7,7 @@ P003_data_struct::P003_data_struct(const Internal_GPIO_pulseHelper::pulseCounter
|
||||
|
||||
bool P003_data_struct::plugin_read(struct EventStruct *event) {
|
||||
bool success = true;
|
||||
unsigned long pulseCounter, pulseCounterTotal;
|
||||
uint32_t pulseCounter, pulseCounterTotal;
|
||||
float pulseTime_msec;
|
||||
|
||||
pulseHelper.getPulseCounters(pulseCounter, pulseCounterTotal, pulseTime_msec);
|
||||
@@ -57,7 +57,7 @@ bool P003_data_struct::plugin_read(struct EventStruct *event) {
|
||||
}
|
||||
|
||||
bool P003_data_struct::plugin_peek(struct EventStruct *event) {
|
||||
unsigned long pulseCounter, pulseCounterTotal;
|
||||
uint32_t pulseCounter, pulseCounterTotal;
|
||||
float pulseTime_msec;
|
||||
|
||||
pulseHelper.getPulseCounters(pulseCounter, pulseCounterTotal, pulseTime_msec);
|
||||
|
||||
Loaded 100 of 139 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user