ESP32: emulation heartbeat
This commit is contained in:
parent
d44667771e
commit
b52fe53e3b
3 changed files with 28 additions and 7 deletions
|
@ -61,11 +61,11 @@ void console_esp32::refresh_virtual_terminal()
|
|||
|
||||
void console_esp32::panel_update_thread()
|
||||
{
|
||||
#if !defined(BUILD_FOR_RP2040) && defined(NEOPIXELS_PIN)
|
||||
Serial.println(F("panel task started"));
|
||||
|
||||
cpu *const c = b->getCpu();
|
||||
|
||||
#if !defined(BUILD_FOR_RP2040) && defined(NEOPIXELS_PIN)
|
||||
constexpr const uint8_t n_leds = 60;
|
||||
Adafruit_NeoPixel pixels(n_leds, NEOPIXELS_PIN, NEO_RGBW);
|
||||
pixels.begin();
|
||||
|
@ -142,7 +142,22 @@ void console_esp32::panel_update_thread()
|
|||
|
||||
pixels.clear();
|
||||
pixels.show();
|
||||
#elif defined(HEARTBEAT_PIN)
|
||||
uint64_t prev_count = 0;
|
||||
bool led_state = true;
|
||||
|
||||
while(!stop_panel) {
|
||||
vTaskDelay(333 / portTICK_PERIOD_MS);
|
||||
|
||||
uint64_t current_count = c->get_instructions_executed_count();
|
||||
if (prev_count != current_count) {
|
||||
prev_count = current_count;
|
||||
|
||||
digitalWrite(HEARTBEAT_PIN, led_state ? HIGH : LOW);
|
||||
led_state = !led_state;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Serial.println(F("panel task terminating"));
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -15,5 +15,8 @@
|
|||
|
||||
// #define NEOPIXELS_PIN 24
|
||||
|
||||
#define HEARTBEAT_PIN LED_BUILTIN
|
||||
// #define HEARTBEAT_PIN 18
|
||||
|
||||
// #define CONSOLE_SERIAL_RX 16
|
||||
// #define CONSOLE_SERIAL_TX 17
|
||||
|
|
|
@ -343,7 +343,14 @@ void setup() {
|
|||
tty_ = new tty(cnsl, b);
|
||||
b->add_tty(tty_);
|
||||
|
||||
#if !defined(BUILD_FOR_RP2040) && defined(NEOPIXELS_PIN)
|
||||
#if !defined(SHA2017)
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
#endif
|
||||
#if defined(HEARTBEAT_PIN)
|
||||
pinMode(HEARTBEAT_PIN, OUTPUT);
|
||||
#endif
|
||||
|
||||
#if !defined(BUILD_FOR_RP2040) && (defined(NEOPIXELS_PIN) || defined(HEARTBEAT_PIN))
|
||||
Serial.println(F("Starting panel"));
|
||||
xTaskCreate(&console_thread_wrapper_panel, "panel", 3072, cnsl, 1, nullptr);
|
||||
#endif
|
||||
|
@ -354,10 +361,6 @@ void setup() {
|
|||
Serial.println(F(""));
|
||||
#endif
|
||||
|
||||
#if !defined(SHA2017)
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
#endif
|
||||
|
||||
Serial.flush();
|
||||
|
||||
Serial.println(F("* Starting console"));
|
||||
|
|
Loading…
Add table
Reference in a new issue