diff --git a/libraries/Bounce2/Bounce2.cpp b/libraries/Bounce2/Bounce2.cpp index 96e0d16..1d3b1f9 100644 --- a/libraries/Bounce2/Bounce2.cpp +++ b/libraries/Bounce2/Bounce2.cpp @@ -18,7 +18,7 @@ Bounce::Bounce() { void Bounce::attach(int pin) { this->pin = pin; debouncedState = unstableState = digitalRead(pin); - #ifdef BOUNCE_LOCK-OUT + #ifdef BOUNCE_LOCK_OUT previous_millis = 0; #else previous_millis = millis(); @@ -37,7 +37,7 @@ void Bounce::interval(unsigned long interval_millis) bool Bounce::update() { -#ifdef BOUNCE_LOCK-OUT +#ifdef BOUNCE_LOCK_OUT stateChanged = false; // Ignore everything if we are locked out if (millis() - previous_millis >= interval_millis) { diff --git a/libraries/Bounce2/Bounce2.h b/libraries/Bounce2/Bounce2.h index 6d2b62b..86c1520 100644 --- a/libraries/Bounce2/Bounce2.h +++ b/libraries/Bounce2/Bounce2.h @@ -24,7 +24,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ // Uncomment the following line for "LOCK-OUT" debounce method -//#define BOUNCE_LOCK-OUT +//#define BOUNCE_LOCK_OUT #ifndef Bounce2_h diff --git a/libraries/DHT/DHT.cpp b/libraries/DHT/DHT.cpp index d32c83f..1584d6a 100644 --- a/libraries/DHT/DHT.cpp +++ b/libraries/DHT/DHT.cpp @@ -142,9 +142,9 @@ void DHT::readSensor() // - Then 40 bits: RISING and then a FALLING edge per bit // To keep our code simple, we accept any HIGH or LOW reading if it's max 85 usecs long - word rawHumidity; - word rawTemperature; - word data; + word rawHumidity = 0; + word rawTemperature = 0; + word data = 0; for ( int8_t i = -3 ; i < 2 * 40; i++ ) { byte age; diff --git a/libraries/DallasTemperature/DallasTemperature.cpp b/libraries/DallasTemperature/DallasTemperature.cpp index 8cf7515..80ee4f8 100644 --- a/libraries/DallasTemperature/DallasTemperature.cpp +++ b/libraries/DallasTemperature/DallasTemperature.cpp @@ -700,6 +700,7 @@ void DallasTemperature::setAlarmHandler(AlarmHandler *handler) // The default alarm handler void DallasTemperature::defaultAlarmHandler(const uint8_t* deviceAddress) { + (void)deviceAddress; } #endif diff --git a/libraries/DigitalIO/SoftI2cMaster.cpp b/libraries/DigitalIO/SoftI2cMaster.cpp index efc338a..a698636 100644 --- a/libraries/DigitalIO/SoftI2cMaster.cpp +++ b/libraries/DigitalIO/SoftI2cMaster.cpp @@ -50,7 +50,6 @@ */ bool I2cMasterBase::transfer(uint8_t addrRW, void *buf, size_t nbytes, uint8_t option) { - uint8_t* p = reinterpret_cast(buf); if (_state != STATE_REP_START) { start(); } diff --git a/libraries/DigitalIO/SoftI2cMaster.h b/libraries/DigitalIO/SoftI2cMaster.h index e2d559a..7bf3c00 100644 --- a/libraries/DigitalIO/SoftI2cMaster.h +++ b/libraries/DigitalIO/SoftI2cMaster.h @@ -132,7 +132,7 @@ class SoftI2cMaster : public I2cMasterBase { //---------------------------------------------------------------------------- void sclDelay(uint8_t n) {_delay_loop_1(n);} //---------------------------------------------------------------------------- - bool writeScl(bool value) { + void writeScl(bool value) { uint8_t s = SREG; noInterrupts(); if (value == LOW) { @@ -145,7 +145,7 @@ class SoftI2cMaster : public I2cMasterBase { SREG = s; } //---------------------------------------------------------------------------- - bool writeSda(bool value) { + void writeSda(bool value) { uint8_t s = SREG; noInterrupts(); if (value == LOW) { diff --git a/libraries/IRLib/IRLib.cpp b/libraries/IRLib/IRLib.cpp index 7307bac..a8748bd 100644 --- a/libraries/IRLib/IRLib.cpp +++ b/libraries/IRLib/IRLib.cpp @@ -649,7 +649,7 @@ bool IRdecodeRC6::decode(void) { * Hopefully this code is unique for each button. */ #define FNV_PRIME_32 16777619 -#define FNV_BASIS_32 2166136261 +#define FNV_BASIS_32 2166136261UL // Compare two tick values, returning 0 if newval is shorter, // 1 if newval is equal, and 2 if newval is longer int IRdecodeHash::compare(unsigned int oldval, unsigned int newval) { @@ -730,12 +730,12 @@ void IRrecvBase::resume() { bool IRrecvLoop::GetResults(IRdecodeBase *decoder) { bool Finished=false; byte OldState=HIGH;byte NewState; - unsigned long StartTime, DeltaTime, EndTime; + unsigned long StartTime, DeltaTime=0, EndTime=0; StartTime=micros(); while(irparams.rawlen 10000) { //If it's a very long wait - if(Finished=irparams.rawlen) break; //finished unless it's the opening gap + if((Finished=irparams.rawlen)) break; //finished unless it's the opening gap } } if(Finished) break; @@ -798,6 +798,9 @@ void IRrecvPCI_Handler(){ case STATE_IDLE: if(digitalRead(irparams.recvpin)) return; else irparams.rcvstate=STATE_RUNNING; break; + default: + // what of STATE_UNKNOWN, STATE_MARK and STATE_SPACE? + break; }; irparams.rawbuf[irparams.rawlen]=DeltaTime; irparams.timer=ChangeTime; @@ -982,6 +985,9 @@ ISR(TIMER_INTR_NAME) irparams.timer = 0; } break; + default: + // what of STATE_UNKNOWN and STATE_RUNNING? + break; } do_Blink(); } diff --git a/libraries/IRLib/IRLib.h b/libraries/IRLib/IRLib.h index c8e6c38..0dd05a2 100644 --- a/libraries/IRLib/IRLib.h +++ b/libraries/IRLib/IRLib.h @@ -48,7 +48,7 @@ #define RAWBUF 100 // Length of raw duration buffer (cannot exceed 255) -typedef char IRTYPES; //formerly was an enum +typedef unsigned char IRTYPES; //formerly was an enum #define UNKNOWN 0 #define NEC 1 #define SONY 2 diff --git a/libraries/LiquidCrystal/LCD.h b/libraries/LiquidCrystal/LCD.h index 9b977f4..43367aa 100644 --- a/libraries/LiquidCrystal/LCD.h +++ b/libraries/LiquidCrystal/LCD.h @@ -90,6 +90,8 @@ inline static void waitUsec ( uint16_t uSec ) { #ifndef FAST_MODE delayMicroseconds ( uSec ); +#else + (void)uSec; #endif // FAST_MODE } @@ -481,7 +483,7 @@ public: @param value: pin associated to backlight control. @param pol: backlight polarity control (POSITIVE, NEGATIVE) */ - virtual void setBacklightPin ( uint8_t value, t_backlighPol pol ) { }; + virtual void setBacklightPin ( uint8_t /*value*/, t_backlighPol /*pol*/ ) { }; /*! @function @@ -500,7 +502,7 @@ public: BACKLIGHT_OFF will be interpreted as off and BACKLIGHT_ON will drive the backlight on. */ - virtual void setBacklight ( uint8_t value ) { }; + virtual void setBacklight ( uint8_t /*value*/ ) { }; /*! @function @@ -514,9 +516,9 @@ public: @param value[in] Value to write to the LCD. */ #if (ARDUINO < 100) - virtual void write(uint8_t value); + virtual void write(uint8_t /*value*/); #else - virtual size_t write(uint8_t value); + virtual size_t write(uint8_t /*value*/); #endif #if (ARDUINO < 100) @@ -566,9 +568,9 @@ private: the LCD. */ #if (ARDUINO < 100) - virtual void send(uint8_t value, uint8_t mode) { }; + virtual void send(uint8_t /*value*/, uint8_t /*mode*/) { }; #else - virtual void send(uint8_t value, uint8_t mode) = 0; + virtual void send(uint8_t /*value*/, uint8_t /*mode*/) = 0; #endif }; diff --git a/libraries/LiquidCrystal/LiquidCrystal_I2C_ByVac.cpp b/libraries/LiquidCrystal/LiquidCrystal_I2C_ByVac.cpp index 69dd9e7..9f73fab 100644 --- a/libraries/LiquidCrystal/LiquidCrystal_I2C_ByVac.cpp +++ b/libraries/LiquidCrystal/LiquidCrystal_I2C_ByVac.cpp @@ -38,7 +38,7 @@ LiquidCrystal_I2C_ByVac::LiquidCrystal_I2C_ByVac( uint8_t lcd_Addr ) { _Addr = lcd_Addr; - _polarity == NEGATIVE; + _polarity = NEGATIVE; } // PUBLIC METHODS diff --git a/libraries/LiquidCrystal/LiquidCrystal_SR.cpp b/libraries/LiquidCrystal/LiquidCrystal_SR.cpp index a966caa..64aae2f 100644 --- a/libraries/LiquidCrystal/LiquidCrystal_SR.cpp +++ b/libraries/LiquidCrystal/LiquidCrystal_SR.cpp @@ -110,6 +110,8 @@ LiquidCrystal_SR::LiquidCrystal_SR (uint8_t srdata, uint8_t srclock, void LiquidCrystal_SR::init(uint8_t srdata, uint8_t srclock, uint8_t enable, uint8_t lines, uint8_t font) { + (void)lines; + (void)font; // Initialise private variables _two_wire = 0; @@ -200,10 +202,10 @@ void LiquidCrystal_SR::send(uint8_t value, uint8_t mode) // // setBacklightPin void LiquidCrystal_SR::setBacklightPin ( uint8_t pin, t_backlighPol pol ) -{ } +{ (void)pin; (void)pol; } // // setBacklight void LiquidCrystal_SR::setBacklight ( uint8_t mode ) -{ } +{ (void)mode; } diff --git a/libraries/LiquidCrystal/LiquidCrystal_SR1W.cpp b/libraries/LiquidCrystal/LiquidCrystal_SR1W.cpp index f32ef70..a04dfb2 100644 --- a/libraries/LiquidCrystal/LiquidCrystal_SR1W.cpp +++ b/libraries/LiquidCrystal/LiquidCrystal_SR1W.cpp @@ -49,6 +49,8 @@ LiquidCrystal_SR1W::LiquidCrystal_SR1W (uint8_t srdata, t_sr1w_circuitType circu // init void LiquidCrystal_SR1W::init(uint8_t srdata, t_sr1w_circuitType circuitType, t_backlighPol blpol, uint8_t lines, uint8_t font) { + (void)lines; + (void)font; _srRegister = fio_pinToOutputRegister(srdata); _srMask = fio_pinToBit(srdata); diff --git a/libraries/LiquidCrystal/LiquidCrystal_SR1W.h b/libraries/LiquidCrystal/LiquidCrystal_SR1W.h index d71c173..7b26900 100644 --- a/libraries/LiquidCrystal/LiquidCrystal_SR1W.h +++ b/libraries/LiquidCrystal/LiquidCrystal_SR1W.h @@ -154,7 +154,7 @@ // | | | / | 1k // | +--8-|GND Q'H|--9-----+ | // | | +---------+ | | (GND)--(LCD RW) -// | | 0.1uF | \ +/* | | 0.1uF | \ */ // | (GND)-----||----(VCC) +------)--------------(LCD EN) // | | / // |----|<|----+--[ Resistor ]--| | diff --git a/libraries/LiquidCrystal/LiquidCrystal_SR2W.cpp b/libraries/LiquidCrystal/LiquidCrystal_SR2W.cpp index df4559a..e76a585 100644 --- a/libraries/LiquidCrystal/LiquidCrystal_SR2W.cpp +++ b/libraries/LiquidCrystal/LiquidCrystal_SR2W.cpp @@ -47,6 +47,8 @@ LiquidCrystal_SR2W::LiquidCrystal_SR2W (uint8_t srdata, uint8_t srclock, t_backl // init void LiquidCrystal_SR2W::init(uint8_t srdata, uint8_t srclock, t_backlighPol blpol, uint8_t lines, uint8_t font) { + (void)lines; + (void)font; _srDataRegister = fio_pinToOutputRegister(srdata); _srDataMask = fio_pinToBit(srdata); _srClockRegister = fio_pinToOutputRegister(srclock); diff --git a/libraries/MySensors/MyConfig.h b/libraries/MySensors/MyConfig.h index 88db782..a79119a 100644 --- a/libraries/MySensors/MyConfig.h +++ b/libraries/MySensors/MyConfig.h @@ -53,7 +53,7 @@ // but now can be used in any sensor node. Also the LEDs can now be // disabled in the gateway. -//#define WITH_LEDS_BLINKING +// #define WITH_LEDS_BLINKING // The following setting allows you to inverse the blinking feature WITH_LEDS_BLINKING // When WITH_LEDS_BLINKING_INVERSE is enabled LEDSs are normally turned on and switches @@ -103,7 +103,6 @@ // Key to use for HMAC calculation in MySigningAtsha204Soft (32 bytes) #define MY_HMAC_KEY 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 - /********************************** * NRF24L01 Driver Defaults ***********************************/ diff --git a/libraries/MySensors/MySensor.cpp b/libraries/MySensors/MySensor.cpp index 9d6ecb8..2e75d0a 100644 --- a/libraries/MySensors/MySensor.cpp +++ b/libraries/MySensors/MySensor.cpp @@ -550,6 +550,7 @@ boolean MySensor::process() { #endif uint8_t len = radio.receive((uint8_t *)&msg); + (void)len; //until somebody makes use of 'len' #ifdef WITH_LEDS_BLINKING rxBlink(1); #endif diff --git a/libraries/MySensors/MySensor.h b/libraries/MySensors/MySensor.h index 0a54987..3577693 100644 --- a/libraries/MySensors/MySensor.h +++ b/libraries/MySensors/MySensor.h @@ -343,11 +343,6 @@ class MySensor MyMessage msg; // Buffer for incoming messages. MyMessage tmpMsg ; // Buffer for temporary messages (acks and nonces among others). -#ifdef MY_SIGNING_FEATURE - uint16_t doSign[16]; // Bitfield indicating which sensors require signed communication - MyMessage msgSign; // Buffer for message to sign. - MySigning& signer; -#endif #ifdef WITH_LEDS_BLINKING uint8_t pinRx; // Rx led pin @@ -364,6 +359,11 @@ class MySensor #endif MyTransport& radio; +#ifdef MY_SIGNING_FEATURE + uint16_t doSign[16]; // Bitfield indicating which sensors require signed communication + MyMessage msgSign; // Buffer for message to sign. + MySigning& signer; +#endif MyHw& hw; boolean sendWrite(uint8_t dest, MyMessage &message); diff --git a/libraries/MySensors/MySigningAtsha204.cpp b/libraries/MySensors/MySigningAtsha204.cpp index 2baa0dd..29c4d59 100644 --- a/libraries/MySensors/MySigningAtsha204.cpp +++ b/libraries/MySensors/MySigningAtsha204.cpp @@ -28,6 +28,8 @@ #include "MySigning.h" #include "MySigningAtsha204.h" +#define SIGNING_IDENTIFIER (1) + // Uncomment this to get some useful serial debug info (Serial.print and Serial.println expected) //#define DEBUG_SIGNING diff --git a/libraries/MySensors/MySigningAtsha204.h b/libraries/MySensors/MySigningAtsha204.h index 5232c00..188a4aa 100644 --- a/libraries/MySensors/MySigningAtsha204.h +++ b/libraries/MySensors/MySigningAtsha204.h @@ -33,8 +33,6 @@ #include "utility/ATSHA204.h" #include -#define SIGNING_IDENTIFIER (1) - #ifdef MY_SECURE_NODE_WHITELISTING typedef struct { uint8_t nodeId; diff --git a/libraries/MySensors/MySigningAtsha204Soft.cpp b/libraries/MySensors/MySigningAtsha204Soft.cpp index 043d367..971602c 100644 --- a/libraries/MySensors/MySigningAtsha204Soft.cpp +++ b/libraries/MySensors/MySigningAtsha204Soft.cpp @@ -33,6 +33,8 @@ #include "MySigningAtsha204Soft.h" #include "utility/sha256.h" +#define SIGNING_IDENTIFIER (1) + // Uncomment this to get some useful serial debug info (Serial.print and Serial.println expected) //#define DEBUG_SIGNING @@ -72,15 +74,14 @@ MySigningAtsha204Soft::MySigningAtsha204Soft(bool requestSignatures, uint8_t randomseedPin) : MySigning(requestSignatures), - rndPin(randomseedPin), #ifdef MY_SECURE_NODE_WHITELISTING whitlist_sz(nof_whitelist_entries), whitelist(the_whitelist), node_serial_info(the_serial), #endif + Sha256(), verification_ongoing(false), - Sha256() - + rndPin(randomseedPin) { } diff --git a/libraries/MySensors/MySigningAtsha204Soft.h b/libraries/MySensors/MySigningAtsha204Soft.h index 5d8090e..cd65d2c 100644 --- a/libraries/MySensors/MySigningAtsha204Soft.h +++ b/libraries/MySensors/MySigningAtsha204Soft.h @@ -37,8 +37,6 @@ #include "utility/sha256.h" #include -#define SIGNING_IDENTIFIER (1) - #ifdef MY_SECURE_NODE_WHITELISTING typedef struct { uint8_t nodeId; diff --git a/libraries/MySensors/MySigningNone.cpp b/libraries/MySensors/MySigningNone.cpp index a73a375..d9aa5ab 100644 --- a/libraries/MySensors/MySigningNone.cpp +++ b/libraries/MySensors/MySigningNone.cpp @@ -29,6 +29,8 @@ #include "MySigning.h" #include "MySigningNone.h" +#define SIGNING_IDENTIFIER (0) + // Uncomment this to get some useful serial debug info (Serial.print and Serial.println expected) //#define DEBUG_SIGNING @@ -61,6 +63,7 @@ MySigningNone::MySigningNone() : MySigning() { } bool MySigningNone::getNonce(MyMessage &msg) { + (void)msg; return true; } @@ -69,6 +72,7 @@ bool MySigningNone::checkTimer() { } bool MySigningNone::putNonce(MyMessage &msg) { + (void)msg; return true; } diff --git a/libraries/MySensors/MySigningNone.h b/libraries/MySensors/MySigningNone.h index b024b41..4b27103 100644 --- a/libraries/MySensors/MySigningNone.h +++ b/libraries/MySensors/MySigningNone.h @@ -32,8 +32,6 @@ #include "MySigning.h" #include -#define SIGNING_IDENTIFIER (0) - // The "none" signing driver that can be used for nodes // not requiring signing // It does check SIGNING_IDENTIFIER byte to avoid illegal mixing of signing back-ends in diff --git a/libraries/MySensors/MyTransportNRF24.cpp b/libraries/MySensors/MyTransportNRF24.cpp index fee7dca..d11545d 100644 --- a/libraries/MySensors/MyTransportNRF24.cpp +++ b/libraries/MySensors/MyTransportNRF24.cpp @@ -74,6 +74,7 @@ bool MyTransportNRF24::send(uint8_t to, const void* data, uint8_t len) { bool MyTransportNRF24::available(uint8_t *to) { uint8_t pipe = 255; boolean avail = rf24.available(&pipe); + (void)avail; //until somebody makes use of 'avail' if (pipe == CURRENT_NODE_PIPE) *to = _address; else if (pipe == BROADCAST_PIPE) diff --git a/libraries/MySensors/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino b/libraries/MySensors/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino index 40c51da..87d0d6e 100644 --- a/libraries/MySensors/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino +++ b/libraries/MySensors/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino @@ -30,8 +30,6 @@ #include #include -#define DEBUG 1 // Debug enables Serial.print 1 = Yes 0 = No - int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point MySensor gw; @@ -41,7 +39,11 @@ int oldBatteryPcnt = 0; void setup() { // use the 1.1 V internal reference +#if defined(__AVR_ATmega2560__) + analogReference(INTERNAL1V1); +#else analogReference(INTERNAL); +#endif gw.begin(); // Send the sketch version information to the gateway and Controller @@ -52,7 +54,7 @@ void loop() { // get the battery Voltage int sensorValue = analogRead(BATTERY_SENSE_PIN); - #if DEBUG > 0 + #ifdef DEBUG Serial.println(sensorValue); #endif @@ -63,7 +65,7 @@ void loop() float batteryV = sensorValue * 0.003363075; int batteryPcnt = sensorValue / 10; - #if DEBUG > 0 + #ifdef DEBUG Serial.print("Battery Voltage: "); Serial.print(batteryV); Serial.println(" V"); diff --git a/libraries/MySensors/examples/IrrigationController/IrrigationController.ino b/libraries/MySensors/examples/IrrigationController/IrrigationController.ino index 41e6eb9..abd26e0 100644 --- a/libraries/MySensors/examples/IrrigationController/IrrigationController.ino +++ b/libraries/MySensors/examples/IrrigationController/IrrigationController.ino @@ -191,7 +191,7 @@ void setup() //check for saved date in EEPROM DEBUG_PRINTLN(F("Checking EEPROM for stored date:")); delay(500); - if (gw.loadState(0) == 0xFF); // EEPROM flag + if (gw.loadState(0) == 0xFF) // EEPROM flag { DEBUG_PRINTLN(F("Retreiving last run time from EEPROM...")); for (int i = 0; i < 4 ; i++) @@ -439,7 +439,7 @@ void loop() state = STAND_BY_ALL_OFF; } } - else if (state = ZONE_SELECT_MENU) + else if (state == ZONE_SELECT_MENU) { displayMenu(); } @@ -771,6 +771,9 @@ void updateDisplay() lcd.print(totalTimeRan); lcd.print(" Minutes "); } + default: + // what of ZONE_SELECT_MENU? + break; } lastUpdateTime = millis(); } diff --git a/libraries/MySensors/examples/RealTimeClockDisplaySensor/RealTimeClockDisplaySensor.ino b/libraries/MySensors/examples/RealTimeClockDisplaySensor/RealTimeClockDisplaySensor.ino index a4c5944..f0ca797 100644 --- a/libraries/MySensors/examples/RealTimeClockDisplaySensor/RealTimeClockDisplaySensor.ino +++ b/libraries/MySensors/examples/RealTimeClockDisplaySensor/RealTimeClockDisplaySensor.ino @@ -88,8 +88,8 @@ void loop() // If no time has been received yet, request it every 10 second from controller // When time has been received, request update every hour - if ((!timeReceived && now-lastRequest > 10*1000) - || (timeReceived && now-lastRequest > 60*1000*60)) { + if ((!timeReceived && now-lastRequest > (unsigned long)(10*1000)) + || (timeReceived && now-lastRequest > (unsigned long)(60*1000*60))) { // Request time from controller. Serial.println("requesting time"); gw.requestTime(receiveTime); diff --git a/libraries/MySensors/examples/SecureActuator/SecureActuator.ino b/libraries/MySensors/examples/SecureActuator/SecureActuator.ino index 3211d79..ae40fad 100644 --- a/libraries/MySensors/examples/SecureActuator/SecureActuator.ino +++ b/libraries/MySensors/examples/SecureActuator/SecureActuator.ino @@ -85,7 +85,7 @@ void setup() // Fetch lock status for (int lock=1, pin=LOCK_1; lock<=NOF_LOCKS;lock++, pin++) { // Register all locks to gw (they will be created as child devices) - gw.present(lock, S_LOCK, false); + gw.present(lock, S_LOCK, "SecureActuator", false); // Then set lock pins in output mode pinMode(pin, OUTPUT); // Set lock to last known state (using eeprom storage) diff --git a/libraries/MySensors/examples/TouchDisplaySceneControllerSensor/TouchDisplaySceneControllerSensor.ino b/libraries/MySensors/examples/TouchDisplaySceneControllerSensor/TouchDisplaySceneControllerSensor.ino index 7a1946a..c5e9dec 100644 --- a/libraries/MySensors/examples/TouchDisplaySceneControllerSensor/TouchDisplaySceneControllerSensor.ino +++ b/libraries/MySensors/examples/TouchDisplaySceneControllerSensor/TouchDisplaySceneControllerSensor.ino @@ -77,17 +77,19 @@ int RESEND_DEBOUNCE = 2000; // Number of millisecons interval between sending of // Add your buttons here. Max is 5 if you still want time at the top. char *buttons[] = { - "Good Morning", - "Clean Up!", - "All Lights Off", - "Music On/Off" + (char *)"Good Morning", + (char *)"Clean Up!", + (char *)"All Lights Off", + (char *)"Music On/Off" }; const int buttonCount = sizeof(buttons)/sizeof(char *); const int padding = 10; const int topBarHeight = 60; -MySensor gw(17,18); +MyTransportNRF24 radio; // NRFRF24L01 radio driver +MyHwATMega328 hw; // Select AtMega328 hardware profile +MySensor gw(radio, hw); MyMessage on(CHILD_ID, V_SCENE_ON); MyMessage off(CHILD_ID, V_SCENE_OFF); @@ -142,13 +144,12 @@ void loop() unsigned long now = millis(); if (myTouch.dataAvailable()) { - unsigned long startPress = millis(); int pressedButton = myButtons.checkButtons(); if (pressedButton>=0) { - bool longPress = millis()-now>LONG_PRESS; + bool longPress = millis()-now>(unsigned long)LONG_PRESS; - if (pressedButton != lastPressedButton || now-lastPressedButtonTime > RESEND_DEBOUNCE) { + if (pressedButton != lastPressedButton || now-lastPressedButtonTime > (unsigned long)RESEND_DEBOUNCE) { if (longPress) { gw.send(off.set(pressedButton)); Serial.print("Long pressed: "); @@ -165,8 +166,8 @@ void loop() // If no time has been received yet, request it every 10 second from controller // When time has been received, request update every hour - if ((!timeReceived && now-lastRequest > 10*1000) - || (timeReceived && now-lastRequest > 60*1000*60)) { + if ((!timeReceived && now-lastRequest > (unsigned long)10*1000) + || (timeReceived && now-lastRequest > (unsigned long)60*1000*60)) { // Request time from controller. Serial.println("requesting time"); gw.requestTime(receiveTime); diff --git a/libraries/MySensors/utility/ATSHA204.cpp b/libraries/MySensors/utility/ATSHA204.cpp index 504d73d..f639bab 100644 --- a/libraries/MySensors/utility/ATSHA204.cpp +++ b/libraries/MySensors/utility/ATSHA204.cpp @@ -463,7 +463,8 @@ uint8_t ATSHA204Class::sha204m_execute(uint8_t op_code, uint8_t param1, uint16_t uint8_t poll_delay, poll_timeout, response_size; uint8_t *p_buffer; uint8_t len; - + (void)tx_size; + // Supply delays and response size. switch (op_code) { diff --git a/libraries/MySensors/utility/RF24.cpp b/libraries/MySensors/utility/RF24.cpp index 5f5329d..a0d281f 100644 --- a/libraries/MySensors/utility/RF24.cpp +++ b/libraries/MySensors/utility/RF24.cpp @@ -41,7 +41,7 @@ void RF24::csn(bool mode) delayMicroseconds(11); // allow csn to settle } } -#else if !defined (__arm__) || defined (CORE_TEENSY) +#elif !defined (__arm__) || defined (CORE_TEENSY) digitalWrite(csn_pin,mode); #endif diff --git a/libraries/MySensors/utility/RFM69.cpp b/libraries/MySensors/utility/RFM69.cpp index 24bb2d3..4663480 100644 --- a/libraries/MySensors/utility/RFM69.cpp +++ b/libraries/MySensors/utility/RFM69.cpp @@ -55,9 +55,9 @@ bool RFM69::initialize(byte freqBand, byte nodeID, byte networkID) /* 0x05 */ { REG_FDEVMSB, RF_FDEVMSB_50000}, //default:5khz, (FDEV + BitRate/2 <= 500Khz) /* 0x06 */ { REG_FDEVLSB, RF_FDEVLSB_50000}, - /* 0x07 */ { REG_FRFMSB, (freqBand==RF69_315MHZ ? RF_FRFMSB_315 : (freqBand==RF69_433MHZ ? RF_FRFMSB_433 : (freqBand==RF69_868MHZ ? RF_FRFMSB_868 : RF_FRFMSB_915))) }, - /* 0x08 */ { REG_FRFMID, (freqBand==RF69_315MHZ ? RF_FRFMID_315 : (freqBand==RF69_433MHZ ? RF_FRFMID_433 : (freqBand==RF69_868MHZ ? RF_FRFMID_868 : RF_FRFMID_915))) }, - /* 0x09 */ { REG_FRFLSB, (freqBand==RF69_315MHZ ? RF_FRFLSB_315 : (freqBand==RF69_433MHZ ? RF_FRFLSB_433 : (freqBand==RF69_868MHZ ? RF_FRFLSB_868 : RF_FRFLSB_915))) }, + /* 0x07 */ { REG_FRFMSB, (freqBand==RF69_315MHZ ? (const byte)RF_FRFMSB_315 : (freqBand==RF69_433MHZ ? (const byte)RF_FRFMSB_433 : (freqBand==RF69_868MHZ ? (const byte)RF_FRFMSB_868 : (const byte)RF_FRFMSB_915))) }, + /* 0x08 */ { REG_FRFMID, (freqBand==RF69_315MHZ ? (const byte)RF_FRFMID_315 : (freqBand==RF69_433MHZ ? (const byte)RF_FRFMID_433 : (freqBand==RF69_868MHZ ? (const byte)RF_FRFMID_868 : (const byte)RF_FRFMID_915))) }, + /* 0x09 */ { REG_FRFLSB, (freqBand==RF69_315MHZ ? (const byte)RF_FRFLSB_315 : (freqBand==RF69_433MHZ ? (const byte)RF_FRFLSB_433 : (freqBand==RF69_868MHZ ? (const byte)RF_FRFLSB_868 : (const byte)RF_FRFLSB_915))) }, // looks like PA1 and PA2 are not implemented on RFM69W, hence the max output power is 13dBm // +17dBm and +20dBm are possible on RFM69HW diff --git a/libraries/PN532/PN532.cpp b/libraries/PN532/PN532.cpp index c6c5490..a9ab4c6 100644 --- a/libraries/PN532/PN532.cpp +++ b/libraries/PN532/PN532.cpp @@ -61,6 +61,7 @@ void PN532::begin() /**************************************************************************/ void PN532::PrintHex(const uint8_t *data, const uint32_t numBytes) { + (void)data; for (uint8_t i = 0; i < numBytes; i++) { DMSG("0x"); DMSG_HEX(data[i]); @@ -86,11 +87,11 @@ void PN532::PrintHexChar(const uint8_t *data, const uint32_t numBytes) } DMSG(" "); for (uint8_t i = 0; i < numBytes; i++) { - char c = data[i]; + uint8_t c = data[i]; if (c <= 0x1f || c > 0x7f) { DMSG('.'); } else { - DMSG(c); + DMSG((char)c); } } @@ -548,7 +549,7 @@ uint8_t PN532::mifareclassic_WriteNDEFURI (uint8_t sectorNumber, uint8_t uriIden // in NDEF records // Setup the sector buffer (w/pre-formatted TLV wrapper and NDEF message) - uint8_t sectorbuffer1[16] = {0x00, 0x00, 0x03, len + 5, 0xD1, 0x01, len + 1, 0x55, uriIdentifier, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + uint8_t sectorbuffer1[16] = {0x00, 0x00, 0x03, (uint8_t)(len + 5), 0xD1, 0x01, (uint8_t)(len + 1), 0x55, uriIdentifier, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; uint8_t sectorbuffer2[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; uint8_t sectorbuffer3[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; uint8_t sectorbuffer4[16] = {0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7, 0x7F, 0x07, 0x88, 0x40, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; @@ -653,6 +654,7 @@ uint8_t PN532::mifareultralight_ReadPage (uint8_t page, uint8_t *buffer) bool PN532::inDataExchange(uint8_t *send, uint8_t sendLength, uint8_t *response, uint8_t *responseLength) { uint8_t i; + (void)i; pn532_packetbuffer[0] = 0x40; // PN532_COMMAND_INDATAEXCHANGE; pn532_packetbuffer[1] = inListedTag; diff --git a/libraries/PN532/llcp.cpp b/libraries/PN532/llcp.cpp index ad00236..68da733 100644 --- a/libraries/PN532/llcp.cpp +++ b/libraries/PN532/llcp.cpp @@ -37,6 +37,7 @@ int8_t LLCP::activate(uint16_t timeout) int8_t LLCP::waitForConnection(uint16_t timeout) { uint8_t type; + (void)timeout; sequence = 0; @@ -76,6 +77,7 @@ int8_t LLCP::waitForConnection(uint16_t timeout) int8_t LLCP::waitForDisconnection(uint16_t timeout) { uint8_t type; + (void)timeout; // Get DISC PDU DMSG("wait for a DISC PDU\n"); @@ -113,6 +115,7 @@ int8_t LLCP::waitForDisconnection(uint16_t timeout) int8_t LLCP::connect(uint16_t timeout) { uint8_t type; + (void)timeout; sequence = 0; @@ -165,6 +168,7 @@ int8_t LLCP::connect(uint16_t timeout) int8_t LLCP::disconnect(uint16_t timeout) { uint8_t type; + (void)timeout; // try to get a SYMM PDU if (2 > link.read(headerBuf, headerBufLen)) { @@ -207,7 +211,6 @@ int8_t LLCP::disconnect(uint16_t timeout) bool LLCP::write(const uint8_t *header, uint8_t hlen, const uint8_t *body, uint8_t blen) { - uint8_t type; uint8_t buf[3]; if (2 != link.read(buf, sizeof(buf))) { diff --git a/libraries/PN532/snep.cpp b/libraries/PN532/snep.cpp index 650532d..f690878 100644 --- a/libraries/PN532/snep.cpp +++ b/libraries/PN532/snep.cpp @@ -79,7 +79,7 @@ int16_t SNEP::read(uint8_t *buf, uint8_t len, uint16_t timeout) } // check message's length - uint32_t length = (buf[2] << 24) + (buf[3] << 16) + (buf[4] << 8) + buf[5]; + uint32_t length = ((uint32_t)buf[2] << 24) + ((uint32_t)buf[3] << 16) + (buf[4] << 8) + buf[5]; // length should not be more than 244 (header + body < 255, header = 6 + 3 + 2) if (length > (status - 6)) { DMSG("The SNEP message is too large\n"); diff --git a/libraries/PWF_AS3935_Lightning_Sensor/PWFusion_AS3935.cpp b/libraries/PWF_AS3935_Lightning_Sensor/PWFusion_AS3935.cpp index 1d2b8a0..b512121 100644 --- a/libraries/PWF_AS3935_Lightning_Sensor/PWFusion_AS3935.cpp +++ b/libraries/PWF_AS3935_Lightning_Sensor/PWFusion_AS3935.cpp @@ -78,15 +78,8 @@ uint8_t PWF_AS3935::_sing_reg_read(uint8_t RegAdd) void PWF_AS3935::_sing_reg_write(uint8_t RegAdd, uint8_t DataMask, uint8_t RegData) { - // start by reading original register data (only modifying what we need to) - uint8_t OrigRegData = _sing_reg_read(RegAdd); - - // calculate new register data... 'delete' old targeted data, replace with new data - // note: 'DataMask' must be bits targeted for replacement - // add'l note: this function does NOT shift values into the proper place... they need to be there already - uint8_t NewRegData = ((OrigRegData & ~DataMask) | (RegData & DataMask)); - - // now configure and write the updated register value + (void)DataMask; + // Configure and write the updated register value digitalWrite(_cs, LOW); // set pin low to start talking to IC // next pack command byte, send AS3935.... structure is shown below // MODE Register Address/Direct Cmd @@ -228,7 +221,7 @@ uint32_t PWF_AS3935::AS3935_GetStrikeEnergyRaw(void) { uint32_t nrgy_raw = ((_sing_reg_read(0x06) & 0x1F) << 8); // MMSB, shift 8 bits left, make room for MSB nrgy_raw |= _sing_reg_read(0x05); // read MSB - nrgy_raw <= 8; // shift 8 bits left, make room for LSB + nrgy_raw <<= 8; // shift 8 bits left, make room for LSB nrgy_raw |= _sing_reg_read(0x04); // read LSB, add to others return nrgy_raw; diff --git a/libraries/PinChangeInt/PinChangeInt.h b/libraries/PinChangeInt/PinChangeInt.h index 807b20d..6ccd1df 100644 --- a/libraries/PinChangeInt/PinChangeInt.h +++ b/libraries/PinChangeInt/PinChangeInt.h @@ -474,7 +474,8 @@ void PCintPort::detachInterrupt(uint8_t arduinoPin) // there isn't really a good way to back-map ports and masks to pins. void PCintPort::PCint() { uint8_t thisChangedPin; //MIKE - + (void)thisChangedPin; + #ifdef FLASH if (*led_port & led_mask) *led_port&=not_led_mask; else *led_port|=led_mask; diff --git a/libraries/RemoteSwitch/RemoteTransmitter.cpp b/libraries/RemoteSwitch/RemoteTransmitter.cpp index d4df6e6..648b5a8 100644 --- a/libraries/RemoteSwitch/RemoteTransmitter.cpp +++ b/libraries/RemoteSwitch/RemoteTransmitter.cpp @@ -230,6 +230,7 @@ unsigned long KaKuTransmitter::getTelegram(char address, byte device, boolean on } void KaKuTransmitter::sendSignal(char address, byte group, byte device, boolean on) { + (void)device; sendTelegram(getTelegram(address, group, on), _pin); } diff --git a/libraries/UTFT/UTFT.cpp b/libraries/UTFT/UTFT.cpp index 5bfd21d..17da918 100644 --- a/libraries/UTFT/UTFT.cpp +++ b/libraries/UTFT/UTFT.cpp @@ -854,8 +854,8 @@ void UTFT::printChar(byte c, int x, int y) { setXY(x,y,x+cfont.x_size-1,y+cfont.y_size-1); - temp=((c-cfont.offset)*((cfont.x_size/8)*cfont.y_size))+4; - for(j=0;j<((cfont.x_size/8)*cfont.y_size);j++) + temp=(word)((c-cfont.offset)*((cfont.x_size/8)*cfont.y_size))+4; + for(j=0;j<(word)((cfont.x_size/8)*cfont.y_size);j++) { ch=pgm_read_byte(&cfont.font[temp]); for(i=0;i<8;i++) @@ -876,7 +876,7 @@ void UTFT::printChar(byte c, int x, int y) { temp=((c-cfont.offset)*((cfont.x_size/8)*cfont.y_size))+4; - for(j=0;j<((cfont.x_size/8)*cfont.y_size);j+=(cfont.x_size/8)) + for(j=0;j<(word)((cfont.x_size/8)*cfont.y_size);j+=(cfont.x_size/8)) { setXY(x,y+(j/(cfont.x_size/8)),x+cfont.x_size-1,y+(j/(cfont.x_size/8))); for (int zz=(cfont.x_size/8)-1; zz>=0; zz--) @@ -1080,7 +1080,7 @@ void UTFT::printNumF(double num, byte dec, int x, int y, char divider, int lengt if (divider != '.') { - for (int i=0; i= buttons[i].pos_x) and (touch_x <= (buttons[i].pos_x + buttons[i].width)) and (touch_y >= buttons[i].pos_y) and (touch_y <= (buttons[i].pos_y + buttons[i].height))) + if ((touch_x >= (int)buttons[i].pos_x) and (touch_x <= (int)(buttons[i].pos_x + buttons[i].width)) and (touch_y >= (int)buttons[i].pos_y) and (touch_y <= (int)(buttons[i].pos_y + buttons[i].height))) result = i; } } diff --git a/libraries/sha204/sha204_library.cpp b/libraries/sha204/sha204_library.cpp index 8e43890..8728096 100644 --- a/libraries/sha204/sha204_library.cpp +++ b/libraries/sha204/sha204_library.cpp @@ -791,6 +791,19 @@ uint8_t atsha204Class::sha204m_check_parameters(uint8_t op_code, uint8_t param1, return SHA204_SUCCESS; #else + (void)rx_size; + (void)tx_size; + (void)tx_buffer; + (void)rx_buffer; + (void)param1; + (void)param2; + (void)data1; + (void)data2; + (void)data3; + (void)datalen1; + (void)datalen2; + (void)datalen3; + (void)op_code; return SHA204_SUCCESS; #endif }