Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DCCpp_Uno/CurrentMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Part of DCC++ BASE STATION for the Arduino

///////////////////////////////////////////////////////////////////////////////

CurrentMonitor::CurrentMonitor(int pin, char *msg){
CurrentMonitor::CurrentMonitor(int pin, const char *msg){
this->pin=pin;
this->msg=msg;
current=0;
Expand All @@ -31,7 +31,7 @@ void CurrentMonitor::check(){
if(current>CURRENT_SAMPLE_MAX && digitalRead(SIGNAL_ENABLE_PIN_PROG)==HIGH){ // current overload and Prog Signal is on (or could have checked Main Signal, since both are always on or off together)
digitalWrite(SIGNAL_ENABLE_PIN_PROG,LOW); // disable both Motor Shield Channels
digitalWrite(SIGNAL_ENABLE_PIN_MAIN,LOW); // regardless of which caused current overload
INTERFACE.print(msg); // print corresponding error message
INTERFACE.print(msg); // print corresponding error message
}
} // CurrentMonitor::check

Expand Down
4 changes: 2 additions & 2 deletions DCCpp_Uno/CurrentMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ struct CurrentMonitor{
static long int sampleTime;
int pin;
float current;
char *msg;
CurrentMonitor(int, char *);
const char *msg;
CurrentMonitor(int, const char*);
static boolean checkTime();
void check();
};
Expand Down
8 changes: 4 additions & 4 deletions DCCpp_Uno/DCCpp_Uno.ino
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,13 @@ void setup(){

#define DCC_SIGNAL(R,N) \
if(R.currentBit==R.currentReg->activePacket->nBits){ /* IF no more bits in this DCC Packet */ \
R.currentBit=0; /* reset current bit pointer and determine which Register and Packet to process next--- */ \
R.currentBit=0; /* reset current bit pointer and determine which Register and Packet to process next--- */ \
if(R.nRepeat>0 && R.currentReg==R.reg){ /* IF current Register is first Register AND should be repeated */ \
R.nRepeat--; /* decrement repeat count; result is this same Packet will be repeated */ \
} else if(R.nextReg!=NULL){ /* ELSE IF another Register has been updated */ \
R.currentReg=R.nextReg; /* update currentReg to nextReg */ \
R.nextReg=NULL; /* reset nextReg to NULL */ \
R.tempPacket=R.currentReg->activePacket; /* flip active and update Packets */ \
R.tempPacket=R.currentReg->activePacket; /* flip active and update Packets */ \
R.currentReg->activePacket=R.currentReg->updatePacket; \
R.currentReg->updatePacket=R.tempPacket; \
} else{ /* ELSE simply move to next Register */ \
Expand All @@ -446,8 +446,8 @@ void setup(){
} else{ /* ELSE it is a ZERO */ \
OCR ## N ## A=DCC_ZERO_BIT_TOTAL_DURATION_TIMER ## N; /* set OCRA for timer N to full cycle duration of DCC ZERO bit */ \
OCR ## N ## B=DCC_ZERO_BIT_PULSE_DURATION_TIMER ## N; /* set OCRB for timer N to half cycle duration of DCC ZERO bit */ \
} /* END-ELSE */ \
\
} /* END-ELSE */ \
\
R.currentBit++; /* point to next bit in current Packet */

///////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 1 addition & 5 deletions DCCpp_Uno/EEStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ void EEStore::init(){
EEPROM.get(0,eeStore->data); // get eeStore data

if(strncmp(eeStore->data.id,EESTORE_ID,sizeof(EESTORE_ID))!=0){ // check to see that eeStore contains valid DCC++ ID
sprintf(eeStore->data.id,EESTORE_ID); // if not, create blank eeStore structure (no turnouts, no sensors) and save it back to EEPROM
eeStore->data.nTurnouts=0;
eeStore->data.nSensors=0;
eeStore->data.nOutputs=0;
EEPROM.put(0,eeStore->data);
clear;
}

reset(); // set memory pointer to first free EEPROM space
Expand Down