From 00c7ee0bb84c0d88042df8e674c34d23d603af4a Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 24 Nov 2019 12:24:35 +0100 Subject: [PATCH] Fix Arduino IDE compile error Fix Arduino IDE function prototyping compile error (#6982) --- tasmota/CHANGELOG.md | 1 + tasmota/xdrv_05_irremote.ino | 13 +++++++------ tasmota/xdrv_05_irremote_full.ino | 6 ++++-- tasmota/xdrv_08_serial_bridge.ino | 4 ++-- tasmota/xdrv_17_rcswitch.ino | 4 ++-- tasmota/xdrv_22_sonoff_ifan.ino | 4 ++-- tasmota/xdrv_23_zigbee_9_impl.ino | 16 +++++++++------- tasmota/xdrv_30_exs_dimmer.ino | 8 ++++---- tasmota/xsns_01_counter.ino | 4 ++-- tasmota/xsns_02_analog.ino | 4 ++-- 10 files changed, 35 insertions(+), 29 deletions(-) diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index 6de2e7014..1a343d51e 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -4,6 +4,7 @@ - Add colorpicker to WebUI by Christian Staars (#6984) - Change new Fade system much smoother, Speed now up to 40 (#6942, #3714) +- Fix Arduino IDE function prototyping compile error (#6982) ### 7.0.0.5 20191118 diff --git a/tasmota/xdrv_05_irremote.ino b/tasmota/xdrv_05_irremote.ino index 6b482f485..7c66c4b98 100644 --- a/tasmota/xdrv_05_irremote.ino +++ b/tasmota/xdrv_05_irremote.ino @@ -26,15 +26,16 @@ #include -enum IrErrors { IE_NO_ERROR, IE_INVALID_RAWDATA, IE_INVALID_JSON, IE_SYNTAX_IRSEND, IE_SYNTAX_IRHVAC }; +enum IrErrors { IE_NO_ERROR, IE_INVALID_RAWDATA, IE_INVALID_JSON, IE_SYNTAX_IRSEND }; const char kIrRemoteCommands[] PROGMEM = "|" D_CMND_IRSEND ; -void (* const IrRemoteCommand[])(void) PROGMEM = { &CmndIrSend }; +// Keep below IrRemoteCommand lines exactly as below as otherwise Arduino IDE prototyping will fail (#6982) +void (* const IrRemoteCommand[])(void) PROGMEM = { + &CmndIrSend }; // Based on IRremoteESP8266.h enum decode_type_t -static const uint8_t MAX_STANDARD_IR = SHARP; // this is the last code mapped to decode_type_t -enum IrVendors { IR_BASE = MAX_STANDARD_IR }; +static const uint8_t MAX_STANDARD_IR = NEC; // this is the last code mapped to decode_type_t const char kIrRemoteProtocols[] PROGMEM = "UNKNOWN|RC5|RC6|NEC"; /*********************************************************************************************\ @@ -86,7 +87,7 @@ void IrReceiveInit(void) void IrReceiveCheck(void) { - char sirtype[14]; // Max is AIWA_RC_T501 + char sirtype[8]; // Max is UNKNOWN int8_t iridx = 0; decode_results results; @@ -95,7 +96,7 @@ void IrReceiveCheck(void) char hvalue[65]; // Max 256 bits iridx = results.decode_type; - if ((iridx < 0) || (iridx > 14)) { iridx = 0; } // UNKNOWN + if ((iridx < 0) || (iridx > MAX_STANDARD_IR)) { iridx = 0; } // UNKNOWN if (iridx) { if (results.bits > 64) { diff --git a/tasmota/xdrv_05_irremote_full.ino b/tasmota/xdrv_05_irremote_full.ino index 7625d057a..d01291c7c 100644 --- a/tasmota/xdrv_05_irremote_full.ino +++ b/tasmota/xdrv_05_irremote_full.ino @@ -33,9 +33,11 @@ enum IrErrors { IE_RESPONSE_PROVIDED, IE_NO_ERROR, IE_INVALID_RAWDATA, IE_INVALID_JSON, IE_SYNTAX_IRSEND, IE_SYNTAX_IRHVAC, IE_UNSUPPORTED_HVAC, IE_UNSUPPORTED_PROTOCOL }; -const char kIrRemoteCommands[] PROGMEM = "|" D_CMND_IRHVAC "|" D_CMND_IRSEND ; // No prefix +const char kIrRemoteCommands[] PROGMEM = "|" + D_CMND_IRHVAC "|" D_CMND_IRSEND ; // No prefix -void (* const IrRemoteCommand[])(void) PROGMEM = { &CmndIrHvac, &CmndIrSend }; +void (* const IrRemoteCommand[])(void) PROGMEM = { + &CmndIrHvac, &CmndIrSend }; /*********************************************************************************************\ * IR Send diff --git a/tasmota/xdrv_08_serial_bridge.ino b/tasmota/xdrv_08_serial_bridge.ino index df4eafdd8..2d9856186 100644 --- a/tasmota/xdrv_08_serial_bridge.ino +++ b/tasmota/xdrv_08_serial_bridge.ino @@ -29,8 +29,8 @@ const uint8_t SERIAL_BRIDGE_BUFFER_SIZE = 130; const char kSerialBridgeCommands[] PROGMEM = "|" // No prefix D_CMND_SSERIALSEND "|" D_CMND_SBAUDRATE; -void (* const SerialBridgeCommand[])(void) PROGMEM = - { &CmndSSerialSend, &CmndSBaudrate }; +void (* const SerialBridgeCommand[])(void) PROGMEM = { + &CmndSSerialSend, &CmndSBaudrate }; #include diff --git a/tasmota/xdrv_17_rcswitch.ino b/tasmota/xdrv_17_rcswitch.ino index 88e2ebbca..dfe5dc66a 100644 --- a/tasmota/xdrv_17_rcswitch.ino +++ b/tasmota/xdrv_17_rcswitch.ino @@ -35,8 +35,8 @@ const char kRfSendCommands[] PROGMEM = "|" // No prefix D_CMND_RFSEND; -void (* const RfSendCommand[])(void) PROGMEM = - { &CmndRfSend }; +void (* const RfSendCommand[])(void) PROGMEM = { + &CmndRfSend }; #include diff --git a/tasmota/xdrv_22_sonoff_ifan.ino b/tasmota/xdrv_22_sonoff_ifan.ino index 4fd2bd2b6..b260952f4 100644 --- a/tasmota/xdrv_22_sonoff_ifan.ino +++ b/tasmota/xdrv_22_sonoff_ifan.ino @@ -33,8 +33,8 @@ const uint8_t kIFan03Sequence[MAX_FAN_SPEED][MAX_FAN_SPEED] = {{0, 2, 2, 2}, {0, const char kSonoffIfanCommands[] PROGMEM = "|" // No prefix D_CMND_FANSPEED; -void (* const SonoffIfanCommand[])(void) PROGMEM = - { &CmndFanspeed }; +void (* const SonoffIfanCommand[])(void) PROGMEM = { + &CmndFanspeed }; uint8_t ifan_fanspeed_timer = 0; uint8_t ifan_fanspeed_goal = 0; diff --git a/tasmota/xdrv_23_zigbee_9_impl.ino b/tasmota/xdrv_23_zigbee_9_impl.ino index 41a73b415..1cd3955ce 100644 --- a/tasmota/xdrv_23_zigbee_9_impl.ino +++ b/tasmota/xdrv_23_zigbee_9_impl.ino @@ -36,13 +36,15 @@ TasmotaSerial *ZigbeeSerial = nullptr; #endif -const char kZigbeeCommands[] PROGMEM = "|" D_CMND_ZIGBEEZNPSEND "|" D_CMND_ZIGBEE_PERMITJOIN - "|" D_CMND_ZIGBEE_STATUS "|" D_CMND_ZIGBEE_RESET "|" D_CMND_ZIGBEE_SEND - "|" D_CMND_ZIGBEE_PROBE "|" D_CMND_ZIGBEE_READ ; +const char kZigbeeCommands[] PROGMEM = "|" + D_CMND_ZIGBEEZNPSEND "|" D_CMND_ZIGBEE_PERMITJOIN "|" + D_CMND_ZIGBEE_STATUS "|" D_CMND_ZIGBEE_RESET "|" D_CMND_ZIGBEE_SEND "|" + D_CMND_ZIGBEE_PROBE "|" D_CMND_ZIGBEE_READ ; -void (* const ZigbeeCommand[])(void) PROGMEM = { &CmndZigbeeZNPSend, &CmndZigbeePermitJoin, - &CmndZigbeeStatus, &CmndZigbeeReset, &CmndZigbeeSend, - &CmndZigbeeProbe, &CmndZigbeeRead }; +void (* const ZigbeeCommand[])(void) PROGMEM = { + &CmndZigbeeZNPSend, &CmndZigbeePermitJoin, + &CmndZigbeeStatus, &CmndZigbeeReset, &CmndZigbeeSend, + &CmndZigbeeProbe, &CmndZigbeeRead }; int32_t ZigbeeProcessInput(class SBuffer &buf) { if (!zigbee.state_machine) { return -1; } // if state machine is stopped, send 'ignore' message @@ -260,7 +262,7 @@ uint32_t strToUInt(const JsonVariant val) { return 0; // couldn't parse anything } -const unsigned char ZIGBEE_FACTORY_RESET[] PROGMEM = +const unsigned char ZIGBEE_FACTORY_RESET[] PROGMEM = { Z_SREQ | Z_SAPI, SAPI_WRITE_CONFIGURATION, CONF_STARTUP_OPTION, 0x01 /* len */, 0x01 /* STARTOPT_CLEAR_CONFIG */}; //"2605030101"; // Z_SREQ | Z_SAPI, SAPI_WRITE_CONFIGURATION, CONF_STARTUP_OPTION, 0x01 len, 0x01 STARTOPT_CLEAR_CONFIG // Do a factory reset of the CC2530 diff --git a/tasmota/xdrv_30_exs_dimmer.ino b/tasmota/xdrv_30_exs_dimmer.ino index 2f43fcff3..4945bf928 100644 --- a/tasmota/xdrv_30_exs_dimmer.ino +++ b/tasmota/xdrv_30_exs_dimmer.ino @@ -508,10 +508,10 @@ const char kExsCommands[] PROGMEM = D_PRFX_EXS "|" D_CMND_EXS_DIMMS "|" D_CMND_EXS_CH_LOCK "|" D_CMND_EXS_STATE; -void (* const ExsCommand[])(void) PROGMEM = - { &CmndExsDimm, &CmndExsDimmTbl, &CmndExsDimmVal, - &CmndExsDimms, &CmndExsChLock, - &CmndExsState }; +void (* const ExsCommand[])(void) PROGMEM = { + &CmndExsDimm, &CmndExsDimmTbl, &CmndExsDimmVal, + &CmndExsDimms, &CmndExsChLock, + &CmndExsState }; void CmndExsDimm(void) { diff --git a/tasmota/xsns_01_counter.ino b/tasmota/xsns_01_counter.ino index 296435579..8ed615c86 100644 --- a/tasmota/xsns_01_counter.ino +++ b/tasmota/xsns_01_counter.ino @@ -31,8 +31,8 @@ const char kCounterCommands[] PROGMEM = D_PRFX_COUNTER "|" // Prefix "|" D_CMND_COUNTERTYPE "|" D_CMND_COUNTERDEBOUNCE ; -void (* const CounterCommand[])(void) PROGMEM = - { &CmndCounter, &CmndCounterType, &CmndCounterDebounce }; +void (* const CounterCommand[])(void) PROGMEM = { + &CmndCounter, &CmndCounterType, &CmndCounterDebounce }; struct COUNTER { uint32_t timer[MAX_COUNTERS]; // Last counter time in micro seconds diff --git a/tasmota/xsns_02_analog.ino b/tasmota/xsns_02_analog.ino index ddefb6729..1a4bc090b 100644 --- a/tasmota/xsns_02_analog.ino +++ b/tasmota/xsns_02_analog.ino @@ -186,8 +186,8 @@ void AdcShow(bool json) const char kAdcCommands[] PROGMEM = "|" // No prefix D_CMND_ADC "|" D_CMND_ADCS "|" D_CMND_ADCPARAM; -void (* const AdcCommand[])(void) PROGMEM = - { &CmndAdc, &CmndAdcs, &CmndAdcParam }; +void (* const AdcCommand[])(void) PROGMEM = { + &CmndAdc, &CmndAdcs, &CmndAdcParam }; void CmndAdc(void) {