From 573ee2dd6790c00c9e0f709f222bc2a68f015d6d Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Tue, 18 Jun 2024 14:51:43 +0200 Subject: WIP losing my mind --- puzzle/dummy/CMakeLists.txt | 1 + puzzle/dummy/FreeRTOSConfig.h | 2 +- puzzle/dummy/main.cpp | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'puzzle/dummy') diff --git a/puzzle/dummy/CMakeLists.txt b/puzzle/dummy/CMakeLists.txt index bcbab88..0d5e1bd 100644 --- a/puzzle/dummy/CMakeLists.txt +++ b/puzzle/dummy/CMakeLists.txt @@ -7,6 +7,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 1) # enable debug features set(CMAKE_BUILD_TYPE Debug) add_compile_definitions(DEBUG) +# add_compile_options(-O0) # no optimizations # arduino set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/lib/Arduino-CMake-Toolchain/Arduino-toolchain.cmake) diff --git a/puzzle/dummy/FreeRTOSConfig.h b/puzzle/dummy/FreeRTOSConfig.h index 1cfdd71..f398db9 100644 --- a/puzzle/dummy/FreeRTOSConfig.h +++ b/puzzle/dummy/FreeRTOSConfig.h @@ -20,7 +20,7 @@ // #define configTOTAL_HEAP_SIZE (1024) #define configTOTAL_HEAP_SIZE (7 * 1024) #define configCHECK_FOR_STACK_OVERFLOW 0 -#define configUSE_MALLOC_FAILED_HOOK 0 +#define configUSE_MALLOC_FAILED_HOOK 1 #define configUSE_DAEMON_TASK_STARTUP_HOOK 0 #define configGENERATE_RUN_TIME_STATS 0 #define configUSE_TRACE_FACILITY 0 diff --git a/puzzle/dummy/main.cpp b/puzzle/dummy/main.cpp index 06f7569..217ce94 100644 --- a/puzzle/dummy/main.cpp +++ b/puzzle/dummy/main.cpp @@ -5,16 +5,30 @@ #include "pb-mod.h" #include "pb-route.h" +#include "pb-send.h" const char * PB_MOD_NAME = "dummy"; const i2c_addr_t PB_MOD_ADDR = 0x69; void setup() { Serial.begin(115200); + + pb_buf_t buf = pb_send_magic_res(); + Serial.print("response bytes:"); + for (size_t i = 0; i < buf.size; i++) { + Serial.print(" "); + Serial.print(buf.data[i]); + } + Serial.print("\r\n"); + pb_buf_free(&buf); } void loop() { - Serial.write("Hello world!\r\n"); + Serial.write("."); vTaskDelay(1000 / portTICK_PERIOD_MS); } +void vApplicationMallocFailedHook(void) { + Serial.println("malloc failed!"); +} + -- cgit v1.2.3