Skip to content

Commit

Permalink
Fix DIP switch had no effect (#2)
Browse files Browse the repository at this point in the history
* Fix DIP switch had no effect

* don't devide version number in config function
  • Loading branch information
elias-rexometer authored and glynhudson committed Jul 26, 2017
1 parent 16448ac commit 9812cc3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion firmware/src/config.ino
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void config (char c) {
break;

case 'v': // print firmware version
Serial.print(F("[emonTH FW: V")); Serial.print(version*0.1); Serial.print(F("]"));
Serial.print(F("[emonTH FW: V")); Serial.print(version); Serial.print(F("]"));
break;

default:
Expand Down
10 changes: 6 additions & 4 deletions firmware/src/src.ino
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
31 - Special allocation in JeeLib RFM12 driver - Node31 can communicate with nodes on any network group
-------------------------------------------------------------------------------------------------------------
Change log:
V3.2.3 - (17/07/17) Fix DIP switch had no effect
V3.2.2 - (12/05/17) Fix DIP switch nodeID not being read when EEPROM is configures
V3.2.1 - (30/11/16) Fix emonTx port typo
V3.2.0 - (13/11/16) Run-time serial nodeID config
Expand Down Expand Up @@ -63,7 +64,7 @@
boolean debug=1; // Set to 1 to few debug serial output
boolean flash_led=0; // Flash LED after each sample (battery drain) default=0

const unsigned int version = 321; // firmware version divided by 10 e,g 16 = V1.6
const unsigned int version = 323; // firmware version
// These variables control the transmit timing of the emonTH
const unsigned long WDT_PERIOD = 80; // mseconds.
const unsigned long WDT_MAX_NUMBER = 690; // Data sent after WDT_MAX_NUMBER periods of WDT_PERIOD ms without pulses:
Expand Down Expand Up @@ -197,16 +198,17 @@ void setup() {
RF_STATUS=1;

if (RF_STATUS==1){
load_config(); // Load RF config from EEPROM (if any exist
if (debug) Serial.println("Int RFM...");
rf12_initialize(nodeID, RF_freq, networkGroup); // Initialize RFM
load_config(); // Load RF config from EEPROM (if any exist)

// Add effect of DIP switch positions to nodeID
if ((DIP1 == HIGH) && (DIP2 == HIGH)) nodeID=nodeID;
if ((DIP1 == LOW) && (DIP2 == HIGH)) nodeID=nodeID+1;
if ((DIP1 == HIGH) && (DIP2 == LOW)) nodeID=nodeID+2;
if ((DIP1 == LOW) && (DIP2 == LOW)) nodeID=nodeID+3;

if (debug) Serial.println("Int RFM...");
rf12_initialize(nodeID, RF_freq, networkGroup); // Initialize RFM

if (debug){
Serial.println("RFM Started");
Serial.print("Node: ");
Expand Down

0 comments on commit 9812cc3

Please sign in to comment.