mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 05:36:39 +00:00
Change NULL to nullptr
Change NULL to nullptr
This commit is contained in:
parent
dd2a6c7ef3
commit
e1c92b701b
@ -415,7 +415,7 @@ bool ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t
|
||||
DEBUG_OUTPUT.println(argFilename);
|
||||
#endif
|
||||
//use GET to set the filename if uploading using blob
|
||||
if (argFilename == F("blob") && hasArg(FPSTR(filename)))
|
||||
if (argFilename == F("blob") && hasArg(FPSTR(filename)))
|
||||
argFilename = arg(FPSTR(filename));
|
||||
}
|
||||
#ifdef DEBUG_ESP_HTTP_SERVER
|
||||
@ -510,7 +510,7 @@ readfile:
|
||||
uint8_t endBuf[boundary.length()];
|
||||
client.readBytes(endBuf, boundary.length());
|
||||
|
||||
if (strstr((const char*)endBuf, boundary.c_str()) != NULL){
|
||||
if (strstr((const char*)endBuf, boundary.c_str()) != nullptr){
|
||||
if(_currentHandler && _currentHandler->canUpload(_currentUri))
|
||||
_currentHandler->upload(*this, _currentUri, *_currentUpload);
|
||||
_currentUpload->totalSize += _currentUpload->currentSize;
|
||||
@ -571,7 +571,7 @@ readfile:
|
||||
arg.value = postArgs[iarg].value;
|
||||
}
|
||||
_currentArgCount = iarg;
|
||||
if (postArgs)
|
||||
if (postArgs)
|
||||
delete[] postArgs;
|
||||
return true;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
* Change image name BE_MINIMAL to FIRMWARE_MINIMAL and USE_xyz to FIRMWARE_xyz (#5106)
|
||||
* Change GUI weblog from XML to plain text solving possible empty screens (#5154)
|
||||
* Fix most compiler warnings
|
||||
* Fix Display exception 28 when JSON value is NULL received
|
||||
* Fix Display exception 28 when JSON value is nullptr received
|
||||
* Fix epaper driver (#4785)
|
||||
* Fix HAss Sensor Discovery Software Watchdog restart (#4831, #4988)
|
||||
* Fix allowable MAX_RULE_VARS to 16 (#4933)
|
||||
|
@ -306,7 +306,7 @@ void EepromEnd(void)
|
||||
|
||||
uint16_t settings_crc = 0;
|
||||
uint32_t settings_location = SETTINGS_LOCATION;
|
||||
uint8_t *settings_buffer = NULL;
|
||||
uint8_t *settings_buffer = nullptr;
|
||||
|
||||
/********************************************************************************************/
|
||||
/*
|
||||
@ -333,9 +333,9 @@ void SetFlashModeDout(void)
|
||||
|
||||
void SettingsBufferFree(void)
|
||||
{
|
||||
if (settings_buffer != NULL) {
|
||||
if (settings_buffer != nullptr) {
|
||||
free(settings_buffer);
|
||||
settings_buffer = NULL;
|
||||
settings_buffer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,15 +188,15 @@ char* Format(char* output, const char* input, int size)
|
||||
char *token;
|
||||
uint8_t digits = 0;
|
||||
|
||||
if (strstr(input, "%")) {
|
||||
if (strstr(input, "%") != nullptr) {
|
||||
strlcpy(output, input, size);
|
||||
token = strtok(output, "%");
|
||||
if (strstr(input, "%") == input) {
|
||||
output[0] = '\0';
|
||||
} else {
|
||||
token = strtok(NULL, "");
|
||||
token = strtok(nullptr, "");
|
||||
}
|
||||
if (token != NULL) {
|
||||
if (token != nullptr) {
|
||||
digits = atoi(token);
|
||||
if (digits) {
|
||||
char tmp[size];
|
||||
@ -221,10 +221,10 @@ char* Format(char* output, const char* input, int size)
|
||||
|
||||
char* GetOtaUrl(char *otaurl, size_t otaurl_size)
|
||||
{
|
||||
if (strstr(Settings.ota_url, "%04d") != NULL) { // OTA url contains placeholder for chip ID
|
||||
if (strstr(Settings.ota_url, "%04d") != nullptr) { // OTA url contains placeholder for chip ID
|
||||
snprintf(otaurl, otaurl_size, Settings.ota_url, ESP.getChipId() & 0x1fff);
|
||||
}
|
||||
else if (strstr(Settings.ota_url, "%d") != NULL) { // OTA url contains placeholder for chip ID
|
||||
else if (strstr(Settings.ota_url, "%d") != nullptr) { // OTA url contains placeholder for chip ID
|
||||
snprintf_P(otaurl, otaurl_size, Settings.ota_url, ESP.getChipId());
|
||||
}
|
||||
else {
|
||||
@ -278,7 +278,7 @@ char* GetTopic_P(char *stopic, uint8_t prefix, char *topic, const char* subtopic
|
||||
|
||||
char* GetFallbackTopic_P(char *stopic, uint8_t prefix, const char* subtopic)
|
||||
{
|
||||
return GetTopic_P(stopic, prefix +4, NULL, subtopic);
|
||||
return GetTopic_P(stopic, prefix +4, nullptr, subtopic);
|
||||
}
|
||||
|
||||
char* GetStateText(uint8_t state)
|
||||
@ -452,7 +452,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
||||
char command [CMDSZ];
|
||||
char stemp1[TOPSZ];
|
||||
char *p;
|
||||
char *type = NULL;
|
||||
char *type = nullptr;
|
||||
uint8_t lines = 1;
|
||||
bool jsflg = false;
|
||||
bool grpflg = false;
|
||||
@ -480,7 +480,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
||||
|
||||
if (XdrvMqttData(topicBuf, sizeof(topicBuf), dataBuf, sizeof(dataBuf))) { return; }
|
||||
|
||||
grpflg = (strstr(topicBuf, Settings.mqtt_grptopic) != NULL);
|
||||
grpflg = (strstr(topicBuf, Settings.mqtt_grptopic) != nullptr);
|
||||
|
||||
GetFallbackTopic_P(stemp1, CMND, ""); // Full Fallback topic = cmnd/DVES_xxxxxxxx_fb/
|
||||
fallback_topic_flag = (!strncmp(topicBuf, stemp1, strlen(stemp1)));
|
||||
@ -488,7 +488,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
||||
type = strrchr(topicBuf, '/'); // Last part of received topic is always the command (type)
|
||||
|
||||
index = 1;
|
||||
if (type != NULL) {
|
||||
if (type != nullptr) {
|
||||
type++;
|
||||
for (i = 0; i < strlen(type); i++) {
|
||||
type[i] = toupper(type[i]);
|
||||
@ -505,7 +505,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
||||
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_RESULT D_GROUP " %d, " D_INDEX " %d, " D_COMMAND " %s, " D_DATA " %s"), grpflg, index, type, dataBuf);
|
||||
|
||||
if (type != NULL) {
|
||||
if (type != nullptr) {
|
||||
Response_P(PSTR("{\"" D_JSON_COMMAND "\":\"" D_JSON_ERROR "\"}"));
|
||||
if (Settings.ledstate &0x02) { blinks++; }
|
||||
|
||||
@ -538,7 +538,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
||||
XdrvMailbox.data = dataBuf;
|
||||
if (!XdrvCall(FUNC_COMMAND)) {
|
||||
if (!XsnsCall(FUNC_COMMAND)) {
|
||||
type = NULL; // Unknown command
|
||||
type = nullptr; // Unknown command
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -547,7 +547,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
||||
uint8_t bl_pointer = (!backlog_pointer) ? MAX_BACKLOG -1 : backlog_pointer;
|
||||
bl_pointer--;
|
||||
char *blcommand = strtok(dataBuf, ";");
|
||||
while ((blcommand != NULL) && (backlog_index != bl_pointer)) {
|
||||
while ((blcommand != nullptr) && (backlog_index != bl_pointer)) {
|
||||
while(true) {
|
||||
blcommand = Trim(blcommand);
|
||||
if (!strncasecmp_P(blcommand, PSTR(D_CMND_BACKLOG), strlen(D_CMND_BACKLOG))) {
|
||||
@ -561,7 +561,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
||||
backlog_index++;
|
||||
if (backlog_index >= MAX_BACKLOG) backlog_index = 0;
|
||||
}
|
||||
blcommand = strtok(NULL, ";");
|
||||
blcommand = strtok(nullptr, ";");
|
||||
}
|
||||
// Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_APPENDED);
|
||||
mqtt_data[0] = '\0';
|
||||
@ -974,7 +974,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
||||
// {"NAME":"Generic","GPIO":[17,254,29,254,7,254,254,254,138,254,139,254,254],"FLAG":1,"BASE":255}
|
||||
bool error = false;
|
||||
|
||||
if (!strstr(dataBuf, "{")) { // If no JSON it must be parameter
|
||||
if (strstr(dataBuf, "{") == nullptr) { // If no JSON it must be parameter
|
||||
if ((payload > 0) && (payload <= MAXMODULE)) {
|
||||
ModuleDefault(payload -1); // Copy template module
|
||||
if (USER_MODULE == Settings.module) { restart_flag = 2; }
|
||||
@ -1193,7 +1193,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
||||
else if (CMND_HOSTNAME == command_code) {
|
||||
if (!grpflg && (data_len > 0) && (data_len < sizeof(Settings.hostname))) {
|
||||
strlcpy(Settings.hostname, (SC_DEFAULT == Shortcut(dataBuf)) ? WIFI_HOSTNAME : dataBuf, sizeof(Settings.hostname));
|
||||
if (strstr(Settings.hostname,"%")) {
|
||||
if (strstr(Settings.hostname, "%") != nullptr) {
|
||||
strlcpy(Settings.hostname, WIFI_HOSTNAME, sizeof(Settings.hostname));
|
||||
}
|
||||
restart_flag = 2;
|
||||
@ -1238,15 +1238,15 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
||||
if (max_relays > sizeof(Settings.interlock[0]) * 8) { max_relays = sizeof(Settings.interlock[0]) * 8; }
|
||||
if (max_relays > 1) { // Only interlock with more than 1 relay
|
||||
if (data_len > 0) {
|
||||
if (strstr(dataBuf, ",")) { // Interlock entry
|
||||
if (strstr(dataBuf, ",") != nullptr) { // Interlock entry
|
||||
for (uint8_t i = 0; i < MAX_INTERLOCKS; i++) { Settings.interlock[i] = 0; } // Reset current interlocks
|
||||
char *group;
|
||||
char *q;
|
||||
uint8_t group_index = 0;
|
||||
power_t relay_mask = 0;
|
||||
for (group = strtok_r(dataBuf, " ", &q); group && group_index < MAX_INTERLOCKS; group = strtok_r(NULL, " ", &q)) {
|
||||
for (group = strtok_r(dataBuf, " ", &q); group && group_index < MAX_INTERLOCKS; group = strtok_r(nullptr, " ", &q)) {
|
||||
char *str;
|
||||
for (str = strtok_r(group, ",", &p); str; str = strtok_r(NULL, ",", &p)) {
|
||||
for (str = strtok_r(group, ",", &p); str; str = strtok_r(nullptr, ",", &p)) {
|
||||
int pbit = atoi(str);
|
||||
if ((pbit > 0) && (pbit <= max_relays)) { // Only valid relays
|
||||
pbit--;
|
||||
@ -1329,9 +1329,9 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
||||
if (payload < 15) {
|
||||
p = strtok (dataBuf, ":");
|
||||
if (p) {
|
||||
p = strtok (NULL, ":");
|
||||
p = strtok (nullptr, ":");
|
||||
if (p) {
|
||||
Settings.timezone_minutes = strtol(p, NULL, 10);
|
||||
Settings.timezone_minutes = strtol(p, nullptr, 10);
|
||||
if (Settings.timezone_minutes > 59) { Settings.timezone_minutes = 59; }
|
||||
}
|
||||
}
|
||||
@ -1352,7 +1352,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
||||
uint8_t ts = 0;
|
||||
if (CMND_TIMEDST == command_code) { ts = 1; }
|
||||
if (data_len > 0) {
|
||||
if (strstr(dataBuf, ",")) { // Process parameter entry
|
||||
if (strstr(dataBuf, ",") != nullptr) { // Process parameter entry
|
||||
uint8_t tpos = 0; // Parameter index
|
||||
int value = 0;
|
||||
p = dataBuf; // Parameters like "1, 2,3 , 4 ,5, -120" or ",,,,,+240"
|
||||
@ -1426,9 +1426,9 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
||||
I2cScan(mqtt_data, sizeof(mqtt_data));
|
||||
}
|
||||
#endif // USE_I2C
|
||||
else type = NULL; // Unknown command
|
||||
else type = nullptr; // Unknown command
|
||||
}
|
||||
if (type == NULL) {
|
||||
if (type == nullptr) {
|
||||
blinks = 201;
|
||||
snprintf_P(topicBuf, sizeof(topicBuf), PSTR(D_JSON_COMMAND));
|
||||
Response_P(PSTR("{\"" D_JSON_COMMAND "\":\"" D_JSON_UNKNOWN "\"}"));
|
||||
@ -1608,18 +1608,18 @@ void ExecuteCommand(char *cmnd, int source)
|
||||
ShowSource(source);
|
||||
|
||||
token = strtok(cmnd, " ");
|
||||
if (token != NULL) {
|
||||
if (token != nullptr) {
|
||||
start = strrchr(token, '/'); // Skip possible cmnd/sonoff/ preamble
|
||||
if (start) { token = start +1; }
|
||||
}
|
||||
uint16_t size = (token != NULL) ? strlen(token) : 0;
|
||||
uint16_t size = (token != nullptr) ? strlen(token) : 0;
|
||||
char stopic[size +2]; // / + \0
|
||||
snprintf_P(stopic, sizeof(stopic), PSTR("/%s"), (token == NULL) ? "" : token);
|
||||
snprintf_P(stopic, sizeof(stopic), PSTR("/%s"), (token == nullptr) ? "" : token);
|
||||
|
||||
token = strtok(NULL, "");
|
||||
size = (token != NULL) ? strlen(token) : 0;
|
||||
token = strtok(nullptr, "");
|
||||
size = (token != nullptr) ? strlen(token) : 0;
|
||||
char svalue[size +1];
|
||||
strlcpy(svalue, (token == NULL) ? "" : token, sizeof(svalue)); // Fixed 5.8.0b
|
||||
strlcpy(svalue, (token == nullptr) ? "" : token, sizeof(svalue)); // Fixed 5.8.0b
|
||||
MqttDataHandler(stopic, (uint8_t*)svalue, strlen(svalue));
|
||||
}
|
||||
|
||||
@ -1807,10 +1807,10 @@ bool MqttShowSensor(void)
|
||||
}
|
||||
XsnsCall(FUNC_JSON_APPEND);
|
||||
bool json_data_available = (strlen(mqtt_data) - json_data_start);
|
||||
if (strstr_P(mqtt_data, PSTR(D_JSON_PRESSURE))) {
|
||||
if (strstr_P(mqtt_data, PSTR(D_JSON_PRESSURE)) != nullptr) {
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_PRESSURE_UNIT "\":\"%s\""), PressureUnit().c_str());
|
||||
}
|
||||
if (strstr_P(mqtt_data, PSTR(D_JSON_TEMPERATURE))) {
|
||||
if (strstr_P(mqtt_data, PSTR(D_JSON_TEMPERATURE)) != nullptr) {
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_TEMPERATURE_UNIT "\":\"%c\""), TempUnit());
|
||||
}
|
||||
ResponseAppend_P(PSTR("}"));
|
||||
@ -2025,8 +2025,8 @@ void Every250mSeconds(void)
|
||||
#ifndef FIRMWARE_MINIMAL
|
||||
if (RtcSettings.ota_loader) {
|
||||
char *bch = strrchr(mqtt_data, '/'); // Only consider filename after last backslash prevent change of urls having "-" in it
|
||||
char *pch = strrchr((bch != NULL) ? bch : mqtt_data, '-'); // Change from filename-DE.bin into filename-minimal.bin
|
||||
char *ech = strrchr((bch != NULL) ? bch : mqtt_data, '.'); // Change from filename.bin into filename-minimal.bin
|
||||
char *pch = strrchr((bch != nullptr) ? bch : mqtt_data, '-'); // Change from filename-DE.bin into filename-minimal.bin
|
||||
char *ech = strrchr((bch != nullptr) ? bch : mqtt_data, '.'); // Change from filename.bin into filename-minimal.bin
|
||||
if (!pch) { pch = ech; }
|
||||
if (pch) {
|
||||
mqtt_data[pch - mqtt_data] = '\0';
|
||||
@ -2611,7 +2611,7 @@ void setup(void)
|
||||
|
||||
Format(mqtt_client, Settings.mqtt_client, sizeof(mqtt_client));
|
||||
Format(mqtt_topic, Settings.mqtt_topic, sizeof(mqtt_topic));
|
||||
if (strstr(Settings.hostname, "%")) {
|
||||
if (strstr(Settings.hostname, "%") != nullptr) {
|
||||
strlcpy(Settings.hostname, WIFI_HOSTNAME, sizeof(Settings.hostname));
|
||||
snprintf_P(my_hostname, sizeof(my_hostname)-1, Settings.hostname, mqtt_topic, ESP.getChipId() & 0x1FFF);
|
||||
} else {
|
||||
|
@ -139,15 +139,15 @@ size_t strchrspn(const char *str1, int character)
|
||||
char* subStr(char* dest, char* str, const char *delim, int index)
|
||||
{
|
||||
char *act;
|
||||
char *sub = NULL;
|
||||
char *sub = nullptr;
|
||||
char *ptr;
|
||||
int i;
|
||||
|
||||
// Since strtok consumes the first arg, make a copy
|
||||
strncpy(dest, str, strlen(str)+1);
|
||||
for (i = 1, act = dest; i <= index; i++, act = NULL) {
|
||||
for (i = 1, act = dest; i <= index; i++, act = nullptr) {
|
||||
sub = strtok_r(act, delim, &ptr);
|
||||
if (sub == NULL) break;
|
||||
if (sub == nullptr) break;
|
||||
}
|
||||
sub = Trim(sub);
|
||||
return sub;
|
||||
@ -377,9 +377,9 @@ bool ParseIp(uint32_t* addr, const char* str)
|
||||
|
||||
*addr = 0;
|
||||
for (i = 0; i < 4; i++) {
|
||||
part[i] = strtoul(str, NULL, 10); // Convert byte
|
||||
part[i] = strtoul(str, nullptr, 10); // Convert byte
|
||||
str = strchr(str, '.');
|
||||
if (str == NULL || *str == '\0') {
|
||||
if (str == nullptr || *str == '\0') {
|
||||
break; // No more separators, exit
|
||||
}
|
||||
str++; // Point to next character after separator
|
||||
@ -422,7 +422,7 @@ bool NewerVersion(char* version_str)
|
||||
return false; // Bail if we can't duplicate. Assume bad.
|
||||
}
|
||||
// Loop through the version string, splitting on '.' seperators.
|
||||
for (char *str = strtok_r(version_dup, ".", &str_ptr); str && i < sizeof(VERSION); str = strtok_r(NULL, ".", &str_ptr), i++) {
|
||||
for (char *str = strtok_r(version_dup, ".", &str_ptr); str && i < sizeof(VERSION); str = strtok_r(nullptr, ".", &str_ptr), i++) {
|
||||
int field = atoi(str);
|
||||
// The fields in a version string can only range from 0-255.
|
||||
if ((field < 0) || (field > 255)) {
|
||||
@ -1219,7 +1219,7 @@ void SetSeriallog(uint8_t loglevel)
|
||||
#ifdef USE_WEBSERVER
|
||||
void GetLog(uint8_t idx, char** entry_pp, size_t* len_p)
|
||||
{
|
||||
char* entry_p = NULL;
|
||||
char* entry_p = nullptr;
|
||||
size_t len = 0;
|
||||
|
||||
if (idx) {
|
||||
|
@ -61,7 +61,7 @@ String GetBuildDateAndTime(void)
|
||||
|
||||
// sscanf(mdate, "%s %d %d", bdt, &day, &year); // Not implemented in 2.3.0 and probably too much code
|
||||
uint8_t i = 0;
|
||||
for (char *str = strtok_r(mdate, " ", &p); str && i < 3; str = strtok_r(NULL, " ", &p)) {
|
||||
for (char *str = strtok_r(mdate, " ", &p); str && i < 3; str = strtok_r(nullptr, " ", &p)) {
|
||||
switch (i++) {
|
||||
case 0: // Month
|
||||
smonth = str;
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <DNSServer.h>
|
||||
|
||||
#ifdef USE_RF_FLASH
|
||||
uint8_t *efm8bb1_update = NULL;
|
||||
uint8_t *efm8bb1_update = nullptr;
|
||||
#endif // USE_RF_FLASH
|
||||
|
||||
enum UploadTypes { UPL_TASMOTA, UPL_SETTINGS, UPL_EFM8BB1 };
|
||||
@ -524,7 +524,7 @@ void WifiManagerBegin(bool reset_only)
|
||||
|
||||
int channel = WIFI_SOFT_AP_CHANNEL;
|
||||
if ((channel < 1) || (channel > 13)) { channel = 1; }
|
||||
WiFi.softAP(my_hostname, NULL, channel);
|
||||
WiFi.softAP(my_hostname, nullptr, channel);
|
||||
|
||||
delay(500); // Without delay I've seen the IP address blank
|
||||
/* Setup the DNS server redirecting all the domains to the apIP */
|
||||
@ -689,7 +689,7 @@ void WSContentStart_P(const char* title, bool auth)
|
||||
|
||||
WSContentBegin(200, CT_HTML);
|
||||
|
||||
if (title != NULL) {
|
||||
if (title != nullptr) {
|
||||
char ctitle[strlen_P(title) +1];
|
||||
strcpy_P(ctitle, title); // Get title from flash to RAM
|
||||
WSContentSend_P(HTTP_HEAD, Settings.friendlyname[0], ctitle);
|
||||
@ -710,7 +710,7 @@ void WSContentSendStyle_P(const char* style)
|
||||
}
|
||||
WSContentSend_P(HTTP_HEAD_STYLE1);
|
||||
WSContentSend_P(HTTP_HEAD_STYLE2);
|
||||
if (style != NULL) {
|
||||
if (style != nullptr) {
|
||||
WSContentSend_P(style);
|
||||
}
|
||||
WSContentSend_P(HTTP_HEAD_STYLE3, ModuleName().c_str(), Settings.friendlyname[0]);
|
||||
@ -729,7 +729,7 @@ void WSContentSendStyle_P(const char* style)
|
||||
|
||||
void WSContentSendStyle(void)
|
||||
{
|
||||
WSContentSendStyle_P(NULL);
|
||||
WSContentSendStyle_P(nullptr);
|
||||
}
|
||||
|
||||
void WSContentButton(uint8_t title_index)
|
||||
@ -1359,7 +1359,7 @@ void WifiSaveSettings(void)
|
||||
|
||||
WebGetArg("h", tmp, sizeof(tmp));
|
||||
strlcpy(Settings.hostname, (!strlen(tmp)) ? WIFI_HOSTNAME : tmp, sizeof(Settings.hostname));
|
||||
if (strstr(Settings.hostname,"%")) {
|
||||
if (strstr(Settings.hostname, "%") != nullptr) {
|
||||
strlcpy(Settings.hostname, WIFI_HOSTNAME, sizeof(Settings.hostname));
|
||||
}
|
||||
WebGetArg("s1", tmp, sizeof(tmp));
|
||||
@ -1885,10 +1885,10 @@ void HandleUploadLoop(void)
|
||||
}
|
||||
#ifdef USE_RF_FLASH
|
||||
else if (UPL_EFM8BB1 == upload_file_type) {
|
||||
if (efm8bb1_update != NULL) { // We have carry over data since last write, i. e. a start but not an end
|
||||
if (efm8bb1_update != nullptr) { // We have carry over data since last write, i. e. a start but not an end
|
||||
ssize_t result = rf_glue_remnant_with_new_data_and_write(efm8bb1_update, upload.buf, upload.currentSize);
|
||||
free(efm8bb1_update);
|
||||
efm8bb1_update = NULL;
|
||||
efm8bb1_update = nullptr;
|
||||
if (result != 0) {
|
||||
upload_error = abs(result); // 2 = Not enough space, 8 = File invalid
|
||||
return;
|
||||
@ -1907,7 +1907,7 @@ void HandleUploadLoop(void)
|
||||
// A remnant has been detected, allocate data for it plus a null termination byte
|
||||
size_t remnant_sz = upload.currentSize - result;
|
||||
efm8bb1_update = (uint8_t *) malloc(remnant_sz + 1);
|
||||
if (efm8bb1_update == NULL) {
|
||||
if (efm8bb1_update == nullptr) {
|
||||
upload_error = 2; // Not enough space - Unable to allocate memory to store new RF firmware
|
||||
return;
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ void MqttConnected(void)
|
||||
|
||||
GetTopic_P(stopic, CMND, mqtt_topic, PSTR("#"));
|
||||
MqttSubscribe(stopic);
|
||||
if (strstr(Settings.mqtt_fulltopic, MQTT_TOKEN_TOPIC) != NULL) {
|
||||
if (strstr(Settings.mqtt_fulltopic, MQTT_TOKEN_TOPIC) != nullptr) {
|
||||
GetTopic_P(stopic, CMND, Settings.mqtt_grptopic, PSTR("#"));
|
||||
MqttSubscribe(stopic);
|
||||
GetFallbackTopic_P(stopic, CMND, PSTR("#"));
|
||||
@ -431,8 +431,8 @@ void MqttReconnect(void)
|
||||
mqtt_retry_counter = Settings.mqtt_retry;
|
||||
global_state.mqtt_down = 1;
|
||||
|
||||
char *mqtt_user = NULL;
|
||||
char *mqtt_pwd = NULL;
|
||||
char *mqtt_user = nullptr;
|
||||
char *mqtt_pwd = nullptr;
|
||||
if (strlen(Settings.mqtt_user) > 0) mqtt_user = Settings.mqtt_user;
|
||||
if (strlen(Settings.mqtt_pwd) > 0) mqtt_pwd = Settings.mqtt_pwd;
|
||||
|
||||
@ -607,7 +607,7 @@ bool MqttCommand(void)
|
||||
char *mqtt_part = strtok(dataBuf, " ");
|
||||
if (mqtt_part) {
|
||||
strlcpy(stemp1, mqtt_part, sizeof(stemp1));
|
||||
mqtt_part = strtok(NULL, " ");
|
||||
mqtt_part = strtok(nullptr, " ");
|
||||
if (mqtt_part) {
|
||||
strlcpy(mqtt_data, mqtt_part, sizeof(mqtt_data));
|
||||
} else {
|
||||
|
@ -1231,9 +1231,9 @@ bool LightColorEntry(char *buffer, uint8_t buffer_length)
|
||||
}
|
||||
|
||||
memset(&light_entry_color, 0x00, sizeof(light_entry_color));
|
||||
if (strstr(buffer, ",")) { // Decimal entry
|
||||
if (strstr(buffer, ",") != nullptr) { // Decimal entry
|
||||
int8_t i = 0;
|
||||
for (str = strtok_r(buffer, ",", &p); str && i < 6; str = strtok_r(NULL, ",", &p)) {
|
||||
for (str = strtok_r(buffer, ",", &p); str && i < 6; str = strtok_r(nullptr, ",", &p)) {
|
||||
if (i < 5) {
|
||||
light_entry_color[i++] = atoi(str);
|
||||
}
|
||||
@ -1345,16 +1345,16 @@ bool LightCommand(void)
|
||||
bool validHSB = (XdrvMailbox.data_len > 0);
|
||||
if (validHSB) {
|
||||
uint16_t HSB[3];
|
||||
if (strstr(XdrvMailbox.data, ",")) { // Command with 3 comma separated parameters, Hue (0<H<360), Saturation (0<S<100) AND Brightness (0<B<100)
|
||||
if (strstr(XdrvMailbox.data, ",") != nullptr) { // Command with 3 comma separated parameters, Hue (0<H<360), Saturation (0<S<100) AND Brightness (0<B<100)
|
||||
for (int i = 0; i < 3; i++) {
|
||||
char *substr;
|
||||
|
||||
if (0 == i) {
|
||||
substr = strtok(XdrvMailbox.data, ",");
|
||||
} else {
|
||||
substr = strtok(NULL, ",");
|
||||
substr = strtok(nullptr, ",");
|
||||
}
|
||||
if (substr != NULL) {
|
||||
if (substr != nullptr) {
|
||||
HSB[i] = atoi(substr);
|
||||
} else {
|
||||
validHSB = false;
|
||||
@ -1392,7 +1392,7 @@ bool LightCommand(void)
|
||||
char *p;
|
||||
uint16_t idx = XdrvMailbox.index;
|
||||
Ws2812ForceSuspend();
|
||||
for (char *color = strtok_r(XdrvMailbox.data, " ", &p); color; color = strtok_r(NULL, " ", &p)) {
|
||||
for (char *color = strtok_r(XdrvMailbox.data, " ", &p); color; color = strtok_r(nullptr, " ", &p)) {
|
||||
if (LightColorEntry(color, strlen(color))) {
|
||||
Ws2812SetColor(idx, light_entry_color[0], light_entry_color[1], light_entry_color[2], light_entry_color[3]);
|
||||
idx++;
|
||||
@ -1515,16 +1515,16 @@ bool LightCommand(void)
|
||||
bool validtable = (XdrvMailbox.data_len > 0);
|
||||
char scolor[25];
|
||||
if (validtable) {
|
||||
if (strstr(XdrvMailbox.data, ",")) { // Command with up to 5 comma separated parameters
|
||||
if (strstr(XdrvMailbox.data, ",") != nullptr) { // Command with up to 5 comma separated parameters
|
||||
for (int i = 0; i < LST_RGBWC; i++) {
|
||||
char *substr;
|
||||
|
||||
if (0 == i) {
|
||||
substr = strtok(XdrvMailbox.data, ",");
|
||||
} else {
|
||||
substr = strtok(NULL, ",");
|
||||
substr = strtok(nullptr, ",");
|
||||
}
|
||||
if (substr != NULL) {
|
||||
if (substr != nullptr) {
|
||||
Settings.rgbwwTable[i] = atoi(substr);
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ const char kIrHvacVendors[] PROGMEM = "Toshiba|Mitsubishi|LG|Fujitsu" ;
|
||||
// HVAC LG
|
||||
#define HVAC_LG_DATALEN 7
|
||||
|
||||
IRMitsubishiAC *mitsubir = NULL;
|
||||
IRMitsubishiAC *mitsubir = nullptr;
|
||||
|
||||
const char kFanSpeedOptions[] = "A12345S";
|
||||
const char kHvacModeOptions[] = "HDCA";
|
||||
@ -66,7 +66,7 @@ const char kHvacModeOptions[] = "HDCA";
|
||||
|
||||
#include <IRsend.h>
|
||||
|
||||
IRsend *irsend = NULL;
|
||||
IRsend *irsend = nullptr;
|
||||
bool irsend_active = false;
|
||||
|
||||
void IrSendInit(void)
|
||||
@ -90,7 +90,7 @@ void IrSendInit(void)
|
||||
|
||||
#include <IRrecv.h>
|
||||
|
||||
IRrecv *irrecv = NULL;
|
||||
IRrecv *irrecv = nullptr;
|
||||
|
||||
unsigned long ir_lasttime = 0;
|
||||
|
||||
@ -189,7 +189,7 @@ bool IrHvacToshiba(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Po
|
||||
char *p;
|
||||
uint8_t mode;
|
||||
|
||||
if (HVAC_Mode == NULL) {
|
||||
if (HVAC_Mode == nullptr) {
|
||||
p = (char *)kHvacModeOptions; // default HVAC_HOT
|
||||
}
|
||||
else {
|
||||
@ -204,7 +204,7 @@ bool IrHvacToshiba(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Po
|
||||
data[6] = (uint8_t)0x07; // Turn OFF HVAC
|
||||
}
|
||||
|
||||
if (HVAC_FanMode == NULL) {
|
||||
if (HVAC_FanMode == nullptr) {
|
||||
p = (char *)kFanSpeedOptions; // default FAN_SPEED_AUTO
|
||||
}
|
||||
else {
|
||||
@ -283,7 +283,7 @@ bool IrHvacMitsubishi(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC
|
||||
|
||||
mitsubir->stateReset();
|
||||
|
||||
if (HVAC_Mode == NULL) {
|
||||
if (HVAC_Mode == nullptr) {
|
||||
p = (char *)kHvacModeOptions; // default HVAC_HOT
|
||||
}
|
||||
else {
|
||||
@ -297,7 +297,7 @@ bool IrHvacMitsubishi(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC
|
||||
|
||||
mitsubir->setPower(HVAC_Power);
|
||||
|
||||
if (HVAC_FanMode == NULL) {
|
||||
if (HVAC_FanMode == nullptr) {
|
||||
p = (char *)kFanSpeedOptions; // default FAN_SPEED_AUTO
|
||||
}
|
||||
else {
|
||||
@ -350,7 +350,7 @@ bool IrHvacLG(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power,
|
||||
else {
|
||||
|
||||
// Set code for HVAC Mode - data[3]
|
||||
if (HVAC_Mode == NULL) {
|
||||
if (HVAC_Mode == nullptr) {
|
||||
p = (char *)kHvacModeOptions; // default HVAC_HOT
|
||||
}
|
||||
else {
|
||||
@ -394,7 +394,7 @@ bool IrHvacLG(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power,
|
||||
data[4] = (uint8_t)(Temp - 15);
|
||||
|
||||
// Set code for HVAC fan mode - data[5]
|
||||
if (HVAC_FanMode == NULL) {
|
||||
if (HVAC_FanMode == nullptr) {
|
||||
p = (char *)kFanSpeedOptions; // default FAN_SPEED_AUTO
|
||||
}
|
||||
else {
|
||||
@ -462,7 +462,7 @@ bool IrHvacFujitsu(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Po
|
||||
ac.setSwing(FUJITSU_AC_SWING_VERT);
|
||||
|
||||
char *p;
|
||||
if (NULL == HVAC_Mode) {
|
||||
if (nullptr == HVAC_Mode) {
|
||||
p = (char *)kFujitsuHvacModeOptions;
|
||||
}
|
||||
else {
|
||||
@ -473,7 +473,7 @@ bool IrHvacFujitsu(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Po
|
||||
}
|
||||
ac.setMode(modes[p - kFujitsuHvacModeOptions]);
|
||||
|
||||
if (HVAC_FanMode == NULL) {
|
||||
if (HVAC_FanMode == nullptr) {
|
||||
p = (char *)kFanSpeedOptions; // default FAN_SPEED_AUTO
|
||||
}
|
||||
else {
|
||||
@ -518,7 +518,7 @@ bool IrSendCommand(void)
|
||||
if (XdrvMailbox.data_len) {
|
||||
Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE);
|
||||
|
||||
if (!strstr(XdrvMailbox.data, "{")) { // If no JSON it must be rawdata
|
||||
if (strstr(XdrvMailbox.data, "{") == nullptr) { // If no JSON it must be rawdata
|
||||
// IRSend frequency, rawdata, rawdata ...
|
||||
char *p;
|
||||
char *str = strtok_r(XdrvMailbox.data, ", ", &p);
|
||||
@ -531,8 +531,8 @@ bool IrSendCommand(void)
|
||||
count++;
|
||||
uint16_t raw_array[count]; // It's safe to use stack for up to 240 packets (limited by mqtt_data length)
|
||||
uint8_t i = 0;
|
||||
for (str = strtok_r(NULL, ", ", &p); str && i < count; str = strtok_r(NULL, ", ", &p)) {
|
||||
raw_array[i++] = strtoul(str, NULL, 0); // Allow decimal (5246996) and hexadecimal (0x501014) input
|
||||
for (str = strtok_r(nullptr, ", ", &p); str && i < count; str = strtok_r(nullptr, ", ", &p)) {
|
||||
raw_array[i++] = strtoul(str, nullptr, 0); // Allow decimal (5246996) and hexadecimal (0x501014) input
|
||||
}
|
||||
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRS: Count %d, Freq %d, Arr[0] %d, Arr[count -1] %d"), count, freq, raw_array[0], raw_array[count -1]);
|
||||
@ -560,7 +560,7 @@ bool IrSendCommand(void)
|
||||
char parm_uc[10];
|
||||
const char *protocol = root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_PROTOCOL))];
|
||||
uint32_t bits = root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_BITS))];
|
||||
uint32_t data = strtoul(root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_DATA))], NULL, 0);
|
||||
uint32_t data = strtoul(root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_DATA))], nullptr, 0);
|
||||
if (protocol && bits) {
|
||||
char protocol_text[20];
|
||||
int protocol_code = GetCommandCode(protocol_text, sizeof(protocol_text), protocol, kIrRemoteProtocols);
|
||||
|
@ -98,7 +98,7 @@ ssize_t rf_glue_remnant_with_new_data_and_write(const uint8_t *remnant_data, uin
|
||||
glue_record_sz = strlen((const char *) remnant_data) + record_end;
|
||||
|
||||
glue_buf = (uint8_t *) malloc(glue_record_sz);
|
||||
if (glue_buf == NULL) { return -2; } // Not enough space
|
||||
if (glue_buf == nullptr) { return -2; } // Not enough space
|
||||
|
||||
// Assemble new glue buffer
|
||||
memcpy(glue_buf, remnant_data, strlen((const char *) remnant_data));
|
||||
|
@ -31,10 +31,10 @@
|
||||
enum SerialBridgeCommands { CMND_SSERIALSEND, CMND_SBAUDRATE };
|
||||
const char kSerialBridgeCommands[] PROGMEM = D_CMND_SSERIALSEND "|" D_CMND_SBAUDRATE;
|
||||
|
||||
TasmotaSerial *SerialBridgeSerial = NULL;
|
||||
TasmotaSerial *SerialBridgeSerial = nullptr;
|
||||
|
||||
unsigned long serial_bridge_polling_window = 0;
|
||||
char *serial_bridge_buffer = NULL;
|
||||
char *serial_bridge_buffer = nullptr;
|
||||
int serial_bridge_in_byte_counter = 0;
|
||||
bool serial_bridge_active = true;
|
||||
bool serial_bridge_raw = false;
|
||||
|
@ -387,7 +387,7 @@ bool TimerCommand(void)
|
||||
|
||||
strlcpy(time_str, root[parm_uc], sizeof(time_str));
|
||||
const char *substr = strtok(time_str, ":");
|
||||
if (substr != NULL) {
|
||||
if (substr != nullptr) {
|
||||
if (strchr(substr, '-')) {
|
||||
sign = 1;
|
||||
substr++;
|
||||
@ -396,8 +396,8 @@ bool TimerCommand(void)
|
||||
if (sign) { value += 12; } // Allow entering timer offset from -11:59 to -00:01 converted to 12:01 to 23:59
|
||||
if (value > 23) { value = 23; }
|
||||
itime = value * 60;
|
||||
substr = strtok(NULL, ":");
|
||||
if (substr != NULL) {
|
||||
substr = strtok(nullptr, ":");
|
||||
if (substr != nullptr) {
|
||||
value = atoi(substr);
|
||||
if (value < 0) { value = 0; }
|
||||
if (value > 59) { value = 59; }
|
||||
|
@ -672,10 +672,10 @@ String RulesSubscribe(const char *data, int data_len)
|
||||
char * pos = strtok(parameters, ",");
|
||||
if (pos) {
|
||||
event_name = Trim(pos);
|
||||
pos = strtok(NULL, ",");
|
||||
pos = strtok(nullptr, ",");
|
||||
if (pos) {
|
||||
topic = Trim(pos);
|
||||
pos = strtok(NULL, ",");
|
||||
pos = strtok(nullptr, ",");
|
||||
if (pos) {
|
||||
key = Trim(pos);
|
||||
}
|
||||
@ -1203,7 +1203,7 @@ bool RulesCommand(void)
|
||||
}
|
||||
else if ((CMND_SCALE == command_code) && (index > 0) && (index <= MAX_RULE_VARS)) {
|
||||
if (XdrvMailbox.data_len > 0) {
|
||||
if (strstr(XdrvMailbox.data, ",")) { // Process parameter entry
|
||||
if (strstr(XdrvMailbox.data, ",") != nullptr) { // Process parameter entry
|
||||
char sub_string[XdrvMailbox.data_len +1];
|
||||
|
||||
double valueIN = CharToDouble(subStr(sub_string, XdrvMailbox.data, ",", 1));
|
||||
|
@ -1086,7 +1086,7 @@ bool KnxCommand(void)
|
||||
|
||||
else if (CMND_KNX_PA == command_code) {
|
||||
if (XdrvMailbox.data_len) {
|
||||
if (strstr(XdrvMailbox.data, ".")) { // Process parameter entry
|
||||
if (strstr(XdrvMailbox.data, ".") != nullptr) { // Process parameter entry
|
||||
char sub_string[XdrvMailbox.data_len];
|
||||
|
||||
int pa_area = atoi(subStr(sub_string, XdrvMailbox.data, ".", 1));
|
||||
@ -1113,7 +1113,7 @@ bool KnxCommand(void)
|
||||
|
||||
else if ((CMND_KNX_GA == command_code) && (index > 0) && (index <= MAX_KNX_GA)) {
|
||||
if (XdrvMailbox.data_len) {
|
||||
if (strstr(XdrvMailbox.data, ",")) { // Process parameter entry
|
||||
if (strstr(XdrvMailbox.data, ",") != nullptr) { // Process parameter entry
|
||||
char sub_string[XdrvMailbox.data_len];
|
||||
|
||||
int ga_option = atoi(subStr(sub_string, XdrvMailbox.data, ",", 1));
|
||||
@ -1162,7 +1162,7 @@ bool KnxCommand(void)
|
||||
|
||||
else if ((CMND_KNX_CB == command_code) && (index > 0) && (index <= MAX_KNX_CB)) {
|
||||
if (XdrvMailbox.data_len) {
|
||||
if (strstr(XdrvMailbox.data, ",")) { // Process parameter entry
|
||||
if (strstr(XdrvMailbox.data, ",") != nullptr) { // Process parameter entry
|
||||
char sub_string[XdrvMailbox.data_len];
|
||||
|
||||
int cb_option = atoi(subStr(sub_string, XdrvMailbox.data, ",", 1));
|
||||
|
@ -503,9 +503,9 @@ void DisplayClearScreenBuffer(void)
|
||||
|
||||
void DisplayFreeScreenBuffer(void)
|
||||
{
|
||||
if (disp_screen_buffer != NULL) {
|
||||
if (disp_screen_buffer != nullptr) {
|
||||
for (uint8_t i = 0; i < disp_screen_buffer_rows; i++) {
|
||||
if (disp_screen_buffer[i] != NULL) { free(disp_screen_buffer[i]); }
|
||||
if (disp_screen_buffer[i] != nullptr) { free(disp_screen_buffer[i]); }
|
||||
}
|
||||
free(disp_screen_buffer);
|
||||
disp_screen_buffer_cols = 0;
|
||||
@ -518,16 +518,16 @@ void DisplayAllocScreenBuffer(void)
|
||||
if (!disp_screen_buffer_cols) {
|
||||
disp_screen_buffer_rows = Settings.display_rows;
|
||||
disp_screen_buffer = (char**)malloc(sizeof(*disp_screen_buffer) * disp_screen_buffer_rows);
|
||||
if (disp_screen_buffer != NULL) {
|
||||
if (disp_screen_buffer != nullptr) {
|
||||
for (uint8_t i = 0; i < disp_screen_buffer_rows; i++) {
|
||||
disp_screen_buffer[i] = (char*)malloc(sizeof(*disp_screen_buffer[i]) * (Settings.display_cols[0] +1));
|
||||
if (disp_screen_buffer[i] == NULL) {
|
||||
if (disp_screen_buffer[i] == nullptr) {
|
||||
DisplayFreeScreenBuffer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (disp_screen_buffer != NULL) {
|
||||
if (disp_screen_buffer != nullptr) {
|
||||
disp_screen_buffer_cols = Settings.display_cols[0] +1;
|
||||
DisplayClearScreenBuffer();
|
||||
}
|
||||
@ -562,9 +562,9 @@ void DisplayClearLogBuffer(void)
|
||||
|
||||
void DisplayFreeLogBuffer(void)
|
||||
{
|
||||
if (disp_log_buffer != NULL) {
|
||||
if (disp_log_buffer != nullptr) {
|
||||
for (uint8_t i = 0; i < DISPLAY_LOG_ROWS; i++) {
|
||||
if (disp_log_buffer[i] != NULL) { free(disp_log_buffer[i]); }
|
||||
if (disp_log_buffer[i] != nullptr) { free(disp_log_buffer[i]); }
|
||||
}
|
||||
free(disp_log_buffer);
|
||||
disp_log_buffer_cols = 0;
|
||||
@ -575,16 +575,16 @@ void DisplayAllocLogBuffer(void)
|
||||
{
|
||||
if (!disp_log_buffer_cols) {
|
||||
disp_log_buffer = (char**)malloc(sizeof(*disp_log_buffer) * DISPLAY_LOG_ROWS);
|
||||
if (disp_log_buffer != NULL) {
|
||||
if (disp_log_buffer != nullptr) {
|
||||
for (uint8_t i = 0; i < DISPLAY_LOG_ROWS; i++) {
|
||||
disp_log_buffer[i] = (char*)malloc(sizeof(*disp_log_buffer[i]) * (Settings.display_cols[0] +1));
|
||||
if (disp_log_buffer[i] == NULL) {
|
||||
if (disp_log_buffer[i] == nullptr) {
|
||||
DisplayFreeLogBuffer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (disp_log_buffer != NULL) {
|
||||
if (disp_log_buffer != nullptr) {
|
||||
disp_log_buffer_cols = Settings.display_cols[0] +1;
|
||||
DisplayClearLogBuffer();
|
||||
}
|
||||
@ -608,7 +608,7 @@ void DisplayLogBufferAdd(char* txt)
|
||||
|
||||
char* DisplayLogBuffer(char temp_code)
|
||||
{
|
||||
char* result = NULL;
|
||||
char* result = nullptr;
|
||||
if (disp_log_buffer_cols) {
|
||||
if (disp_log_buffer_idx != disp_log_buffer_ptr) {
|
||||
result = disp_log_buffer[disp_log_buffer_ptr];
|
||||
@ -616,7 +616,7 @@ char* DisplayLogBuffer(char temp_code)
|
||||
if (DISPLAY_LOG_ROWS == disp_log_buffer_ptr) { disp_log_buffer_ptr = 0; }
|
||||
|
||||
char *pch = strchr(result, '~'); // = 0x7E (~) Replace degrees character (276 octal)
|
||||
if (pch != NULL) { result[pch - result] = temp_code; }
|
||||
if (pch != nullptr) { result[pch - result] = temp_code; }
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -829,12 +829,12 @@ void DisplayMqttSubscribe(void)
|
||||
ntopic[0] = '\0';
|
||||
strlcpy(stopic, Settings.mqtt_fulltopic, sizeof(stopic));
|
||||
char *tp = strtok(stopic, "/");
|
||||
while (tp != NULL) {
|
||||
while (tp != nullptr) {
|
||||
if (!strcmp_P(tp, PSTR(MQTT_TOKEN_PREFIX))) {
|
||||
break;
|
||||
}
|
||||
strncat_P(ntopic, PSTR("+/"), sizeof(ntopic) - strlen(ntopic) -1); // Add single-level wildcards
|
||||
tp = strtok(NULL, "/");
|
||||
tp = strtok(nullptr, "/");
|
||||
}
|
||||
strncat(ntopic, Settings.mqtt_prefix[2], sizeof(ntopic) - strlen(ntopic) -1); // Subscribe to tele messages
|
||||
strncat_P(ntopic, PSTR("/#"), sizeof(ntopic) - strlen(ntopic) -1); // Add multi-level wildcard
|
||||
|
@ -53,7 +53,7 @@ uint8_t tuya_cmd_checksum = 0; // Checksum of tuya command
|
||||
uint8_t tuya_data_len = 0; // Data lenght of command
|
||||
int8_t tuya_wifi_state = -2; // Keep MCU wifi-status in sync with WifiState()
|
||||
|
||||
char *tuya_buffer = NULL; // Serial receive buffer
|
||||
char *tuya_buffer = nullptr; // Serial receive buffer
|
||||
int tuya_byte_counter = 0; // Index in serial receive buffer
|
||||
|
||||
/*********************************************************************************************\
|
||||
@ -284,7 +284,7 @@ void TuyaInit(void)
|
||||
Settings.param[P_TUYA_DIMMER_ID] = TUYA_DIMMER_ID;
|
||||
}
|
||||
tuya_buffer = (char*)(malloc(TUYA_BUFFER_SIZE));
|
||||
if (tuya_buffer != NULL) {
|
||||
if (tuya_buffer != nullptr) {
|
||||
TuyaSerial = new TasmotaSerial(pin[GPIO_TUYA_RX], pin[GPIO_TUYA_TX], 2);
|
||||
if (TuyaSerial->begin(9600)) {
|
||||
if (TuyaSerial->hardwareSerial()) { ClaimSerial(); }
|
||||
|
@ -107,7 +107,7 @@ bool RfSendCommand(void)
|
||||
if (root.success()) {
|
||||
// RFsend {"data":0x501014,"bits":24,"protocol":1,"repeat":10,"pulse":350}
|
||||
char parm_uc[10];
|
||||
data = strtoul(root[UpperCase_P(parm_uc, PSTR(D_JSON_RF_DATA))], NULL, 0); // Allow decimal (5246996) and hexadecimal (0x501014) input
|
||||
data = strtoul(root[UpperCase_P(parm_uc, PSTR(D_JSON_RF_DATA))], nullptr, 0); // Allow decimal (5246996) and hexadecimal (0x501014) input
|
||||
bits = root[UpperCase_P(parm_uc, PSTR(D_JSON_RF_BITS))];
|
||||
protocol = root[UpperCase_P(parm_uc, PSTR(D_JSON_RF_PROTOCOL))];
|
||||
repeat = root[UpperCase_P(parm_uc, PSTR(D_JSON_RF_REPEAT))];
|
||||
@ -116,10 +116,10 @@ bool RfSendCommand(void)
|
||||
// RFsend data, bits, protocol, repeat, pulse
|
||||
char *p;
|
||||
uint8_t i = 0;
|
||||
for (char *str = strtok_r(XdrvMailbox.data, ", ", &p); str && i < 5; str = strtok_r(NULL, ", ", &p)) {
|
||||
for (char *str = strtok_r(XdrvMailbox.data, ", ", &p); str && i < 5; str = strtok_r(nullptr, ", ", &p)) {
|
||||
switch (i++) {
|
||||
case 0:
|
||||
data = strtoul(str, NULL, 0); // Allow decimal (5246996) and hexadecimal (0x501014) input
|
||||
data = strtoul(str, nullptr, 0); // Allow decimal (5246996) and hexadecimal (0x501014) input
|
||||
break;
|
||||
case 1:
|
||||
bits = atoi(str);
|
||||
|
@ -35,8 +35,8 @@ bool ps16dz_ignore_dim = false; // Flag to skip serial send to preven
|
||||
|
||||
//uint64_t ps16dz_seq = 0;
|
||||
|
||||
char *ps16dz_tx_buffer = NULL; // Serial transmit buffer
|
||||
char *ps16dz_rx_buffer = NULL; // Serial receive buffer
|
||||
char *ps16dz_tx_buffer = nullptr; // Serial transmit buffer
|
||||
char *ps16dz_rx_buffer = nullptr; // Serial receive buffer
|
||||
int ps16dz_byte_counter = 0;
|
||||
|
||||
/*********************************************************************************************\
|
||||
@ -135,9 +135,9 @@ bool PS16DZModuleSelected(void)
|
||||
void PS16DZInit(void)
|
||||
{
|
||||
ps16dz_tx_buffer = (char*)(malloc(PS16DZ_BUFFER_SIZE));
|
||||
if (ps16dz_tx_buffer != NULL) {
|
||||
if (ps16dz_tx_buffer != nullptr) {
|
||||
ps16dz_rx_buffer = (char*)(malloc(PS16DZ_BUFFER_SIZE));
|
||||
if (ps16dz_rx_buffer != NULL) {
|
||||
if (ps16dz_rx_buffer != nullptr) {
|
||||
PS16DZSerial = new TasmotaSerial(pin[GPIO_RXD], pin[GPIO_TXD], 2);
|
||||
if (PS16DZSerial->begin(19200)) {
|
||||
if (PS16DZSerial->hardwareSerial()) { ClaimSerial(); }
|
||||
@ -168,10 +168,10 @@ void PS16DZSerialInput(void)
|
||||
char *end_str;
|
||||
char *string = ps16dz_rx_buffer+10;
|
||||
char* token = strtok_r(string, ",", &end_str);
|
||||
while (token != NULL) {
|
||||
while (token != nullptr) {
|
||||
char* end_token;
|
||||
char* token2 = strtok_r(token, ":", &end_token);
|
||||
char* token3 = strtok_r(NULL, ":", &end_token);
|
||||
char* token3 = strtok_r(nullptr, ":", &end_token);
|
||||
if(!strncmp(token2, "\"switch\"", 8)){
|
||||
bool ps16dz_power = !strncmp(token3, "\"on\"", 4)?true:false;
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: power received: %s"), token3);
|
||||
@ -193,10 +193,10 @@ void PS16DZSerialInput(void)
|
||||
}
|
||||
}
|
||||
else if(!strncmp(token2, "\"sequence\"", 10)){
|
||||
//ps16dz_seq = strtoull(token3+1, NULL, 10);
|
||||
//ps16dz_seq = strtoull(token3+1, nullptr, 10);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: sequence received: %s"), token3);
|
||||
}
|
||||
token = strtok_r(NULL, ",", &end_str);
|
||||
token = strtok_r(nullptr, ",", &end_str);
|
||||
}
|
||||
}
|
||||
else if(!strncmp(ps16dz_rx_buffer+3, "SETTING", 7)) {
|
||||
|
@ -127,7 +127,7 @@ bool LcdPrintLog(void)
|
||||
if (!disp_screen_buffer_cols) { DisplayAllocScreenBuffer(); }
|
||||
|
||||
char* txt = DisplayLogBuffer('\337');
|
||||
if (txt != NULL) {
|
||||
if (txt != nullptr) {
|
||||
uint8_t last_row = Settings.display_rows -1;
|
||||
|
||||
for (uint8_t i = 0; i < last_row; i++) {
|
||||
|
@ -141,7 +141,7 @@ void Ssd1306PrintLog(void)
|
||||
if (!disp_screen_buffer_cols) { DisplayAllocScreenBuffer(); }
|
||||
|
||||
char* txt = DisplayLogBuffer('\370');
|
||||
if (txt != NULL) {
|
||||
if (txt != nullptr) {
|
||||
uint8_t last_row = Settings.display_rows -1;
|
||||
|
||||
oled->clearDisplay();
|
||||
|
@ -37,7 +37,7 @@ int16_t mtx_x = 0;
|
||||
int16_t mtx_y = 0;
|
||||
|
||||
//char mtx_buffer[MTX_MAX_SCREEN_BUFFER];
|
||||
char *mtx_buffer = NULL;
|
||||
char *mtx_buffer = nullptr;
|
||||
|
||||
uint8_t mtx_mode = 0;
|
||||
uint8_t mtx_loop = 0;
|
||||
@ -140,9 +140,9 @@ void MatrixScrollUp(char* txt, int loop)
|
||||
disp_refresh = Settings.display_refresh;
|
||||
strlcpy(tmpbuf, txt, sizeof(tmpbuf));
|
||||
char *p = strtok(tmpbuf, separators);
|
||||
while (p != NULL && wordcounter < 40) {
|
||||
while (p != nullptr && wordcounter < 40) {
|
||||
words[wordcounter++] = p;
|
||||
p = strtok(NULL, separators);
|
||||
p = strtok(nullptr, separators);
|
||||
}
|
||||
for (uint8_t i = 0; i < mtx_matrices; i++) {
|
||||
matrix[i]->clear();
|
||||
@ -196,7 +196,7 @@ void MatrixInit(uint8_t mode)
|
||||
void MatrixInitDriver(void)
|
||||
{
|
||||
mtx_buffer = (char*)(malloc(MTX_MAX_SCREEN_BUFFER));
|
||||
if (mtx_buffer != NULL) {
|
||||
if (mtx_buffer != nullptr) {
|
||||
if (!Settings.display_model) {
|
||||
if (I2cDevice(Settings.display_address[1])) {
|
||||
Settings.display_model = XDSP_03;
|
||||
@ -239,7 +239,7 @@ void MatrixDrawStringAt(uint16_t x, uint16_t y, char *str, uint16_t color, uint8
|
||||
void MatrixPrintLog(uint8_t direction)
|
||||
{
|
||||
char* txt = (!mtx_done) ? DisplayLogBuffer('\370') : mtx_buffer;
|
||||
if (txt != NULL) {
|
||||
if (txt != nullptr) {
|
||||
if (!mtx_state) { mtx_state = 1; }
|
||||
|
||||
if (!mtx_done) {
|
||||
|
@ -147,7 +147,7 @@ void Ili9341PrintLog(void)
|
||||
}
|
||||
|
||||
char* txt = DisplayLogBuffer('\370');
|
||||
if (txt != NULL) {
|
||||
if (txt != nullptr) {
|
||||
uint8_t size = Settings.display_size;
|
||||
uint16_t theight = size * TFT_FONT_HEIGTH;
|
||||
|
||||
|
@ -200,7 +200,7 @@ void EpdPrintLog(void)
|
||||
}
|
||||
|
||||
char* txt = DisplayLogBuffer('\040');
|
||||
if (txt != NULL) {
|
||||
if (txt != nullptr) {
|
||||
uint8_t size = Settings.display_size;
|
||||
uint16_t theight = size * EPD_FONT_HEIGTH;
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include <TasmotaSerial.h>
|
||||
|
||||
TasmotaSerial *PzemSerial = NULL;
|
||||
TasmotaSerial *PzemSerial = nullptr;
|
||||
|
||||
#define PZEM_VOLTAGE (uint8_t)0xB0
|
||||
#define RESP_VOLTAGE (uint8_t)0xA0
|
||||
|
@ -67,7 +67,7 @@
|
||||
#define MCP_BUFFER_SIZE 60
|
||||
|
||||
#include <TasmotaSerial.h>
|
||||
TasmotaSerial *McpSerial = NULL;
|
||||
TasmotaSerial *McpSerial = nullptr;
|
||||
|
||||
typedef struct mcp_cal_registers_type {
|
||||
uint16_t gain_current_rms;
|
||||
@ -92,7 +92,7 @@ typedef struct mcp_cal_registers_type {
|
||||
uint16_t accumulation_interval;
|
||||
} mcp_cal_registers_type;
|
||||
|
||||
char *mcp_buffer = NULL;
|
||||
char *mcp_buffer = nullptr;
|
||||
unsigned long mcp_window = 0;
|
||||
unsigned long mcp_kWhcounter = 0;
|
||||
uint32_t mcp_system_configuration = 0x03000000;
|
||||
|
@ -239,7 +239,7 @@ void PollUdp(void)
|
||||
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet (%d)"), len);
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), packet_buffer);
|
||||
|
||||
if (strstr_P(packet_buffer, PSTR("M-SEARCH"))) {
|
||||
if (strstr_P(packet_buffer, PSTR("M-SEARCH")) != nullptr) {
|
||||
udp_response_mutex = true;
|
||||
|
||||
udp_remote_ip = PortUdp.remoteIP();
|
||||
@ -253,21 +253,21 @@ void PollUdp(void)
|
||||
LowerCase(packet_buffer, packet_buffer);
|
||||
RemoveSpace(packet_buffer);
|
||||
if (EMUL_WEMO == Settings.flag2.emulation) {
|
||||
if (strstr_P(packet_buffer, URN_BELKIN_DEVICE)) { // type1 echo dot 2g, echo 1g's
|
||||
if (strstr_P(packet_buffer, URN_BELKIN_DEVICE) != nullptr) { // type1 echo dot 2g, echo 1g's
|
||||
TickerMSearch.attach_ms(response_delay, WemoRespondToMSearch, 1);
|
||||
return;
|
||||
}
|
||||
else if (strstr_P(packet_buffer, UPNP_ROOTDEVICE) || // type2 Echo 2g (echo & echo plus)
|
||||
strstr_P(packet_buffer, SSDPSEARCH_ALL) ||
|
||||
strstr_P(packet_buffer, SSDP_ALL)) {
|
||||
else if ((strstr_P(packet_buffer, UPNP_ROOTDEVICE) != nullptr) || // type2 Echo 2g (echo & echo plus)
|
||||
(strstr_P(packet_buffer, SSDPSEARCH_ALL) != nullptr) ||
|
||||
(strstr_P(packet_buffer, SSDP_ALL) != nullptr)) {
|
||||
TickerMSearch.attach_ms(response_delay, WemoRespondToMSearch, 2);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (strstr_P(packet_buffer, PSTR("urn:schemas-upnp-org:device:basic:1")) ||
|
||||
strstr_P(packet_buffer, UPNP_ROOTDEVICE) ||
|
||||
strstr_P(packet_buffer, SSDPSEARCH_ALL) ||
|
||||
strstr_P(packet_buffer, SSDP_ALL)) {
|
||||
if ((strstr_P(packet_buffer, PSTR("urn:schemas-upnp-org:device:basic:1")) != nullptr) ||
|
||||
(strstr_P(packet_buffer, UPNP_ROOTDEVICE) != nullptr) ||
|
||||
(strstr_P(packet_buffer, SSDPSEARCH_ALL) != nullptr) ||
|
||||
(strstr_P(packet_buffer, SSDP_ALL) != nullptr)) {
|
||||
TickerMSearch.attach_ms(response_delay, HueRespondToMSearch);
|
||||
return;
|
||||
}
|
||||
@ -402,13 +402,13 @@ void HandleUpnpEvent(void)
|
||||
|
||||
//differentiate get and set state
|
||||
char state = 'G';
|
||||
if (strstr_P(event, PSTR("SetBinaryState"))) {
|
||||
if (strstr_P(event, PSTR("SetBinaryState")) != nullptr) {
|
||||
state = 'S';
|
||||
uint8_t power = POWER_TOGGLE;
|
||||
if (strstr_P(event, PSTR("State>1</Binary"))) {
|
||||
if (strstr_P(event, PSTR("State>1</Binary")) != nullptr) {
|
||||
power = POWER_ON;
|
||||
}
|
||||
else if (strstr_P(event, PSTR("State>0</Binary"))) {
|
||||
else if (strstr_P(event, PSTR("State>0</Binary")) != nullptr) {
|
||||
power = POWER_OFF;
|
||||
}
|
||||
if (power != POWER_TOGGLE) {
|
||||
|
@ -44,7 +44,7 @@
|
||||
#else // USE_WS2812_DMA
|
||||
typedef NeoEsp8266BitBang800KbpsMethod selectedNeoSpeedType;
|
||||
#endif // USE_WS2812_DMA
|
||||
NeoPixelBus<selectedNeoFeatureType, selectedNeoSpeedType> *strip = NULL;
|
||||
NeoPixelBus<selectedNeoFeatureType, selectedNeoSpeedType> *strip = nullptr;
|
||||
|
||||
struct WsColor {
|
||||
uint8_t red, green, blue;
|
||||
|
@ -81,7 +81,7 @@ void SonoffScSerialInput(char *rcvstat)
|
||||
|
||||
if (!strncasecmp_P(rcvstat, PSTR("AT+UPDATE="), 10)) {
|
||||
int8_t i = -1;
|
||||
for (str = strtok_r(rcvstat, ":", &p); str && i < 5; str = strtok_r(NULL, ":", &p)) {
|
||||
for (str = strtok_r(rcvstat, ":", &p); str && i < 5; str = strtok_r(nullptr, ":", &p)) {
|
||||
value[i++] = atoi(str);
|
||||
}
|
||||
if (value[0] > 0) {
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#include <OneWire.h>
|
||||
|
||||
OneWire *ds = NULL;
|
||||
OneWire *ds = nullptr;
|
||||
|
||||
uint8_t ds18x20_address[DS18X20_MAX_SENSORS][8];
|
||||
uint8_t ds18x20_index[DS18X20_MAX_SENSORS];
|
||||
|
@ -61,7 +61,7 @@ uint8_t bmp_addresses[] = { BMP_ADDR1, BMP_ADDR2 };
|
||||
uint8_t bmp_count = 0;
|
||||
uint8_t bmp_once = 1;
|
||||
|
||||
bmp_sensors_t *bmp_sensors = NULL;
|
||||
bmp_sensors_t *bmp_sensors = nullptr;
|
||||
|
||||
/*********************************************************************************************\
|
||||
* BMP085 and BME180
|
||||
@ -99,7 +99,7 @@ typedef struct {
|
||||
uint16_t cal_ac6;
|
||||
} bmp180_cal_data_t;
|
||||
|
||||
bmp180_cal_data_t *bmp180_cal_data = NULL;
|
||||
bmp180_cal_data_t *bmp180_cal_data = nullptr;
|
||||
|
||||
bool Bmp180Calibration(uint8_t bmp_idx)
|
||||
{
|
||||
@ -244,7 +244,7 @@ typedef struct {
|
||||
int8_t dig_H6;
|
||||
} Bme280CalibrationData_t;
|
||||
|
||||
Bme280CalibrationData_t *Bme280CalibrationData = NULL;
|
||||
Bme280CalibrationData_t *Bme280CalibrationData = nullptr;
|
||||
|
||||
bool Bmx280Calibrate(uint8_t bmp_idx)
|
||||
{
|
||||
@ -344,7 +344,7 @@ void Bme280Read(uint8_t bmp_idx)
|
||||
|
||||
#include <bme680.h>
|
||||
|
||||
struct bme680_dev *gas_sensor = NULL;
|
||||
struct bme680_dev *gas_sensor = nullptr;
|
||||
|
||||
static void BmeDelayMs(uint32_t ms)
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ bool NovaSdsCommand(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint16_t sensor
|
||||
NovaSdsSerial->readBytes(&recbuf[1], 9);
|
||||
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, recbuf, sizeof(recbuf));
|
||||
|
||||
if ( NULL != buffer ) {
|
||||
if ( nullptr != buffer ) {
|
||||
// return data to buffer
|
||||
memcpy(buffer, recbuf, sizeof(recbuf));
|
||||
}
|
||||
@ -126,9 +126,9 @@ bool NovaSdsCommand(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint16_t sensor
|
||||
void NovaSdsSetWorkPeriod(void)
|
||||
{
|
||||
// set sensor working period
|
||||
NovaSdsCommand(NOVA_SDS_WORKING_PERIOD, NOVA_SDS_SET_MODE, WORKING_PERIOD, NOVA_SDS_DEVICE_ID, NULL);
|
||||
NovaSdsCommand(NOVA_SDS_WORKING_PERIOD, NOVA_SDS_SET_MODE, WORKING_PERIOD, NOVA_SDS_DEVICE_ID, nullptr);
|
||||
// set sensor report only on query
|
||||
NovaSdsCommand(NOVA_SDS_REPORTING_MODE, NOVA_SDS_SET_MODE, NOVA_SDS_REPORT_QUERY, NOVA_SDS_DEVICE_ID, NULL);
|
||||
NovaSdsCommand(NOVA_SDS_REPORTING_MODE, NOVA_SDS_SET_MODE, NOVA_SDS_REPORT_QUERY, NOVA_SDS_DEVICE_ID, nullptr);
|
||||
}
|
||||
|
||||
bool NovaSdsReadData(void)
|
||||
|
@ -34,7 +34,7 @@ uint8_t sr04_echo_pin = 0;
|
||||
uint8_t sr04_trig_pin = 0;
|
||||
real64_t distance;
|
||||
|
||||
NewPing* sonar = NULL;
|
||||
NewPing* sonar = nullptr;
|
||||
|
||||
void Sr04Init(void)
|
||||
{
|
||||
|
@ -165,8 +165,8 @@ bool HxCommand(void)
|
||||
Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_34, "Reset");
|
||||
break;
|
||||
case 2: // Calibrate
|
||||
if (strstr(XdrvMailbox.data, ",")) {
|
||||
Settings.weight_reference = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), NULL, 10);
|
||||
if (strstr(XdrvMailbox.data, ",") != nullptr) {
|
||||
Settings.weight_reference = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), nullptr, 10);
|
||||
}
|
||||
hx_scale = 1;
|
||||
HxReset();
|
||||
@ -175,26 +175,26 @@ bool HxCommand(void)
|
||||
HxCalibrationStateTextJson(3);
|
||||
break;
|
||||
case 3: // WeightRef to user reference
|
||||
if (strstr(XdrvMailbox.data, ",")) {
|
||||
Settings.weight_reference = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), NULL, 10);
|
||||
if (strstr(XdrvMailbox.data, ",") != nullptr) {
|
||||
Settings.weight_reference = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), nullptr, 10);
|
||||
}
|
||||
show_parms = true;
|
||||
break;
|
||||
case 4: // WeightCal to user calculated value
|
||||
if (strstr(XdrvMailbox.data, ",")) {
|
||||
Settings.weight_calibration = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), NULL, 10);
|
||||
if (strstr(XdrvMailbox.data, ",") != nullptr) {
|
||||
Settings.weight_calibration = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), nullptr, 10);
|
||||
hx_scale = Settings.weight_calibration;
|
||||
}
|
||||
show_parms = true;
|
||||
break;
|
||||
case 5: // WeightMax
|
||||
if (strstr(XdrvMailbox.data, ",")) {
|
||||
Settings.weight_max = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), NULL, 10) / 1000;
|
||||
if (strstr(XdrvMailbox.data, ",") != nullptr) {
|
||||
Settings.weight_max = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), nullptr, 10) / 1000;
|
||||
}
|
||||
show_parms = true;
|
||||
break;
|
||||
case 6: // WeightItem
|
||||
if (strstr(XdrvMailbox.data, ",")) {
|
||||
if (strstr(XdrvMailbox.data, ",") != nullptr) {
|
||||
Settings.weight_item = (unsigned long)(CharToDouble(subStr(sub_string, XdrvMailbox.data, ",", 2)) * 10);
|
||||
}
|
||||
show_parms = true;
|
||||
|
@ -56,7 +56,7 @@ typedef struct RawSignalStruct // Variabelen geplaatst in stru
|
||||
// Om legacy redenen zit de eerste puls in element 1. Element 0 wordt dus niet gebruikt.
|
||||
} raw_signal_t;
|
||||
|
||||
raw_signal_t *rfsns_raw_signal = NULL;
|
||||
raw_signal_t *rfsns_raw_signal = nullptr;
|
||||
uint8_t rfsns_rf_bit;
|
||||
uint8_t rfsns_rf_port;
|
||||
uint8_t rfsns_any_sensor = 0;
|
||||
@ -165,8 +165,8 @@ typedef struct {
|
||||
uint8_t volt;
|
||||
} theo_v2_t2_t;
|
||||
|
||||
theo_v2_t1_t *rfsns_theo_v2_t1 = NULL;
|
||||
theo_v2_t2_t *rfsns_theo_v2_t2 = NULL;
|
||||
theo_v2_t1_t *rfsns_theo_v2_t1 = nullptr;
|
||||
theo_v2_t2_t *rfsns_theo_v2_t2 = nullptr;
|
||||
|
||||
void RfSnsInitTheoV2(void)
|
||||
{
|
||||
@ -423,7 +423,7 @@ typedef struct {
|
||||
uint8_t wdir;
|
||||
} alecto_v2_t;
|
||||
|
||||
alecto_v2_t *rfsns_alecto_v2 = NULL;
|
||||
alecto_v2_t *rfsns_alecto_v2 = nullptr;
|
||||
uint16_t rfsns_alecto_rain_base = 0;
|
||||
|
||||
void RfSnsInitAlectoV2(void)
|
||||
@ -617,7 +617,7 @@ void RfSnsInit(void)
|
||||
pinMode(pin[GPIO_RF_SENSOR], INPUT);
|
||||
} else {
|
||||
free(rfsns_raw_signal);
|
||||
rfsns_raw_signal = NULL;
|
||||
rfsns_raw_signal = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user