Resolved various compiler warnings
This should make Jenkins happy.
This commit is contained in:
@@ -18,7 +18,7 @@ Bounce::Bounce() {
|
|||||||
void Bounce::attach(int pin) {
|
void Bounce::attach(int pin) {
|
||||||
this->pin = pin;
|
this->pin = pin;
|
||||||
debouncedState = unstableState = digitalRead(pin);
|
debouncedState = unstableState = digitalRead(pin);
|
||||||
#ifdef BOUNCE_LOCK-OUT
|
#ifdef BOUNCE_LOCK_OUT
|
||||||
previous_millis = 0;
|
previous_millis = 0;
|
||||||
#else
|
#else
|
||||||
previous_millis = millis();
|
previous_millis = millis();
|
||||||
@@ -37,7 +37,7 @@ void Bounce::interval(unsigned long interval_millis)
|
|||||||
bool Bounce::update()
|
bool Bounce::update()
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef BOUNCE_LOCK-OUT
|
#ifdef BOUNCE_LOCK_OUT
|
||||||
stateChanged = false;
|
stateChanged = false;
|
||||||
// Ignore everything if we are locked out
|
// Ignore everything if we are locked out
|
||||||
if (millis() - previous_millis >= interval_millis) {
|
if (millis() - previous_millis >= interval_millis) {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
// Uncomment the following line for "LOCK-OUT" debounce method
|
// Uncomment the following line for "LOCK-OUT" debounce method
|
||||||
//#define BOUNCE_LOCK-OUT
|
//#define BOUNCE_LOCK_OUT
|
||||||
|
|
||||||
|
|
||||||
#ifndef Bounce2_h
|
#ifndef Bounce2_h
|
||||||
|
|||||||
@@ -142,9 +142,9 @@ void DHT::readSensor()
|
|||||||
// - Then 40 bits: RISING and then a FALLING edge per bit
|
// - 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
|
// To keep our code simple, we accept any HIGH or LOW reading if it's max 85 usecs long
|
||||||
|
|
||||||
word rawHumidity;
|
word rawHumidity = 0;
|
||||||
word rawTemperature;
|
word rawTemperature = 0;
|
||||||
word data;
|
word data = 0;
|
||||||
|
|
||||||
for ( int8_t i = -3 ; i < 2 * 40; i++ ) {
|
for ( int8_t i = -3 ; i < 2 * 40; i++ ) {
|
||||||
byte age;
|
byte age;
|
||||||
|
|||||||
@@ -700,6 +700,7 @@ void DallasTemperature::setAlarmHandler(AlarmHandler *handler)
|
|||||||
// The default alarm handler
|
// The default alarm handler
|
||||||
void DallasTemperature::defaultAlarmHandler(const uint8_t* deviceAddress)
|
void DallasTemperature::defaultAlarmHandler(const uint8_t* deviceAddress)
|
||||||
{
|
{
|
||||||
|
(void)deviceAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -50,7 +50,6 @@
|
|||||||
*/
|
*/
|
||||||
bool I2cMasterBase::transfer(uint8_t addrRW,
|
bool I2cMasterBase::transfer(uint8_t addrRW,
|
||||||
void *buf, size_t nbytes, uint8_t option) {
|
void *buf, size_t nbytes, uint8_t option) {
|
||||||
uint8_t* p = reinterpret_cast<uint8_t*>(buf);
|
|
||||||
if (_state != STATE_REP_START) {
|
if (_state != STATE_REP_START) {
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class SoftI2cMaster : public I2cMasterBase {
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void sclDelay(uint8_t n) {_delay_loop_1(n);}
|
void sclDelay(uint8_t n) {_delay_loop_1(n);}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool writeScl(bool value) {
|
void writeScl(bool value) {
|
||||||
uint8_t s = SREG;
|
uint8_t s = SREG;
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
if (value == LOW) {
|
if (value == LOW) {
|
||||||
@@ -145,7 +145,7 @@ class SoftI2cMaster : public I2cMasterBase {
|
|||||||
SREG = s;
|
SREG = s;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool writeSda(bool value) {
|
void writeSda(bool value) {
|
||||||
uint8_t s = SREG;
|
uint8_t s = SREG;
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
if (value == LOW) {
|
if (value == LOW) {
|
||||||
|
|||||||
@@ -649,7 +649,7 @@ bool IRdecodeRC6::decode(void) {
|
|||||||
* Hopefully this code is unique for each button.
|
* Hopefully this code is unique for each button.
|
||||||
*/
|
*/
|
||||||
#define FNV_PRIME_32 16777619
|
#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,
|
// Compare two tick values, returning 0 if newval is shorter,
|
||||||
// 1 if newval is equal, and 2 if newval is longer
|
// 1 if newval is equal, and 2 if newval is longer
|
||||||
int IRdecodeHash::compare(unsigned int oldval, unsigned int newval) {
|
int IRdecodeHash::compare(unsigned int oldval, unsigned int newval) {
|
||||||
@@ -730,12 +730,12 @@ void IRrecvBase::resume() {
|
|||||||
bool IRrecvLoop::GetResults(IRdecodeBase *decoder) {
|
bool IRrecvLoop::GetResults(IRdecodeBase *decoder) {
|
||||||
bool Finished=false;
|
bool Finished=false;
|
||||||
byte OldState=HIGH;byte NewState;
|
byte OldState=HIGH;byte NewState;
|
||||||
unsigned long StartTime, DeltaTime, EndTime;
|
unsigned long StartTime, DeltaTime=0, EndTime=0;
|
||||||
StartTime=micros();
|
StartTime=micros();
|
||||||
while(irparams.rawlen<RAWBUF) { //While the buffer not overflowing
|
while(irparams.rawlen<RAWBUF) { //While the buffer not overflowing
|
||||||
while(OldState==(NewState=digitalRead(irparams.recvpin))) { //While the pin hasn't changed
|
while(OldState==(NewState=digitalRead(irparams.recvpin))) { //While the pin hasn't changed
|
||||||
if( (DeltaTime = (EndTime=micros()) - StartTime) > 10000) { //If it's a very long wait
|
if( (DeltaTime = (EndTime=micros()) - StartTime) > 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;
|
if(Finished) break;
|
||||||
@@ -798,6 +798,9 @@ void IRrecvPCI_Handler(){
|
|||||||
case STATE_IDLE:
|
case STATE_IDLE:
|
||||||
if(digitalRead(irparams.recvpin)) return; else irparams.rcvstate=STATE_RUNNING;
|
if(digitalRead(irparams.recvpin)) return; else irparams.rcvstate=STATE_RUNNING;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
// what of STATE_UNKNOWN, STATE_MARK and STATE_SPACE?
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
irparams.rawbuf[irparams.rawlen]=DeltaTime;
|
irparams.rawbuf[irparams.rawlen]=DeltaTime;
|
||||||
irparams.timer=ChangeTime;
|
irparams.timer=ChangeTime;
|
||||||
@@ -982,6 +985,9 @@ ISR(TIMER_INTR_NAME)
|
|||||||
irparams.timer = 0;
|
irparams.timer = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
// what of STATE_UNKNOWN and STATE_RUNNING?
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
do_Blink();
|
do_Blink();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
#define RAWBUF 100 // Length of raw duration buffer (cannot exceed 255)
|
#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 UNKNOWN 0
|
||||||
#define NEC 1
|
#define NEC 1
|
||||||
#define SONY 2
|
#define SONY 2
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ inline static void waitUsec ( uint16_t uSec )
|
|||||||
{
|
{
|
||||||
#ifndef FAST_MODE
|
#ifndef FAST_MODE
|
||||||
delayMicroseconds ( uSec );
|
delayMicroseconds ( uSec );
|
||||||
|
#else
|
||||||
|
(void)uSec;
|
||||||
#endif // FAST_MODE
|
#endif // FAST_MODE
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,7 +483,7 @@ public:
|
|||||||
@param value: pin associated to backlight control.
|
@param value: pin associated to backlight control.
|
||||||
@param pol: backlight polarity control (POSITIVE, NEGATIVE)
|
@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
|
@function
|
||||||
@@ -500,7 +502,7 @@ public:
|
|||||||
BACKLIGHT_OFF will be interpreted as off and BACKLIGHT_ON will drive the
|
BACKLIGHT_OFF will be interpreted as off and BACKLIGHT_ON will drive the
|
||||||
backlight on.
|
backlight on.
|
||||||
*/
|
*/
|
||||||
virtual void setBacklight ( uint8_t value ) { };
|
virtual void setBacklight ( uint8_t /*value*/ ) { };
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function
|
@function
|
||||||
@@ -514,9 +516,9 @@ public:
|
|||||||
@param value[in] Value to write to the LCD.
|
@param value[in] Value to write to the LCD.
|
||||||
*/
|
*/
|
||||||
#if (ARDUINO < 100)
|
#if (ARDUINO < 100)
|
||||||
virtual void write(uint8_t value);
|
virtual void write(uint8_t /*value*/);
|
||||||
#else
|
#else
|
||||||
virtual size_t write(uint8_t value);
|
virtual size_t write(uint8_t /*value*/);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (ARDUINO < 100)
|
#if (ARDUINO < 100)
|
||||||
@@ -566,9 +568,9 @@ private:
|
|||||||
the LCD.
|
the LCD.
|
||||||
*/
|
*/
|
||||||
#if (ARDUINO < 100)
|
#if (ARDUINO < 100)
|
||||||
virtual void send(uint8_t value, uint8_t mode) { };
|
virtual void send(uint8_t /*value*/, uint8_t /*mode*/) { };
|
||||||
#else
|
#else
|
||||||
virtual void send(uint8_t value, uint8_t mode) = 0;
|
virtual void send(uint8_t /*value*/, uint8_t /*mode*/) = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
LiquidCrystal_I2C_ByVac::LiquidCrystal_I2C_ByVac( uint8_t lcd_Addr )
|
LiquidCrystal_I2C_ByVac::LiquidCrystal_I2C_ByVac( uint8_t lcd_Addr )
|
||||||
{
|
{
|
||||||
_Addr = lcd_Addr;
|
_Addr = lcd_Addr;
|
||||||
_polarity == NEGATIVE;
|
_polarity = NEGATIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUBLIC METHODS
|
// PUBLIC METHODS
|
||||||
|
|||||||
@@ -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,
|
void LiquidCrystal_SR::init(uint8_t srdata, uint8_t srclock, uint8_t enable,
|
||||||
uint8_t lines, uint8_t font)
|
uint8_t lines, uint8_t font)
|
||||||
{
|
{
|
||||||
|
(void)lines;
|
||||||
|
(void)font;
|
||||||
// Initialise private variables
|
// Initialise private variables
|
||||||
_two_wire = 0;
|
_two_wire = 0;
|
||||||
|
|
||||||
@@ -200,10 +202,10 @@ void LiquidCrystal_SR::send(uint8_t value, uint8_t mode)
|
|||||||
//
|
//
|
||||||
// setBacklightPin
|
// setBacklightPin
|
||||||
void LiquidCrystal_SR::setBacklightPin ( uint8_t pin, t_backlighPol pol )
|
void LiquidCrystal_SR::setBacklightPin ( uint8_t pin, t_backlighPol pol )
|
||||||
{ }
|
{ (void)pin; (void)pol; }
|
||||||
|
|
||||||
//
|
//
|
||||||
// setBacklight
|
// setBacklight
|
||||||
void LiquidCrystal_SR::setBacklight ( uint8_t mode )
|
void LiquidCrystal_SR::setBacklight ( uint8_t mode )
|
||||||
{ }
|
{ (void)mode; }
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ LiquidCrystal_SR1W::LiquidCrystal_SR1W (uint8_t srdata, t_sr1w_circuitType circu
|
|||||||
// init
|
// init
|
||||||
void LiquidCrystal_SR1W::init(uint8_t srdata, t_sr1w_circuitType circuitType, t_backlighPol blpol, uint8_t lines, uint8_t font)
|
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);
|
_srRegister = fio_pinToOutputRegister(srdata);
|
||||||
_srMask = fio_pinToBit(srdata);
|
_srMask = fio_pinToBit(srdata);
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@
|
|||||||
// | | | / | 1k
|
// | | | / | 1k
|
||||||
// | +--8-|GND Q'H|--9-----+ |
|
// | +--8-|GND Q'H|--9-----+ |
|
||||||
// | | +---------+ | | (GND)--(LCD RW)
|
// | | +---------+ | | (GND)--(LCD RW)
|
||||||
// | | 0.1uF | \
|
/* | | 0.1uF | \ */
|
||||||
// | (GND)-----||----(VCC) +------)--------------(LCD EN)
|
// | (GND)-----||----(VCC) +------)--------------(LCD EN)
|
||||||
// | | /
|
// | | /
|
||||||
// |----|<|----+--[ Resistor ]--| |
|
// |----|<|----+--[ Resistor ]--| |
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ LiquidCrystal_SR2W::LiquidCrystal_SR2W (uint8_t srdata, uint8_t srclock, t_backl
|
|||||||
// init
|
// init
|
||||||
void LiquidCrystal_SR2W::init(uint8_t srdata, uint8_t srclock, t_backlighPol blpol, uint8_t lines, uint8_t font)
|
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);
|
_srDataRegister = fio_pinToOutputRegister(srdata);
|
||||||
_srDataMask = fio_pinToBit(srdata);
|
_srDataMask = fio_pinToBit(srdata);
|
||||||
_srClockRegister = fio_pinToOutputRegister(srclock);
|
_srClockRegister = fio_pinToOutputRegister(srclock);
|
||||||
|
|||||||
@@ -103,7 +103,6 @@
|
|||||||
// Key to use for HMAC calculation in MySigningAtsha204Soft (32 bytes)
|
// 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
|
#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
|
* NRF24L01 Driver Defaults
|
||||||
***********************************/
|
***********************************/
|
||||||
|
|||||||
@@ -550,6 +550,7 @@ boolean MySensor::process() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t len = radio.receive((uint8_t *)&msg);
|
uint8_t len = radio.receive((uint8_t *)&msg);
|
||||||
|
(void)len; //until somebody makes use of 'len'
|
||||||
#ifdef WITH_LEDS_BLINKING
|
#ifdef WITH_LEDS_BLINKING
|
||||||
rxBlink(1);
|
rxBlink(1);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -343,11 +343,6 @@ class MySensor
|
|||||||
|
|
||||||
MyMessage msg; // Buffer for incoming messages.
|
MyMessage msg; // Buffer for incoming messages.
|
||||||
MyMessage tmpMsg ; // Buffer for temporary messages (acks and nonces among others).
|
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
|
#ifdef WITH_LEDS_BLINKING
|
||||||
uint8_t pinRx; // Rx led pin
|
uint8_t pinRx; // Rx led pin
|
||||||
@@ -364,6 +359,11 @@ class MySensor
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
MyTransport& radio;
|
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;
|
MyHw& hw;
|
||||||
|
|
||||||
boolean sendWrite(uint8_t dest, MyMessage &message);
|
boolean sendWrite(uint8_t dest, MyMessage &message);
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
#include "MySigning.h"
|
#include "MySigning.h"
|
||||||
#include "MySigningAtsha204.h"
|
#include "MySigningAtsha204.h"
|
||||||
|
|
||||||
|
#define SIGNING_IDENTIFIER (1)
|
||||||
|
|
||||||
// Uncomment this to get some useful serial debug info (Serial.print and Serial.println expected)
|
// Uncomment this to get some useful serial debug info (Serial.print and Serial.println expected)
|
||||||
//#define DEBUG_SIGNING
|
//#define DEBUG_SIGNING
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,6 @@
|
|||||||
#include "utility/ATSHA204.h"
|
#include "utility/ATSHA204.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define SIGNING_IDENTIFIER (1)
|
|
||||||
|
|
||||||
#ifdef MY_SECURE_NODE_WHITELISTING
|
#ifdef MY_SECURE_NODE_WHITELISTING
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t nodeId;
|
uint8_t nodeId;
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include "MySigningAtsha204Soft.h"
|
#include "MySigningAtsha204Soft.h"
|
||||||
#include "utility/sha256.h"
|
#include "utility/sha256.h"
|
||||||
|
|
||||||
|
#define SIGNING_IDENTIFIER (1)
|
||||||
|
|
||||||
// Uncomment this to get some useful serial debug info (Serial.print and Serial.println expected)
|
// Uncomment this to get some useful serial debug info (Serial.print and Serial.println expected)
|
||||||
//#define DEBUG_SIGNING
|
//#define DEBUG_SIGNING
|
||||||
|
|
||||||
@@ -72,15 +74,14 @@ MySigningAtsha204Soft::MySigningAtsha204Soft(bool requestSignatures,
|
|||||||
uint8_t randomseedPin)
|
uint8_t randomseedPin)
|
||||||
:
|
:
|
||||||
MySigning(requestSignatures),
|
MySigning(requestSignatures),
|
||||||
rndPin(randomseedPin),
|
|
||||||
#ifdef MY_SECURE_NODE_WHITELISTING
|
#ifdef MY_SECURE_NODE_WHITELISTING
|
||||||
whitlist_sz(nof_whitelist_entries),
|
whitlist_sz(nof_whitelist_entries),
|
||||||
whitelist(the_whitelist),
|
whitelist(the_whitelist),
|
||||||
node_serial_info(the_serial),
|
node_serial_info(the_serial),
|
||||||
#endif
|
#endif
|
||||||
|
Sha256(),
|
||||||
verification_ongoing(false),
|
verification_ongoing(false),
|
||||||
Sha256()
|
rndPin(randomseedPin)
|
||||||
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,6 @@
|
|||||||
#include "utility/sha256.h"
|
#include "utility/sha256.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define SIGNING_IDENTIFIER (1)
|
|
||||||
|
|
||||||
#ifdef MY_SECURE_NODE_WHITELISTING
|
#ifdef MY_SECURE_NODE_WHITELISTING
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t nodeId;
|
uint8_t nodeId;
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
#include "MySigning.h"
|
#include "MySigning.h"
|
||||||
#include "MySigningNone.h"
|
#include "MySigningNone.h"
|
||||||
|
|
||||||
|
#define SIGNING_IDENTIFIER (0)
|
||||||
|
|
||||||
// Uncomment this to get some useful serial debug info (Serial.print and Serial.println expected)
|
// Uncomment this to get some useful serial debug info (Serial.print and Serial.println expected)
|
||||||
//#define DEBUG_SIGNING
|
//#define DEBUG_SIGNING
|
||||||
|
|
||||||
@@ -61,6 +63,7 @@ MySigningNone::MySigningNone() : MySigning() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool MySigningNone::getNonce(MyMessage &msg) {
|
bool MySigningNone::getNonce(MyMessage &msg) {
|
||||||
|
(void)msg;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,6 +72,7 @@ bool MySigningNone::checkTimer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool MySigningNone::putNonce(MyMessage &msg) {
|
bool MySigningNone::putNonce(MyMessage &msg) {
|
||||||
|
(void)msg;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,6 @@
|
|||||||
#include "MySigning.h"
|
#include "MySigning.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define SIGNING_IDENTIFIER (0)
|
|
||||||
|
|
||||||
// The "none" signing driver that can be used for nodes
|
// The "none" signing driver that can be used for nodes
|
||||||
// not requiring signing
|
// not requiring signing
|
||||||
// It does check SIGNING_IDENTIFIER byte to avoid illegal mixing of signing back-ends in
|
// It does check SIGNING_IDENTIFIER byte to avoid illegal mixing of signing back-ends in
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ bool MyTransportNRF24::send(uint8_t to, const void* data, uint8_t len) {
|
|||||||
bool MyTransportNRF24::available(uint8_t *to) {
|
bool MyTransportNRF24::available(uint8_t *to) {
|
||||||
uint8_t pipe = 255;
|
uint8_t pipe = 255;
|
||||||
boolean avail = rf24.available(&pipe);
|
boolean avail = rf24.available(&pipe);
|
||||||
|
(void)avail; //until somebody makes use of 'avail'
|
||||||
if (pipe == CURRENT_NODE_PIPE)
|
if (pipe == CURRENT_NODE_PIPE)
|
||||||
*to = _address;
|
*to = _address;
|
||||||
else if (pipe == BROADCAST_PIPE)
|
else if (pipe == BROADCAST_PIPE)
|
||||||
|
|||||||
@@ -30,8 +30,6 @@
|
|||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <MySensor.h>
|
#include <MySensor.h>
|
||||||
|
|
||||||
#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
|
int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point
|
||||||
|
|
||||||
MySensor gw;
|
MySensor gw;
|
||||||
@@ -41,7 +39,11 @@ int oldBatteryPcnt = 0;
|
|||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
// use the 1.1 V internal reference
|
// use the 1.1 V internal reference
|
||||||
|
#if defined(__AVR_ATmega2560__)
|
||||||
|
analogReference(INTERNAL1V1);
|
||||||
|
#else
|
||||||
analogReference(INTERNAL);
|
analogReference(INTERNAL);
|
||||||
|
#endif
|
||||||
gw.begin();
|
gw.begin();
|
||||||
|
|
||||||
// Send the sketch version information to the gateway and Controller
|
// Send the sketch version information to the gateway and Controller
|
||||||
@@ -52,7 +54,7 @@ void loop()
|
|||||||
{
|
{
|
||||||
// get the battery Voltage
|
// get the battery Voltage
|
||||||
int sensorValue = analogRead(BATTERY_SENSE_PIN);
|
int sensorValue = analogRead(BATTERY_SENSE_PIN);
|
||||||
#if DEBUG > 0
|
#ifdef DEBUG
|
||||||
Serial.println(sensorValue);
|
Serial.println(sensorValue);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -63,7 +65,7 @@ void loop()
|
|||||||
float batteryV = sensorValue * 0.003363075;
|
float batteryV = sensorValue * 0.003363075;
|
||||||
int batteryPcnt = sensorValue / 10;
|
int batteryPcnt = sensorValue / 10;
|
||||||
|
|
||||||
#if DEBUG > 0
|
#ifdef DEBUG
|
||||||
Serial.print("Battery Voltage: ");
|
Serial.print("Battery Voltage: ");
|
||||||
Serial.print(batteryV);
|
Serial.print(batteryV);
|
||||||
Serial.println(" V");
|
Serial.println(" V");
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ void setup()
|
|||||||
//check for saved date in EEPROM
|
//check for saved date in EEPROM
|
||||||
DEBUG_PRINTLN(F("Checking EEPROM for stored date:"));
|
DEBUG_PRINTLN(F("Checking EEPROM for stored date:"));
|
||||||
delay(500);
|
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..."));
|
DEBUG_PRINTLN(F("Retreiving last run time from EEPROM..."));
|
||||||
for (int i = 0; i < 4 ; i++)
|
for (int i = 0; i < 4 ; i++)
|
||||||
@@ -439,7 +439,7 @@ void loop()
|
|||||||
state = STAND_BY_ALL_OFF;
|
state = STAND_BY_ALL_OFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (state = ZONE_SELECT_MENU)
|
else if (state == ZONE_SELECT_MENU)
|
||||||
{
|
{
|
||||||
displayMenu();
|
displayMenu();
|
||||||
}
|
}
|
||||||
@@ -771,6 +771,9 @@ void updateDisplay()
|
|||||||
lcd.print(totalTimeRan);
|
lcd.print(totalTimeRan);
|
||||||
lcd.print(" Minutes ");
|
lcd.print(" Minutes ");
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
// what of ZONE_SELECT_MENU?
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
lastUpdateTime = millis();
|
lastUpdateTime = millis();
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -88,8 +88,8 @@ void loop()
|
|||||||
|
|
||||||
// If no time has been received yet, request it every 10 second from controller
|
// If no time has been received yet, request it every 10 second from controller
|
||||||
// When time has been received, request update every hour
|
// When time has been received, request update every hour
|
||||||
if ((!timeReceived && now-lastRequest > 10*1000)
|
if ((!timeReceived && now-lastRequest > (unsigned long)(10*1000))
|
||||||
|| (timeReceived && now-lastRequest > 60*1000*60)) {
|
|| (timeReceived && now-lastRequest > (unsigned long)(60*1000*60))) {
|
||||||
// Request time from controller.
|
// Request time from controller.
|
||||||
Serial.println("requesting time");
|
Serial.println("requesting time");
|
||||||
gw.requestTime(receiveTime);
|
gw.requestTime(receiveTime);
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void setup()
|
|||||||
// Fetch lock status
|
// Fetch lock status
|
||||||
for (int lock=1, pin=LOCK_1; lock<=NOF_LOCKS;lock++, pin++) {
|
for (int lock=1, pin=LOCK_1; lock<=NOF_LOCKS;lock++, pin++) {
|
||||||
// Register all locks to gw (they will be created as child devices)
|
// 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
|
// Then set lock pins in output mode
|
||||||
pinMode(pin, OUTPUT);
|
pinMode(pin, OUTPUT);
|
||||||
// Set lock to last known state (using eeprom storage)
|
// Set lock to last known state (using eeprom storage)
|
||||||
|
|||||||
+11
-10
@@ -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.
|
// Add your buttons here. Max is 5 if you still want time at the top.
|
||||||
char *buttons[] = {
|
char *buttons[] = {
|
||||||
"Good Morning",
|
(char *)"Good Morning",
|
||||||
"Clean Up!",
|
(char *)"Clean Up!",
|
||||||
"All Lights Off",
|
(char *)"All Lights Off",
|
||||||
"Music On/Off"
|
(char *)"Music On/Off"
|
||||||
};
|
};
|
||||||
|
|
||||||
const int buttonCount = sizeof(buttons)/sizeof(char *);
|
const int buttonCount = sizeof(buttons)/sizeof(char *);
|
||||||
const int padding = 10;
|
const int padding = 10;
|
||||||
const int topBarHeight = 60;
|
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 on(CHILD_ID, V_SCENE_ON);
|
||||||
MyMessage off(CHILD_ID, V_SCENE_OFF);
|
MyMessage off(CHILD_ID, V_SCENE_OFF);
|
||||||
|
|
||||||
@@ -142,13 +144,12 @@ void loop()
|
|||||||
unsigned long now = millis();
|
unsigned long now = millis();
|
||||||
|
|
||||||
if (myTouch.dataAvailable()) {
|
if (myTouch.dataAvailable()) {
|
||||||
unsigned long startPress = millis();
|
|
||||||
int pressedButton = myButtons.checkButtons();
|
int pressedButton = myButtons.checkButtons();
|
||||||
|
|
||||||
if (pressedButton>=0) {
|
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) {
|
if (longPress) {
|
||||||
gw.send(off.set(pressedButton));
|
gw.send(off.set(pressedButton));
|
||||||
Serial.print("Long pressed: ");
|
Serial.print("Long pressed: ");
|
||||||
@@ -165,8 +166,8 @@ void loop()
|
|||||||
|
|
||||||
// If no time has been received yet, request it every 10 second from controller
|
// If no time has been received yet, request it every 10 second from controller
|
||||||
// When time has been received, request update every hour
|
// When time has been received, request update every hour
|
||||||
if ((!timeReceived && now-lastRequest > 10*1000)
|
if ((!timeReceived && now-lastRequest > (unsigned long)10*1000)
|
||||||
|| (timeReceived && now-lastRequest > 60*1000*60)) {
|
|| (timeReceived && now-lastRequest > (unsigned long)60*1000*60)) {
|
||||||
// Request time from controller.
|
// Request time from controller.
|
||||||
Serial.println("requesting time");
|
Serial.println("requesting time");
|
||||||
gw.requestTime(receiveTime);
|
gw.requestTime(receiveTime);
|
||||||
|
|||||||
@@ -463,6 +463,7 @@ uint8_t ATSHA204Class::sha204m_execute(uint8_t op_code, uint8_t param1, uint16_t
|
|||||||
uint8_t poll_delay, poll_timeout, response_size;
|
uint8_t poll_delay, poll_timeout, response_size;
|
||||||
uint8_t *p_buffer;
|
uint8_t *p_buffer;
|
||||||
uint8_t len;
|
uint8_t len;
|
||||||
|
(void)tx_size;
|
||||||
|
|
||||||
// Supply delays and response size.
|
// Supply delays and response size.
|
||||||
switch (op_code)
|
switch (op_code)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ void RF24::csn(bool mode)
|
|||||||
delayMicroseconds(11); // allow csn to settle
|
delayMicroseconds(11); // allow csn to settle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else if !defined (__arm__) || defined (CORE_TEENSY)
|
#elif !defined (__arm__) || defined (CORE_TEENSY)
|
||||||
digitalWrite(csn_pin,mode);
|
digitalWrite(csn_pin,mode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
/* 0x05 */ { REG_FDEVMSB, RF_FDEVMSB_50000}, //default:5khz, (FDEV + BitRate/2 <= 500Khz)
|
||||||
/* 0x06 */ { REG_FDEVLSB, RF_FDEVLSB_50000},
|
/* 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))) },
|
/* 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 ? RF_FRFMID_315 : (freqBand==RF69_433MHZ ? RF_FRFMID_433 : (freqBand==RF69_868MHZ ? RF_FRFMID_868 : RF_FRFMID_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 ? RF_FRFLSB_315 : (freqBand==RF69_433MHZ ? RF_FRFLSB_433 : (freqBand==RF69_868MHZ ? RF_FRFLSB_868 : RF_FRFLSB_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
|
// looks like PA1 and PA2 are not implemented on RFM69W, hence the max output power is 13dBm
|
||||||
// +17dBm and +20dBm are possible on RFM69HW
|
// +17dBm and +20dBm are possible on RFM69HW
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ void PN532::begin()
|
|||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
void PN532::PrintHex(const uint8_t *data, const uint32_t numBytes)
|
void PN532::PrintHex(const uint8_t *data, const uint32_t numBytes)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
for (uint8_t i = 0; i < numBytes; i++) {
|
for (uint8_t i = 0; i < numBytes; i++) {
|
||||||
DMSG("0x");
|
DMSG("0x");
|
||||||
DMSG_HEX(data[i]);
|
DMSG_HEX(data[i]);
|
||||||
@@ -86,11 +87,11 @@ void PN532::PrintHexChar(const uint8_t *data, const uint32_t numBytes)
|
|||||||
}
|
}
|
||||||
DMSG(" ");
|
DMSG(" ");
|
||||||
for (uint8_t i = 0; i < numBytes; i++) {
|
for (uint8_t i = 0; i < numBytes; i++) {
|
||||||
char c = data[i];
|
uint8_t c = data[i];
|
||||||
if (c <= 0x1f || c > 0x7f) {
|
if (c <= 0x1f || c > 0x7f) {
|
||||||
DMSG('.');
|
DMSG('.');
|
||||||
} else {
|
} else {
|
||||||
DMSG(c);
|
DMSG((char)c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,7 +549,7 @@ uint8_t PN532::mifareclassic_WriteNDEFURI (uint8_t sectorNumber, uint8_t uriIden
|
|||||||
// in NDEF records
|
// in NDEF records
|
||||||
|
|
||||||
// Setup the sector buffer (w/pre-formatted TLV wrapper and NDEF message)
|
// 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 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 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};
|
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)
|
bool PN532::inDataExchange(uint8_t *send, uint8_t sendLength, uint8_t *response, uint8_t *responseLength)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
(void)i;
|
||||||
|
|
||||||
pn532_packetbuffer[0] = 0x40; // PN532_COMMAND_INDATAEXCHANGE;
|
pn532_packetbuffer[0] = 0x40; // PN532_COMMAND_INDATAEXCHANGE;
|
||||||
pn532_packetbuffer[1] = inListedTag;
|
pn532_packetbuffer[1] = inListedTag;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ int8_t LLCP::activate(uint16_t timeout)
|
|||||||
int8_t LLCP::waitForConnection(uint16_t timeout)
|
int8_t LLCP::waitForConnection(uint16_t timeout)
|
||||||
{
|
{
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
|
(void)timeout;
|
||||||
|
|
||||||
sequence = 0;
|
sequence = 0;
|
||||||
|
|
||||||
@@ -76,6 +77,7 @@ int8_t LLCP::waitForConnection(uint16_t timeout)
|
|||||||
int8_t LLCP::waitForDisconnection(uint16_t timeout)
|
int8_t LLCP::waitForDisconnection(uint16_t timeout)
|
||||||
{
|
{
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
|
(void)timeout;
|
||||||
|
|
||||||
// Get DISC PDU
|
// Get DISC PDU
|
||||||
DMSG("wait for a DISC PDU\n");
|
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)
|
int8_t LLCP::connect(uint16_t timeout)
|
||||||
{
|
{
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
|
(void)timeout;
|
||||||
|
|
||||||
sequence = 0;
|
sequence = 0;
|
||||||
|
|
||||||
@@ -165,6 +168,7 @@ int8_t LLCP::connect(uint16_t timeout)
|
|||||||
int8_t LLCP::disconnect(uint16_t timeout)
|
int8_t LLCP::disconnect(uint16_t timeout)
|
||||||
{
|
{
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
|
(void)timeout;
|
||||||
|
|
||||||
// try to get a SYMM PDU
|
// try to get a SYMM PDU
|
||||||
if (2 > link.read(headerBuf, headerBufLen)) {
|
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)
|
bool LLCP::write(const uint8_t *header, uint8_t hlen, const uint8_t *body, uint8_t blen)
|
||||||
{
|
{
|
||||||
uint8_t type;
|
|
||||||
uint8_t buf[3];
|
uint8_t buf[3];
|
||||||
|
|
||||||
if (2 != link.read(buf, sizeof(buf))) {
|
if (2 != link.read(buf, sizeof(buf))) {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ int16_t SNEP::read(uint8_t *buf, uint8_t len, uint16_t timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check message's length
|
// 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)
|
// length should not be more than 244 (header + body < 255, header = 6 + 3 + 2)
|
||||||
if (length > (status - 6)) {
|
if (length > (status - 6)) {
|
||||||
DMSG("The SNEP message is too large\n");
|
DMSG("The SNEP message is too large\n");
|
||||||
|
|||||||
@@ -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)
|
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)
|
(void)DataMask;
|
||||||
uint8_t OrigRegData = _sing_reg_read(RegAdd);
|
// Configure and write the updated register value
|
||||||
|
|
||||||
// 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
|
|
||||||
digitalWrite(_cs, LOW); // set pin low to start talking to IC
|
digitalWrite(_cs, LOW); // set pin low to start talking to IC
|
||||||
// next pack command byte, send AS3935.... structure is shown below
|
// next pack command byte, send AS3935.... structure is shown below
|
||||||
// MODE Register Address/Direct Cmd
|
// 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
|
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 |= _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
|
nrgy_raw |= _sing_reg_read(0x04); // read LSB, add to others
|
||||||
|
|
||||||
return nrgy_raw;
|
return nrgy_raw;
|
||||||
|
|||||||
@@ -474,6 +474,7 @@ void PCintPort::detachInterrupt(uint8_t arduinoPin)
|
|||||||
// there isn't really a good way to back-map ports and masks to pins.
|
// there isn't really a good way to back-map ports and masks to pins.
|
||||||
void PCintPort::PCint() {
|
void PCintPort::PCint() {
|
||||||
uint8_t thisChangedPin; //MIKE
|
uint8_t thisChangedPin; //MIKE
|
||||||
|
(void)thisChangedPin;
|
||||||
|
|
||||||
#ifdef FLASH
|
#ifdef FLASH
|
||||||
if (*led_port & led_mask) *led_port&=not_led_mask;
|
if (*led_port & led_mask) *led_port&=not_led_mask;
|
||||||
|
|||||||
@@ -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 KaKuTransmitter::sendSignal(char address, byte group, byte device, boolean on) {
|
||||||
|
(void)device;
|
||||||
sendTelegram(getTelegram(address, group, on), _pin);
|
sendTelegram(getTelegram(address, group, on), _pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
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;
|
temp=(word)((c-cfont.offset)*((cfont.x_size/8)*cfont.y_size))+4;
|
||||||
for(j=0;j<((cfont.x_size/8)*cfont.y_size);j++)
|
for(j=0;j<(word)((cfont.x_size/8)*cfont.y_size);j++)
|
||||||
{
|
{
|
||||||
ch=pgm_read_byte(&cfont.font[temp]);
|
ch=pgm_read_byte(&cfont.font[temp]);
|
||||||
for(i=0;i<8;i++)
|
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;
|
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)));
|
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--)
|
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 != '.')
|
if (divider != '.')
|
||||||
{
|
{
|
||||||
for (int i=0; i<sizeof(st); i++)
|
for (unsigned int i=0; i<sizeof(st); i++)
|
||||||
if (st[i]=='.')
|
if (st[i]=='.')
|
||||||
st[i]=divider;
|
st[i]=divider;
|
||||||
}
|
}
|
||||||
@@ -1090,13 +1090,13 @@ void UTFT::printNumF(double num, byte dec, int x, int y, char divider, int lengt
|
|||||||
if (neg)
|
if (neg)
|
||||||
{
|
{
|
||||||
st[0]='-';
|
st[0]='-';
|
||||||
for (int i=1; i<sizeof(st); i++)
|
for (unsigned int i=1; i<sizeof(st); i++)
|
||||||
if ((st[i]==' ') || (st[i]=='-'))
|
if ((st[i]==' ') || (st[i]=='-'))
|
||||||
st[i]=filler;
|
st[i]=filler;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i=0; i<sizeof(st); i++)
|
for (unsigned int i=0; i<sizeof(st); i++)
|
||||||
if (st[i]==' ')
|
if (st[i]==' ')
|
||||||
st[i]=filler;
|
st[i]=filler;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ void UTFT_Buttons::deleteAllButtons()
|
|||||||
buttons[i].width=0;
|
buttons[i].width=0;
|
||||||
buttons[i].height=0;
|
buttons[i].height=0;
|
||||||
buttons[i].flags=BUTTON_UNUSED;
|
buttons[i].flags=BUTTON_UNUSED;
|
||||||
buttons[i].label="";
|
buttons[i].label[0]='\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ int UTFT_Buttons::checkButtons()
|
|||||||
{
|
{
|
||||||
if (((buttons[i].flags & BUTTON_UNUSED) == 0) and ((buttons[i].flags & BUTTON_DISABLED) == 0) and (result == -1))
|
if (((buttons[i].flags & BUTTON_UNUSED) == 0) and ((buttons[i].flags & BUTTON_DISABLED) == 0) and (result == -1))
|
||||||
{
|
{
|
||||||
if ((touch_x >= 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;
|
result = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -791,6 +791,19 @@ uint8_t atsha204Class::sha204m_check_parameters(uint8_t op_code, uint8_t param1,
|
|||||||
return SHA204_SUCCESS;
|
return SHA204_SUCCESS;
|
||||||
|
|
||||||
#else
|
#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;
|
return SHA204_SUCCESS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user