Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion grid_esp/components/grid_esp32_module_tek1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ idf_component_register(
INCLUDE_DIRS
"."
REQUIRES
"grid_esp32_adc" "grid_esp32_encoder" "grid_esp32_lcd" "grid_common" "grid_esp32_vmp"
"grid_esp32_adc" "grid_esp32_encoder" "grid_esp32_lcd" "grid_common" "grid_esp32_port" "grid_esp32_vmp"
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "grid_ui_system.h"

#include "grid_esp32_lcd.h"
#include "grid_esp32_port.h"
#include "grid_font.h"
#include "grid_gui.h"

Expand Down Expand Up @@ -238,7 +239,9 @@ void grid_esp32_module_tek1_init(struct grid_sys_model* sys, struct grid_ui_mode
grid_esp32_lcd_spi_bus_init(lcd_tx_bytes);

// Wait for the coprocessor to pull the LCD reset pin high
vTaskDelay(pdMS_TO_TICKS(500));
while (!rp2040_active) {
vTaskDelay(1);
}

bool is_tek1_reva = grid_sys_get_hwcfg(&grid_sys_state) == GRID_MODULE_TEK1_RevA;

Expand Down
5 changes: 5 additions & 0 deletions grid_esp/components/grid_esp32_port/grid_esp32_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ void handle_connection_effect() {

bool grid_esp32_broadcast_between(enum grid_port_type t1, enum grid_port_type t2) { return !(t1 == GRID_PORT_USART && t2 == GRID_PORT_USART); }

extern bool rp2040_active = false;

void grid_esp32_port_task(void* arg) {

// Set up "outbound usart" spi transactions
Expand Down Expand Up @@ -457,8 +459,11 @@ void grid_esp32_port_task(void* arg) {

// When the rolling ID changes, reset watchdog
if (rollid.last_recv != watchdog_rollid_last_recv) {

watchdog_rollid_last_time = grid_platform_rtc_get_micros();
watchdog_rollid_last_recv = rollid.last_recv;

rp2040_active = true;
}

// Rolling ID watchdog expiration
Expand Down
3 changes: 3 additions & 0 deletions grid_esp/components/grid_esp32_port/grid_esp32_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
*/
#pragma once

#include <stdbool.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

extern bool rp2040_active;

uint8_t grid_platform_send_grid_message(uint8_t direction, char* buffer, uint16_t length);
void grid_platform_sync1_pulse_send(void);
void grid_esp32_port_task(void* arg);
Expand Down
12 changes: 6 additions & 6 deletions grid_esp/main/grid_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,12 @@ void app_main(void) {

xTaskCreatePinnedToCore(grid_esp32_nvm_task, "nvm", 1024 * 10, NULL, NVM_TASK_PRIORITY, &nvm_task_hdl, 0);

log_checkpoint("PORT TASK INIT");

TaskHandle_t port_task_hdl;

xTaskCreatePinnedToCore(grid_esp32_port_task, "port", 1024 * 10, NULL, PORT_TASK_PRIORITY, &port_task_hdl, 1);

log_checkpoint("MODULE INIT");

if (grid_hwcfg_module_is_po16(&grid_sys_state)) {
Expand Down Expand Up @@ -556,12 +562,6 @@ void app_main(void) {
log_checkpoint("LCD TASK DONE");
}

TaskHandle_t port_task_hdl;

xTaskCreatePinnedToCore(grid_esp32_port_task, "port", 1024 * 10, NULL, PORT_TASK_PRIORITY, &port_task_hdl, 1);

log_checkpoint("PORT TASK DONE");

// Initialize 1 kHz timer
periodic_rtc_ms_init();

Expand Down