6.4.1.1 Fix most compiler warnings

6.4.1.1 20181224
 * Fix most compiler warnings
This commit is contained in:
Theo Arends 2018-12-24 18:14:25 +01:00
parent 87ddbd8f38
commit 0b10f48e41
15 changed files with 21 additions and 24 deletions

View File

@ -27,7 +27,6 @@ TasmotaModbus::TasmotaModbus(int receive_pin, int transmit_pin) : TasmotaSerial(
uint16_t CalculateCRC(uint8_t *frame, uint8_t num) uint16_t CalculateCRC(uint8_t *frame, uint8_t num)
{ {
uint16_t crc = 0xFFFF; uint16_t crc = 0xFFFF;
uint16_t flag;
for (uint8_t i = 0; i < num; i++) { for (uint8_t i = 0; i < num; i++) {
crc ^= frame[i]; crc ^= frame[i];

View File

@ -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 RAM usage BMP/BME I2C sensors
* Change FallbackTopic from cmnd/<mqttclient>/ to cmnd/<mqttclient>_fb/ to discriminate from Topic (#1528) * Change FallbackTopic from cmnd/<mqttclient>/ to cmnd/<mqttclient>_fb/ to discriminate from Topic (#1528)
* Change FallbackTopic detection (#4706) * Change FallbackTopic detection (#4706)

View File

@ -1026,7 +1026,7 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
Serial.printf("%s\n", dataBuf); // "Hello Tiger\n" Serial.printf("%s\n", dataBuf); // "Hello Tiger\n"
} }
else if (2 == index || 4 == index) { 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" Serial.write(dataBuf[i]); // "Hello Tiger" or "A0"
} }
} }
@ -2627,8 +2627,6 @@ extern struct rst_info resetInfo;
void setup(void) void setup(void)
{ {
byte idx;
RtcRebootLoad(); RtcRebootLoad();
if (!RtcRebootValid()) { RtcReboot.fast_reboot_count = 0; } if (!RtcRebootValid()) { RtcReboot.fast_reboot_count = 0; }
RtcReboot.fast_reboot_count++; RtcReboot.fast_reboot_count++;
@ -2755,7 +2753,6 @@ void setup(void)
} }
blink_powersave = power; 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), 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); PROJECT, Settings.friendlyname[0], my_version, my_image);
AddLog(LOG_LEVEL_INFO); AddLog(LOG_LEVEL_INFO);

View File

@ -20,7 +20,7 @@
#ifndef _SONOFF_VERSION_H_ #ifndef _SONOFF_VERSION_H_
#define _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_
#define VERSION 0x06040100 #define VERSION 0x06040101
#define D_PROGRAMNAME "Sonoff-Tasmota" #define D_PROGRAMNAME "Sonoff-Tasmota"
#define D_AUTHOR "Theo Arends" #define D_AUTHOR "Theo Arends"

View File

@ -140,7 +140,7 @@ size_t strchrspn(const char *str1, int character)
char* subStr(char* dest, char* str, const char *delim, int index) char* subStr(char* dest, char* str, const char *delim, int index)
{ {
char *act; char *act;
char *sub; char *sub = NULL;
char *ptr; char *ptr;
int i; int i;

View File

@ -1591,7 +1591,7 @@ void HandleUploadLoop(void)
upload_error = abs(result); upload_error = abs(result);
return; return;
} else if (result > 0) { } 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 // Offset is larger than the buffer supplied, this should not happen
upload_error = 9; // File too large - Failed to decode RF firmware upload_error = 9; // File too large - Failed to decode RF firmware
return; return;

View File

@ -1319,7 +1319,6 @@ boolean LightCommand(void)
bool validtable = (XdrvMailbox.data_len > 0); bool validtable = (XdrvMailbox.data_len > 0);
char scolor[25]; char scolor[25];
if (validtable) { if (validtable) {
uint16_t HSB[3];
if (strstr(XdrvMailbox.data, ",")) { // Command with up to 5 comma separated parameters if (strstr(XdrvMailbox.data, ",")) { // Command with up to 5 comma separated parameters
for (int i = 0; i < LST_RGBWC; i++) { for (int i = 0; i < LST_RGBWC; i++) {
char *substr; char *substr;

View File

@ -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) 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] == ':') { if (buf[i] == ':') {
return 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) 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') { if (buf[i] == '\n') {
return i; return i;
} }

View File

@ -122,7 +122,7 @@ boolean SerialBridgeCommand(void)
Settings.sbaudrate = (1 == XdrvMailbox.payload) ? SOFT_BAUDRATE / 1200 : baud; Settings.sbaudrate = (1 == XdrvMailbox.payload) ? SOFT_BAUDRATE / 1200 : baud;
SerialBridgeSerial->begin(Settings.sbaudrate * 1200); // Reinitialize serial port with new baud rate 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 else serviced = false; // Unknown command

View File

@ -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 = 2.0; //Sommerzeit
double Zeitzone = ((double)time_timezone) / 60; double Zeitzone = ((double)time_timezone) / 60;
double Zeitgleichung = BerechneZeitgleichung(&DK, T); 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 Zeitdifferenz = 12.0*acos((sin(h) - sin(B)*sin(DK)) / (cos(B)*cos(DK)))/pi;
double AufgangOrtszeit = 12.0 - Zeitdifferenz - Zeitgleichung; double AufgangOrtszeit = 12.0 - Zeitdifferenz - Zeitgleichung;
double UntergangOrtszeit = 12.0 + Zeitdifferenz - Zeitgleichung; double UntergangOrtszeit = 12.0 + Zeitdifferenz - Zeitgleichung;

View File

@ -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()); snprintf_P(log_data, sizeof(log_data), "ARM: Set WiFi LED to state %d (%d)", wifi_state, WifiState());
AddLog(LOG_LEVEL_DEBUG); AddLog(LOG_LEVEL_DEBUG);
char state = '0' + (wifi_state & 1 > 0); char state = '0' + ((wifi_state & 1) > 0);
ArmtronixSerial->print("Setled:"); ArmtronixSerial->print("Setled:");
ArmtronixSerial->write(state); ArmtronixSerial->write(state);
ArmtronixSerial->write(','); ArmtronixSerial->write(',');
state = '0' + (wifi_state & 2 > 0); state = '0' + ((wifi_state & 2) > 0);
ArmtronixSerial->write(state); ArmtronixSerial->write(state);
ArmtronixSerial->write(10); ArmtronixSerial->write(10);
armtronix_wifi_state = WifiState(); armtronix_wifi_state = WifiState();

View File

@ -41,7 +41,7 @@ uint8_t cse_receive_flag = 0;
long voltage_cycle = 0; long voltage_cycle = 0;
long current_cycle = 0; long current_cycle = 0;
long power_cycle = 0; long power_cycle = 0;
unsigned long power_cycle_first = 0; long power_cycle_first = 0;
long cf_pulses = 0; long cf_pulses = 0;
long cf_pulses_last_time = CSE_PULSES_NOT_INITIALIZED; long cf_pulses_last_time = CSE_PULSES_NOT_INITIALIZED;
uint8_t cse_power_invalid = CSE_MAX_INVALID_POWER; uint8_t cse_power_invalid = CSE_MAX_INVALID_POWER;

View File

@ -261,7 +261,9 @@ void Ds18x20Init(void)
ds18x20_pin = pin[GPIO_DSB]; ds18x20_pin = pin[GPIO_DSB];
OneWireResetSearch(); 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)) { if (!OneWireSearch(ds18x20_sensor[ds18x20_sensors].address)) {
break; break;
} }

View File

@ -270,7 +270,7 @@ void HxEvery100mSecond(void)
} }
else if (HX_CAL_RESET == hx_calibrate_step) { // Wait for stable reset else if (HX_CAL_RESET == hx_calibrate_step) { // Wait for stable reset
if (hx_calibrate_timer) { if (hx_calibrate_timer) {
if (hx_weight < Settings.weight_reference) { if (hx_weight < (long)Settings.weight_reference) {
hx_calibrate_step--; hx_calibrate_step--;
hx_calibrate_timer = HX_CAL_TIMEOUT * (10 / HX_SAMPLES); hx_calibrate_timer = HX_CAL_TIMEOUT * (10 / HX_SAMPLES);
HxCalibrationStateTextJson(2); HxCalibrationStateTextJson(2);
@ -281,7 +281,7 @@ void HxEvery100mSecond(void)
} }
else if (HX_CAL_FIRST == hx_calibrate_step) { // Wait for first reference weight else if (HX_CAL_FIRST == hx_calibrate_step) { // Wait for first reference weight
if (hx_calibrate_timer) { if (hx_calibrate_timer) {
if (hx_weight > Settings.weight_reference) { if (hx_weight > (long)Settings.weight_reference) {
hx_calibrate_step--; hx_calibrate_step--;
} }
} else { } else {
@ -289,7 +289,7 @@ void HxEvery100mSecond(void)
} }
} }
else if (HX_CAL_DONE == hx_calibrate_step) { // Second stable reference weight 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 hx_calibrate_step = HX_CAL_FINISH; // Calibration done
Settings.weight_calibration = hx_weight / Settings.weight_reference; Settings.weight_calibration = hx_weight / Settings.weight_reference;
hx_weight = 0; // Reset calibration value hx_weight = 0; // Reset calibration value

View File

@ -107,9 +107,7 @@
* *
* : responds with : T19.9C:C2167ppm:H57.4% * : responds with : T19.9C:C2167ppm:H57.4%
* This one gives the current readings. * This one gives the current readings.
********************************************************************************************** \*********************************************************************************************/
/*********************************************************************************************/
#include <TasmotaSerial.h> #include <TasmotaSerial.h>