mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
datatypes used in eeprom should be a data type that has a given size
This commit is contained in:
parent
cc4de0ad14
commit
c292f210a4
|
@ -14,9 +14,9 @@ extern ExternalEEPROM EEPROM;
|
||||||
|
|
||||||
struct EEStoreData{
|
struct EEStoreData{
|
||||||
char id[sizeof(EESTORE_ID)];
|
char id[sizeof(EESTORE_ID)];
|
||||||
int nTurnouts;
|
uint16_t nTurnouts;
|
||||||
int nSensors;
|
uint16_t nSensors;
|
||||||
int nOutputs;
|
uint16_t nOutputs;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EEStore{
|
struct EEStore{
|
||||||
|
|
|
@ -138,7 +138,7 @@ void Output::load(){
|
||||||
// id. If someone uses only pins 0 to 7 of their arduino, they
|
// id. If someone uses only pins 0 to 7 of their arduino, they
|
||||||
// loose. This is (if you look at an arduino) however unlikely.
|
// loose. This is (if you look at an arduino) however unlikely.
|
||||||
|
|
||||||
for(int i=0;i<EEStore::eeStore->data.nOutputs;i++){
|
for(uint16_t i=0;i<EEStore::eeStore->data.nOutputs;i++){
|
||||||
EEPROM.get(EEStore::pointer()+ i*sizeof(struct BrokenOutputData),bdata);
|
EEPROM.get(EEStore::pointer()+ i*sizeof(struct BrokenOutputData),bdata);
|
||||||
if (bdata.iFlag > 7) { // it's a pin and not an iFlag!
|
if (bdata.iFlag > 7) { // it's a pin and not an iFlag!
|
||||||
isBroken=0;
|
isBroken=0;
|
||||||
|
@ -146,7 +146,7 @@ void Output::load(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( isBroken ) {
|
if ( isBroken ) {
|
||||||
for(int i=0;i<EEStore::eeStore->data.nOutputs;i++){
|
for(uint16_t i=0;i<EEStore::eeStore->data.nOutputs;i++){
|
||||||
EEPROM.get(EEStore::pointer(),bdata);
|
EEPROM.get(EEStore::pointer(),bdata);
|
||||||
tt=create(bdata.id,bdata.pin,bdata.iFlag);
|
tt=create(bdata.id,bdata.pin,bdata.iFlag);
|
||||||
tt->data.oStatus=bitRead(tt->data.iFlag,1)?bitRead(tt->data.iFlag,2):bdata.oStatus; // restore status to EEPROM value is bit 1 of iFlag=0, otherwise set to value of bit 2 of iFlag
|
tt->data.oStatus=bitRead(tt->data.iFlag,1)?bitRead(tt->data.iFlag,2):bdata.oStatus; // restore status to EEPROM value is bit 1 of iFlag=0, otherwise set to value of bit 2 of iFlag
|
||||||
|
@ -158,7 +158,7 @@ void Output::load(){
|
||||||
} else {
|
} else {
|
||||||
struct OutputData data;
|
struct OutputData data;
|
||||||
|
|
||||||
for(int i=0;i<EEStore::eeStore->data.nOutputs;i++){
|
for(uint16_t i=0;i<EEStore::eeStore->data.nOutputs;i++){
|
||||||
EEPROM.get(EEStore::pointer(),data);
|
EEPROM.get(EEStore::pointer(),data);
|
||||||
tt=create(data.id,data.pin,data.iFlag);
|
tt=create(data.id,data.pin,data.iFlag);
|
||||||
tt->data.oStatus=bitRead(tt->data.iFlag,1)?bitRead(tt->data.iFlag,2):data.oStatus; // restore status to EEPROM value is bit 1 of iFlag=0, otherwise set to value of bit 2 of iFlag
|
tt->data.oStatus=bitRead(tt->data.iFlag,1)?bitRead(tt->data.iFlag,2):data.oStatus; // restore status to EEPROM value is bit 1 of iFlag=0, otherwise set to value of bit 2 of iFlag
|
||||||
|
|
Loading…
Reference in New Issue
Block a user