Fix GCC 10.1 errors and warnings

This commit is contained in:
Theo Arends 2020-07-14 16:21:11 +02:00
parent cd6e23757c
commit f3c391b160
12 changed files with 54 additions and 43 deletions

View File

@ -81,6 +81,7 @@ int16_t Epd::Begin(int16_t cs,int16_t mosi,int16_t sclk) {
cs_pin=cs; cs_pin=cs;
mosi_pin=mosi; mosi_pin=mosi;
sclk_pin=sclk; sclk_pin=sclk;
return 0;
} }

View File

@ -94,6 +94,7 @@ int16_t Epd42::Begin(int16_t cs,int16_t mosi,int16_t sclk) {
cs_pin=cs; cs_pin=cs;
mosi_pin=mosi; mosi_pin=mosi;
sclk_pin=sclk; sclk_pin=sclk;
return 0;
} }
void Epd42::Init(int8_t p) { void Epd42::Init(int8_t p) {

View File

@ -38,7 +38,7 @@ void Paint::DisplayOnff(int8_t on) {
} }
int16_t Paint::Begin(int16_t p1,int16_t p2,int16_t p3) { int16_t Paint::Begin(int16_t p1,int16_t p2,int16_t p3) {
return 0;
} }
void Paint::Updateframe() { void Paint::Updateframe() {

View File

@ -247,6 +247,7 @@ callback_assignment_id_t ESPKNXIP::__callback_register_assignment(address_t addr
return id; return id;
} }
} }
return -1;
} }
void ESPKNXIP::__callback_delete_assignment(callback_assignment_id_t id) void ESPKNXIP::__callback_delete_assignment(callback_assignment_id_t id)
@ -358,6 +359,7 @@ callback_id_t ESPKNXIP::callback_register(String name, callback_fptr_t cb, void
return id; return id;
} }
} }
return -1;
} }
void ESPKNXIP::callback_deregister(callback_id_t id) void ESPKNXIP::callback_deregister(callback_id_t id)

View File

@ -270,7 +270,8 @@ typedef struct __cemi_msg
uint8_t additional_info_len; uint8_t additional_info_len;
union union
{ {
cemi_addi_t additional_info[]; // cemi_addi_t additional_info[]; // Errors in GCC 10.1
cemi_addi_t additional_info[10]; // Changed to arbitrary number to fix compilation
cemi_service_t service_information; cemi_service_t service_information;
} data; } data;
} cemi_msg_t; } cemi_msg_t;

View File

@ -218,6 +218,7 @@ float cos_52(float x)
case 2: return -cos_52s(x-(float)f_pi); case 2: return -cos_52s(x-(float)f_pi);
case 3: return cos_52s((float)f_twopi - x); case 3: return cos_52s((float)f_twopi - x);
} }
return 0.0; // Never reached. Fixes compiler warning
} }
// //
// The sine is just cosine shifted a half-f_pi, so // The sine is just cosine shifted a half-f_pi, so
@ -278,6 +279,7 @@ float tan_56(float x)
case 6: return -1.0f / tan_56s((x-(float)f_threehalfpi) * (float)f_four_over_pi); case 6: return -1.0f / tan_56s((x-(float)f_threehalfpi) * (float)f_four_over_pi);
case 7: return - tan_56s(((float)f_twopi - x) * (float)f_four_over_pi); case 7: return - tan_56s(((float)f_twopi - x) * (float)f_four_over_pi);
} }
return 0.0; // Never reached. Fixes compiler warning
} }
// ******************************************************************* // *******************************************************************

View File

@ -99,6 +99,7 @@ char* NetworkHostname(void) {
} }
#endif #endif
#endif #endif
return nullptr; // Never reached. Fix GCC10 warning
} }
IPAddress NetworkAddress(void) { IPAddress NetworkAddress(void) {
@ -112,6 +113,7 @@ IPAddress NetworkAddress(void) {
} }
#endif #endif
#endif #endif
return 0; // Never reached. Fix GCC10 warning
} }
String NetworkMacAddress(void) { String NetworkMacAddress(void) {
@ -125,4 +127,5 @@ String NetworkMacAddress(void) {
} }
#endif #endif
#endif #endif
return ""; // Never reached. Fix GCC10 warning
} }

View File

@ -477,7 +477,7 @@ class LightStateClass {
if (w) { *w = ct_channels_on ? changeUIntScale(_ww, 0, 255, 0, _briCT) : 0; } if (w) { *w = ct_channels_on ? changeUIntScale(_ww, 0, 255, 0, _briCT) : 0; }
} }
uint8_t getChannels(uint8_t *channels) { void getChannels(uint8_t *channels) {
getActualRGBCW(&channels[0], &channels[1], &channels[2], &channels[3], &channels[4]); getActualRGBCW(&channels[0], &channels[1], &channels[2], &channels[3], &channels[4]);
} }

View File

@ -294,6 +294,7 @@ String GetRule(uint32_t idx) {
return rule; return rule;
#endif #endif
} }
return ""; // Fix GCC10 warning
} }
#ifdef USE_UNISHOX_COMPRESSION #ifdef USE_UNISHOX_COMPRESSION

View File

@ -156,7 +156,8 @@ void SonoffIfanReceived(void)
bool SonoffIfanSerialInput(void) bool SonoffIfanSerialInput(void)
{ {
if (SONOFF_IFAN03 == my_module_type) { if (SONOFF_IFAN03 != my_module_type) { return false; }
if (0xAA == serial_in_byte) { // 0xAA - Start of text if (0xAA == serial_in_byte) { // 0xAA - Start of text
serial_in_byte_counter = 0; serial_in_byte_counter = 0;
ifan_receive_flag = true; ifan_receive_flag = true;
@ -187,7 +188,6 @@ bool SonoffIfanSerialInput(void)
serial_in_byte = 0; serial_in_byte = 0;
} }
return false; return false;
}
} }
/*********************************************************************************************\ /*********************************************************************************************\

View File

@ -141,7 +141,7 @@ void CseReceived(void) {
} }
} }
bool CseSerialInput(void) { void CseSerialInput(void) {
while (CseSerial->available()) { while (CseSerial->available()) {
yield(); yield();
uint8_t serial_in_byte = CseSerial->read(); uint8_t serial_in_byte = CseSerial->read();
@ -158,7 +158,7 @@ bool CseSerialInput(void) {
Energy.data_valid[0] = 0; Energy.data_valid[0] = 0;
CseReceived(); CseReceived();
Cse.received = false; Cse.received = false;
return true; return;
} else { } else {
do { // Sync buffer with data (issue #1907 and #3425) do { // Sync buffer with data (issue #1907 and #3425)
memmove(Cse.rx_buffer, Cse.rx_buffer +1, 24); memmove(Cse.rx_buffer, Cse.rx_buffer +1, 24);

View File

@ -121,7 +121,7 @@ void Bl0940Received(void) {
} }
} }
bool Bl0940SerialInput(void) { void Bl0940SerialInput(void) {
while (Bl0940Serial->available()) { while (Bl0940Serial->available()) {
yield(); yield();
uint8_t serial_in_byte = Bl0940Serial->read(); uint8_t serial_in_byte = Bl0940Serial->read();
@ -142,7 +142,7 @@ bool Bl0940SerialInput(void) {
Energy.data_valid[0] = 0; Energy.data_valid[0] = 0;
Bl0940Received(); Bl0940Received();
Bl0940.received = false; Bl0940.received = false;
return true; return;
} else { } else {
do { // Sync buffer with data (issue #1907 and #3425) do { // Sync buffer with data (issue #1907 and #3425)
memmove(Bl0940.rx_buffer, Bl0940.rx_buffer +1, BL0940_BUFFER_SIZE -1); memmove(Bl0940.rx_buffer, Bl0940.rx_buffer +1, BL0940_BUFFER_SIZE -1);