5 * off = not paused, nothing to do
7 * on = a block is being executed
10 #include "PauseButton.h"
11 #include "modules/robot/Conveyor.h"
12 #include "SlowTicker.h"
18 void PlayLed::on_module_loaded()
20 register_for_event(ON_CONFIG_RELOAD
);
22 //register_for_event(ON_PLAY);
23 //TODO: these two events happen in interrupt context and it's extremely important they don't last long. This should be done by checking the size of the queue once a second or something
24 //register_for_event(ON_BLOCK_BEGIN);
25 //register_for_event(ON_BLOCK_END);
27 on_config_reload(this);
29 THEKERNEL
->slow_ticker
->attach(4, this, &PlayLed::half_second_tick
);
32 void PlayLed::on_config_reload(void* argument
)
34 string ledpin
= "4.28!";
36 ledpin
= THEKERNEL
->config
->value( pause_led_pin_checksum
)->by_default(ledpin
)->as_string(); // check for pause_led_pin first
37 ledpin
= THEKERNEL
->config
->value( play_led_pin_checksum
)->by_default(ledpin
)->as_string(); // override with play_led_pin if it's found
39 led
.from_string(ledpin
)->as_output()->set(false);
42 void PlayLed::on_block_begin(void* argument
)
47 void PlayLed::on_block_end(void* argument
)
52 void PlayLed::on_play(void* argument
)
57 uint32_t PlayLed::half_second_tick(uint32_t)
59 if (THEKERNEL
->pauser
->paused())
61 else led
.set(!THEKERNEL
->conveyor
->queue
.is_empty());