From 6c1a718a985722e461a2270d0ac4e03d37daf9d8 Mon Sep 17 00:00:00 2001 From: mattbk Date: Fri, 15 Sep 2023 12:22:02 -0500 Subject: [PATCH] Do the math right on cycle timing. --- vulpes/src/main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vulpes/src/main.cpp b/vulpes/src/main.cpp index a6d0675..4b27559 100644 --- a/vulpes/src/main.cpp +++ b/vulpes/src/main.cpp @@ -532,12 +532,16 @@ void loop() { } // Once alarm has started the program, set things up to run - if (startProgram == true){ + if(startProgram == true){ //Serial.println("Start sending"); start_millis = millis() + ((yourInputCycleID - 1) * yourInputStepLength); stop_millis = start_millis + yourInputStepLength; + if(yourInputCycleID == 1){ + pause_until_millis = stop_millis + (yourInputStepLength * (yourInputNtransmitters - 1)); + } else { // Subtract 2 rather than 1 here to account for start_millis duration at beginning of repeat. - pause_until_millis = stop_millis + (yourInputStepLength * (yourInputNtransmitters - 2)); + pause_until_millis = stop_millis + (yourInputStepLength * (yourInputNtransmitters - 2)); + } //sender.startSending(); programRunning = true; startProgram = false;