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;
mosi_pin=mosi;
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;
mosi_pin=mosi;
sclk_pin=sclk;
return 0;
}
void Epd42::Init(int8_t p) {
@ -130,14 +131,14 @@ int Epd42::Init(void) {
SendCommand(PANEL_SETTING);
// SendData(0xbf); // KW-BF KWR-AF BWROTP 0f
// SendData(0x0b);
// SendData(0x0F); //300x400 Red mode, LUT from OTP
// SendData(0x1F); //300x400 B/W mode, LUT from OTP
SendData(0x3F); //300x400 B/W mode, LUT set by register
// SendData(0x2F); //300x400 Red mode, LUT set by register
// SendData(0x0F); //300x400 Red mode, LUT from OTP
// SendData(0x1F); //300x400 B/W mode, LUT from OTP
SendData(0x3F); //300x400 B/W mode, LUT set by register
// SendData(0x2F); //300x400 Red mode, LUT set by register
SendCommand(PLL_CONTROL);
SendData(0x3C); // 3A 100Hz 29 150Hz 39 200Hz 31 171Hz 3C 50Hz (default) 0B 10Hz
//SendData(0x0B); //0B is 10Hz
//SendData(0x0B); //0B is 10Hz
/* EPD hardware init end */
return 0;
}

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) {
return 0;
}
void Paint::Updateframe() {

View File

@ -247,6 +247,7 @@ callback_assignment_id_t ESPKNXIP::__callback_register_assignment(address_t addr
return id;
}
}
return -1;
}
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 -1;
}
void ESPKNXIP::callback_deregister(callback_id_t id)

View File

@ -270,7 +270,8 @@ typedef struct __cemi_msg
uint8_t additional_info_len;
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;
} data;
} cemi_msg_t;

View File

@ -218,6 +218,7 @@ float cos_52(float x)
case 2: return -cos_52s(x-(float)f_pi);
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
@ -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 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
return nullptr; // Never reached. Fix GCC10 warning
}
IPAddress NetworkAddress(void) {
@ -112,6 +113,7 @@ IPAddress NetworkAddress(void) {
}
#endif
#endif
return 0; // Never reached. Fix GCC10 warning
}
String NetworkMacAddress(void) {
@ -125,4 +127,5 @@ String NetworkMacAddress(void) {
}
#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; }
}
uint8_t getChannels(uint8_t *channels) {
void getChannels(uint8_t *channels) {
getActualRGBCW(&channels[0], &channels[1], &channels[2], &channels[3], &channels[4]);
}

View File

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

View File

@ -156,38 +156,38 @@ void SonoffIfanReceived(void)
bool SonoffIfanSerialInput(void)
{
if (SONOFF_IFAN03 == my_module_type) {
if (0xAA == serial_in_byte) { // 0xAA - Start of text
serial_in_byte_counter = 0;
ifan_receive_flag = true;
}
if (ifan_receive_flag) {
serial_in_buffer[serial_in_byte_counter++] = serial_in_byte;
if (serial_in_byte_counter == 8) {
// AA 55 01 01 00 01 01 04 - Wifi long press - start wifi setup
// AA 55 01 01 00 01 02 05 - Rf and Wifi short press
// AA 55 01 04 00 01 00 06 - Fan 0
// AA 55 01 04 00 01 01 07 - Fan 1
// AA 55 01 04 00 01 02 08 - Fan 2
// AA 55 01 04 00 01 03 09 - Fan 3
// AA 55 01 04 00 01 04 0A - Light
// AA 55 01 06 00 01 01 09 - Buzzer
// AA 55 01 07 00 01 01 0A - Rf long press - forget RF codes
AddLogSerial(LOG_LEVEL_DEBUG);
uint8_t crc = 0;
for (uint32_t i = 2; i < 7; i++) {
crc += serial_in_buffer[i];
}
if (crc == serial_in_buffer[7]) {
SonoffIfanReceived();
ifan_receive_flag = false;
return true;
}
}
serial_in_byte = 0;
}
return false;
if (SONOFF_IFAN03 != my_module_type) { return false; }
if (0xAA == serial_in_byte) { // 0xAA - Start of text
serial_in_byte_counter = 0;
ifan_receive_flag = true;
}
if (ifan_receive_flag) {
serial_in_buffer[serial_in_byte_counter++] = serial_in_byte;
if (serial_in_byte_counter == 8) {
// AA 55 01 01 00 01 01 04 - Wifi long press - start wifi setup
// AA 55 01 01 00 01 02 05 - Rf and Wifi short press
// AA 55 01 04 00 01 00 06 - Fan 0
// AA 55 01 04 00 01 01 07 - Fan 1
// AA 55 01 04 00 01 02 08 - Fan 2
// AA 55 01 04 00 01 03 09 - Fan 3
// AA 55 01 04 00 01 04 0A - Light
// AA 55 01 06 00 01 01 09 - Buzzer
// AA 55 01 07 00 01 01 0A - Rf long press - forget RF codes
AddLogSerial(LOG_LEVEL_DEBUG);
uint8_t crc = 0;
for (uint32_t i = 2; i < 7; i++) {
crc += serial_in_buffer[i];
}
if (crc == serial_in_buffer[7]) {
SonoffIfanReceived();
ifan_receive_flag = false;
return true;
}
}
serial_in_byte = 0;
}
return false;
}
/*********************************************************************************************\

View File

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