From f3ac7fa403a3dacb11dbaa66249563314d256dc3 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 8 Sep 2020 10:00:59 +0200 Subject: [PATCH] Use POWERON/OFF in progs --- DCC.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/DCC.cpp b/DCC.cpp index 81f2d43..7645591 100644 --- a/DCC.cpp +++ b/DCC.cpp @@ -208,40 +208,49 @@ void DCC::setProgTrackSyncMain(bool on) { } const ackOp PROGMEM WRITE_BIT0_PROG[] = { + POWERON, BASELINE, W0,WACK, V0, WACK, // validate bit is 0 ITC1, // if acked, callback(1) - FAIL // callback (-1) + FAIL, // callback (-1) + POWEROFF }; const ackOp PROGMEM WRITE_BIT1_PROG[] = { + POWERON, BASELINE, W1,WACK, V1, WACK, // validate bit is 1 ITC1, // if acked, callback(1) - FAIL // callback (-1) + FAIL, // callback (-1) + POWEROFF }; const ackOp PROGMEM READ_BIT_PROG[] = { + POWERON, BASELINE, V1, WACK, // validate bit is 1 ITC1, // if acked, callback(1) V0, WACK, // validate bit is zero ITC0, // if acked callback 0 - FAIL // bit not readable - }; + FAIL, // bit not readable + POWEROFF +}; const ackOp PROGMEM WRITE_BYTE_PROG[] = { + POWERON, BASELINE, WB,WACK, // Write VB,WACK, // validate byte ITC1, // if ok callback (1) - FAIL // callback (-1) - }; + FAIL, // callback (-1) + POWEROFF +}; const ackOp PROGMEM READ_CV_PROG[] = { + POWERON, BASELINE, STARTMERGE, //clear bit and byte values ready for merge pass // 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, 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[] = { + POWERON, BASELINE, SETCV,(ackOp)29, SETBIT,(ackOp)5, @@ -304,8 +316,9 @@ const ackOp PROGMEM LOCO_ID_PROG[] = { V0, WACK, MERGE, V0, WACK, MERGE, VB, WACK, ITCB, // verify merged byte and callback - FAIL - }; + FAIL, + POWEROFF +}; // On the following prog-track functions blocking defaults to false.