diff --git a/lib/TasmotaModbus-1.1.0/src/TasmotaModbus.cpp b/lib/TasmotaModbus-1.1.0/src/TasmotaModbus.cpp index 0be2c9de3..207fc07f8 100644 --- a/lib/TasmotaModbus-1.1.0/src/TasmotaModbus.cpp +++ b/lib/TasmotaModbus-1.1.0/src/TasmotaModbus.cpp @@ -27,7 +27,6 @@ TasmotaModbus::TasmotaModbus(int receive_pin, int transmit_pin) : TasmotaSerial( uint16_t CalculateCRC(uint8_t *frame, uint8_t num) { uint16_t crc = 0xFFFF; - uint16_t flag; for (uint8_t i = 0; i < num; i++) { crc ^= frame[i]; diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 1c96f7d5e..90cdb32ea 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,4 +1,7 @@ -/* 6.4.1 20181225 +/* 6.4.1.1 20181224 + * Fix most compiler warnings + * + * 6.4.1 20181224 * Change RAM usage BMP/BME I2C sensors * Change FallbackTopic from cmnd// to cmnd/_fb/ to discriminate from Topic (#1528) * Change FallbackTopic detection (#4706) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index be5964a94..422049b73 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -1026,7 +1026,7 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len) Serial.printf("%s\n", dataBuf); // "Hello Tiger\n" } else if (2 == index || 4 == index) { - for (int i = 0; i < data_len; i++) { + for (uint16_t i = 0; i < data_len; i++) { Serial.write(dataBuf[i]); // "Hello Tiger" or "A0" } } @@ -2627,8 +2627,6 @@ extern struct rst_info resetInfo; void setup(void) { - byte idx; - RtcRebootLoad(); if (!RtcRebootValid()) { RtcReboot.fast_reboot_count = 0; } RtcReboot.fast_reboot_count++; @@ -2755,7 +2753,6 @@ void setup(void) } blink_powersave = power; - char stopic[TOPSZ]; snprintf_P(log_data, sizeof(log_data), PSTR(D_PROJECT " %s %s " D_VERSION " %s%s-" ARDUINO_ESP8266_RELEASE), PROJECT, Settings.friendlyname[0], my_version, my_image); AddLog(LOG_LEVEL_INFO); diff --git a/sonoff/sonoff_version.h b/sonoff/sonoff_version.h index 6e635a341..532547a63 100644 --- a/sonoff/sonoff_version.h +++ b/sonoff/sonoff_version.h @@ -20,7 +20,7 @@ #ifndef _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_ -#define VERSION 0x06040100 +#define VERSION 0x06040101 #define D_PROGRAMNAME "Sonoff-Tasmota" #define D_AUTHOR "Theo Arends" diff --git a/sonoff/support.ino b/sonoff/support.ino index 5c80651e9..ceb080408 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -140,7 +140,7 @@ size_t strchrspn(const char *str1, int character) char* subStr(char* dest, char* str, const char *delim, int index) { char *act; - char *sub; + char *sub = NULL; char *ptr; int i; diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index 046181283..7d36ce8e1 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -1591,7 +1591,7 @@ void HandleUploadLoop(void) upload_error = abs(result); return; } else if (result > 0) { - if (result > upload.currentSize) { + if ((size_t)result > upload.currentSize) { // Offset is larger than the buffer supplied, this should not happen upload_error = 9; // File too large - Failed to decode RF firmware return; diff --git a/sonoff/xdrv_04_light.ino b/sonoff/xdrv_04_light.ino index ae6644dda..8aac13f69 100644 --- a/sonoff/xdrv_04_light.ino +++ b/sonoff/xdrv_04_light.ino @@ -1319,7 +1319,6 @@ boolean LightCommand(void) bool validtable = (XdrvMailbox.data_len > 0); char scolor[25]; if (validtable) { - uint16_t HSB[3]; if (strstr(XdrvMailbox.data, ",")) { // Command with up to 5 comma separated parameters for (int i = 0; i < LST_RGBWC; i++) { char *substr; diff --git a/sonoff/xdrv_06_snfbridge.ino b/sonoff/xdrv_06_snfbridge.ino index 30bd6e4f0..8e6b62641 100644 --- a/sonoff/xdrv_06_snfbridge.ino +++ b/sonoff/xdrv_06_snfbridge.ino @@ -56,7 +56,7 @@ unsigned long sonoff_bridge_last_learn_time = 0; ssize_t rf_find_hex_record_start(uint8_t *buf, size_t size) { - for (int i = 0; i < size; i++) { + for (size_t i = 0; i < size; i++) { if (buf[i] == ':') { return i; } @@ -66,7 +66,7 @@ ssize_t rf_find_hex_record_start(uint8_t *buf, size_t size) ssize_t rf_find_hex_record_end(uint8_t *buf, size_t size) { - for (ssize_t i = 0; i < size; i++) { + for (size_t i = 0; i < size; i++) { if (buf[i] == '\n') { return i; } diff --git a/sonoff/xdrv_08_serial_bridge.ino b/sonoff/xdrv_08_serial_bridge.ino index e901e9958..b29bb7393 100644 --- a/sonoff/xdrv_08_serial_bridge.ino +++ b/sonoff/xdrv_08_serial_bridge.ino @@ -122,7 +122,7 @@ boolean SerialBridgeCommand(void) Settings.sbaudrate = (1 == XdrvMailbox.payload) ? SOFT_BAUDRATE / 1200 : baud; SerialBridgeSerial->begin(Settings.sbaudrate * 1200); // Reinitialize serial port with new baud rate } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_LVALUE, command, Settings.sbaudrate * 1200); + snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.sbaudrate * 1200); } else serviced = false; // Unknown command diff --git a/sonoff/xdrv_09_timers.ino b/sonoff/xdrv_09_timers.ino index 8273201d5..820125e3d 100644 --- a/sonoff/xdrv_09_timers.ino +++ b/sonoff/xdrv_09_timers.ino @@ -135,7 +135,6 @@ void DuskTillDawn(uint8_t *hour_up,uint8_t *minute_up, uint8_t *hour_down, uint8 // double Zeitzone = 2.0; //Sommerzeit double Zeitzone = ((double)time_timezone) / 60; double Zeitgleichung = BerechneZeitgleichung(&DK, T); - double Minuten = Zeitgleichung * 60.0; double Zeitdifferenz = 12.0*acos((sin(h) - sin(B)*sin(DK)) / (cos(B)*cos(DK)))/pi; double AufgangOrtszeit = 12.0 - Zeitdifferenz - Zeitgleichung; double UntergangOrtszeit = 12.0 + Zeitdifferenz - Zeitgleichung; diff --git a/sonoff/xdrv_18_armtronix_dimmers.ino b/sonoff/xdrv_18_armtronix_dimmers.ino index 795149bff..9e0e9c7f9 100644 --- a/sonoff/xdrv_18_armtronix_dimmers.ino +++ b/sonoff/xdrv_18_armtronix_dimmers.ino @@ -155,11 +155,11 @@ void ArmtronixSetWifiLed(void) snprintf_P(log_data, sizeof(log_data), "ARM: Set WiFi LED to state %d (%d)", wifi_state, WifiState()); AddLog(LOG_LEVEL_DEBUG); - char state = '0' + (wifi_state & 1 > 0); + char state = '0' + ((wifi_state & 1) > 0); ArmtronixSerial->print("Setled:"); ArmtronixSerial->write(state); ArmtronixSerial->write(','); - state = '0' + (wifi_state & 2 > 0); + state = '0' + ((wifi_state & 2) > 0); ArmtronixSerial->write(state); ArmtronixSerial->write(10); armtronix_wifi_state = WifiState(); diff --git a/sonoff/xnrg_02_cse7766.ino b/sonoff/xnrg_02_cse7766.ino index 318fb02a7..2286a6fa3 100644 --- a/sonoff/xnrg_02_cse7766.ino +++ b/sonoff/xnrg_02_cse7766.ino @@ -41,7 +41,7 @@ uint8_t cse_receive_flag = 0; long voltage_cycle = 0; long current_cycle = 0; long power_cycle = 0; -unsigned long power_cycle_first = 0; +long power_cycle_first = 0; long cf_pulses = 0; long cf_pulses_last_time = CSE_PULSES_NOT_INITIALIZED; uint8_t cse_power_invalid = CSE_MAX_INVALID_POWER; diff --git a/sonoff/xsns_05_ds18x20.ino b/sonoff/xsns_05_ds18x20.ino index 1061df86d..ba7752741 100644 --- a/sonoff/xsns_05_ds18x20.ino +++ b/sonoff/xsns_05_ds18x20.ino @@ -261,7 +261,9 @@ void Ds18x20Init(void) ds18x20_pin = pin[GPIO_DSB]; OneWireResetSearch(); - for (ds18x20_sensors = 0; ds18x20_sensors < DS18X20_MAX_SENSORS; ds18x20_sensors) { + + ds18x20_sensors = 0; + while (ds18x20_sensors < DS18X20_MAX_SENSORS) { if (!OneWireSearch(ds18x20_sensor[ds18x20_sensors].address)) { break; } diff --git a/sonoff/xsns_34_hx711.ino b/sonoff/xsns_34_hx711.ino index c3f10ded9..75a06e7de 100644 --- a/sonoff/xsns_34_hx711.ino +++ b/sonoff/xsns_34_hx711.ino @@ -270,7 +270,7 @@ void HxEvery100mSecond(void) } else if (HX_CAL_RESET == hx_calibrate_step) { // Wait for stable reset if (hx_calibrate_timer) { - if (hx_weight < Settings.weight_reference) { + if (hx_weight < (long)Settings.weight_reference) { hx_calibrate_step--; hx_calibrate_timer = HX_CAL_TIMEOUT * (10 / HX_SAMPLES); HxCalibrationStateTextJson(2); @@ -281,7 +281,7 @@ void HxEvery100mSecond(void) } else if (HX_CAL_FIRST == hx_calibrate_step) { // Wait for first reference weight if (hx_calibrate_timer) { - if (hx_weight > Settings.weight_reference) { + if (hx_weight > (long)Settings.weight_reference) { hx_calibrate_step--; } } else { @@ -289,7 +289,7 @@ void HxEvery100mSecond(void) } } else if (HX_CAL_DONE == hx_calibrate_step) { // Second stable reference weight - if (hx_weight > Settings.weight_reference) { + if (hx_weight > (long)Settings.weight_reference) { hx_calibrate_step = HX_CAL_FINISH; // Calibration done Settings.weight_calibration = hx_weight / Settings.weight_reference; hx_weight = 0; // Reset calibration value diff --git a/sonoff/xsns_38_az7798.ino b/sonoff/xsns_38_az7798.ino index f909bb061..b9ac0a012 100644 --- a/sonoff/xsns_38_az7798.ino +++ b/sonoff/xsns_38_az7798.ino @@ -107,9 +107,7 @@ * * : responds with : T19.9C:C2167ppm:H57.4% * This one gives the current readings. - ********************************************************************************************** - -/*********************************************************************************************/ +\*********************************************************************************************/ #include