Add variables to start and stop lamp and alternately stop the machine after x number of frames

This commit is contained in:
Matt McWilliams 2024-02-25 14:00:24 +01:00
parent a2c092d57c
commit 6cf8f62a42
2 changed files with 10 additions and 4 deletions

View File

@ -29,6 +29,7 @@ void ContactPrinter::Setup () {
SetupTakeup(); SetupTakeup();
SetupDrive(); SetupDrive();
start_time = millis(); start_time = millis();
//lamp.On();
} }
void ContactPrinter::Start () { void ContactPrinter::Start () {
@ -136,12 +137,15 @@ void ContactPrinter::Loop () {
if (running) { if (running) {
drive_motor.Loop(); drive_motor.Loop();
frame = drive_motor.GetFrames(); frame = drive_motor.GetFrames();
if (!lamp.IsOn() && frame >= start_after) { if (!lamp.IsOn() && start_lamp > 0 && frame >= start_lamp) {
lamp.On(); lamp.On();
} }
/*if (frame >= 1000) { if (lamp.IsOn() && stop_lamp > 0 && frame >= stop_lamp) {
lamp.Off();
}
if (stop_after > 0 && frame >= stop_after) {
Stop(); Stop();
}*/ }
} }
} else if (timer >= start_time + 100) { } else if (timer >= start_time + 100) {
initialized = true; initialized = true;

View File

@ -53,7 +53,9 @@ class ContactPrinter {
volatile uint8_t load = 2; //0 = no load, 1 = single thread, 2 = dual thread volatile uint8_t load = 2; //0 = no load, 1 = single thread, 2 = dual thread
volatile uint32_t start_after = 24; volatile uint32_t start_lamp = 24;
volatile uint32_t stop_lamp = -1;
volatile uint32_t stop_after = -1;
volatile bool takeup_dir = true; volatile bool takeup_dir = true;
volatile bool initialized = false; volatile bool initialized = false;