From fa83e0921cfa6b7671d83e73ee8bdf5b4b39759d Mon Sep 17 00:00:00 2001 From: Henrik Ekblad Date: Mon, 5 Oct 2015 00:21:55 +0200 Subject: [PATCH] Fix some warnings 1 --- libraries/MySensors/core/MyGatewayTransportEthernet.cpp | 2 -- libraries/MySensors/core/MyTransport.cpp | 9 ++++----- .../BatteryPoweredSensor/BatteryPoweredSensor.ino | 3 ++- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/libraries/MySensors/core/MyGatewayTransportEthernet.cpp b/libraries/MySensors/core/MyGatewayTransportEthernet.cpp index 434c5f0..1e5a993 100644 --- a/libraries/MySensors/core/MyGatewayTransportEthernet.cpp +++ b/libraries/MySensors/core/MyGatewayTransportEthernet.cpp @@ -190,8 +190,6 @@ bool _readFromClient(uint8_t i) { bool gatewayTransportAvailable() { - bool available = false; - #if !defined(MY_IP_ADDRESS) && defined(MY_GATEWAY_W5100) // renew IP address using DHCP gatewayTransportRenewIP(); diff --git a/libraries/MySensors/core/MyTransport.cpp b/libraries/MySensors/core/MyTransport.cpp index 499a6f5..3fec6d3 100644 --- a/libraries/MySensors/core/MyTransport.cpp +++ b/libraries/MySensors/core/MyTransport.cpp @@ -81,7 +81,7 @@ inline void transportProcess() { uint8_t command = mGetCommand(_msg); uint8_t type = _msg.type; uint8_t sender = _msg.sender; - uint8_t last = _msg.last; + //uint8_t last = _msg.last; uint8_t destination = _msg.destination; #ifdef MY_SIGNING_FEATURE @@ -116,7 +116,7 @@ inline void transportProcess() { // Add string termination, good if we later would want to print it. _msg.data[mGetLength(_msg)] = '\0'; debug(PSTR("read: %d-%d-%d s=%d,c=%d,t=%d,pt=%d,l=%d,sg=%d:%s\n"), - sender, last, destination, _msg.sensor, mGetCommand(_msg), type, mGetPayloadType(_msg), mGetLength(_msg), mGetSigned(_msg), _msg.getString(_convBuf)); + sender, _msg.last, destination, _msg.sensor, mGetCommand(_msg), type, mGetPayloadType(_msg), mGetLength(_msg), mGetSigned(_msg), _msg.getString(_convBuf)); mSetSigned(_msg,0); // Clear the sign-flag now as verification (and debug printing) is completed if(!(mGetVersion(_msg) == PROTOCOL_VERSION)) { @@ -129,9 +129,9 @@ inline void transportProcess() { // This message is addressed to this node #if defined(MY_REPEATER_FEATURE) - if (last != _nc.parentNodeId) { + if (_msg.last != _nc.parentNodeId) { // Message is from one of the child nodes. Add it to routing table. - hwWriteConfig(EEPROM_ROUTES_ADDRESS+sender, last); + hwWriteConfig(EEPROM_ROUTES_ADDRESS+sender, _msg.last); } #endif @@ -388,7 +388,6 @@ boolean transportSendRoute(MyMessage &message) { (type != I_GET_NONCE && type != I_GET_NONCE_RESPONSE && type != I_REQUEST_SIGNING && type != I_ID_REQUEST && type != I_ID_RESPONSE && type != I_FIND_PARENT && type != I_FIND_PARENT_RESPONSE))) { - bool signing = SIGN_WAITING_FOR_NONCE; // Send nonce-request if (!_sendRoute(build(_msgTmp, _nc.nodeId, message.destination, message.sensor, C_INTERNAL, I_GET_NONCE, false).set(""))) { debug(PSTR("nonce tr err\n")); diff --git a/libraries/MySensors/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino b/libraries/MySensors/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino index 62f8ad3..981db1d 100644 --- a/libraries/MySensors/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino +++ b/libraries/MySensors/examples/BatteryPoweredSensor/BatteryPoweredSensor.ino @@ -70,10 +70,11 @@ void loop() // Sense point is bypassed with 0.1 uF cap to reduce noise at that point // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts // 3.44/1023 = Volts per bit = 0.003363075 - float batteryV = sensorValue * 0.003363075; + int batteryPcnt = sensorValue / 10; #ifdef DEBUG + float batteryV = sensorValue * 0.003363075; Serial.print("Battery Voltage: "); Serial.print(batteryV); Serial.println(" V");