1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 08:06:13 +01:00

Use POWERON/OFF in progs

This commit is contained in:
Harald Barth 2020-09-08 10:00:59 +02:00
parent 5c775531f6
commit f3ac7fa403

31
DCC.cpp
View File

@ -208,40 +208,49 @@ void DCC::setProgTrackSyncMain(bool on) {
} }
const ackOp PROGMEM WRITE_BIT0_PROG[] = { const ackOp PROGMEM WRITE_BIT0_PROG[] = {
POWERON,
BASELINE, BASELINE,
W0,WACK, W0,WACK,
V0, WACK, // validate bit is 0 V0, WACK, // validate bit is 0
ITC1, // if acked, callback(1) ITC1, // if acked, callback(1)
FAIL // callback (-1) FAIL, // callback (-1)
POWEROFF
}; };
const ackOp PROGMEM WRITE_BIT1_PROG[] = { const ackOp PROGMEM WRITE_BIT1_PROG[] = {
POWERON,
BASELINE, BASELINE,
W1,WACK, W1,WACK,
V1, WACK, // validate bit is 1 V1, WACK, // validate bit is 1
ITC1, // if acked, callback(1) ITC1, // if acked, callback(1)
FAIL // callback (-1) FAIL, // callback (-1)
POWEROFF
}; };
const ackOp PROGMEM READ_BIT_PROG[] = { const ackOp PROGMEM READ_BIT_PROG[] = {
POWERON,
BASELINE, BASELINE,
V1, WACK, // validate bit is 1 V1, WACK, // validate bit is 1
ITC1, // if acked, callback(1) ITC1, // if acked, callback(1)
V0, WACK, // validate bit is zero V0, WACK, // validate bit is zero
ITC0, // if acked callback 0 ITC0, // if acked callback 0
FAIL // bit not readable FAIL, // bit not readable
}; POWEROFF
};
const ackOp PROGMEM WRITE_BYTE_PROG[] = { const ackOp PROGMEM WRITE_BYTE_PROG[] = {
POWERON,
BASELINE, BASELINE,
WB,WACK, // Write WB,WACK, // Write
VB,WACK, // validate byte VB,WACK, // validate byte
ITC1, // if ok callback (1) ITC1, // if ok callback (1)
FAIL // callback (-1) FAIL, // callback (-1)
}; POWEROFF
};
const ackOp PROGMEM READ_CV_PROG[] = { const ackOp PROGMEM READ_CV_PROG[] = {
POWERON,
BASELINE, BASELINE,
STARTMERGE, //clear bit and byte values ready for merge pass STARTMERGE, //clear bit and byte values ready for merge pass
// each bit is validated against 0 and the result inverted in MERGE // each bit is validated against 0 and the result inverted in MERGE
@ -256,10 +265,13 @@ const ackOp PROGMEM READ_CV_PROG[] = {
V0, WACK, MERGE, V0, WACK, MERGE,
V0, WACK, MERGE, V0, WACK, MERGE,
VB, WACK, ITCB, // verify merged byte and return it if acked ok VB, WACK, ITCB, // verify merged byte and return it if acked ok
FAIL }; // verification failed FAIL, // verification failed
POWEROFF
};
const ackOp PROGMEM LOCO_ID_PROG[] = { const ackOp PROGMEM LOCO_ID_PROG[] = {
POWERON,
BASELINE, BASELINE,
SETCV,(ackOp)29, SETCV,(ackOp)29,
SETBIT,(ackOp)5, SETBIT,(ackOp)5,
@ -304,8 +316,9 @@ const ackOp PROGMEM LOCO_ID_PROG[] = {
V0, WACK, MERGE, V0, WACK, MERGE,
V0, WACK, MERGE, V0, WACK, MERGE,
VB, WACK, ITCB, // verify merged byte and callback VB, WACK, ITCB, // verify merged byte and callback
FAIL FAIL,
}; POWEROFF
};
// On the following prog-track functions blocking defaults to false. // On the following prog-track functions blocking defaults to false.