From adef60109b27fe4d47713ef4445f8e74eb9bfa4f Mon Sep 17 00:00:00 2001 From: Scott Bezek Date: Mon, 13 Nov 2023 22:37:34 -0800 Subject: [PATCH] Build flag tweaks - add PIN_ prefix to strain pin defs, move UART on S3 to a SK_FORCE_UART_STREAM flag, avoid redefinition warnings by moving build flags out of base config --- firmware/src/interface_task.cpp | 2 +- firmware/src/interface_task.h | 10 +++++++--- platformio.ini | 21 +++++++++------------ 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/firmware/src/interface_task.cpp b/firmware/src/interface_task.cpp index a220cf51..97807449 100644 --- a/firmware/src/interface_task.cpp +++ b/firmware/src/interface_task.cpp @@ -262,7 +262,7 @@ void InterfaceTask::run() { Wire.setClock(400000); #endif #if SK_STRAIN - scale.begin(STRAIN_DO, STRAIN_SCK); + scale.begin(PIN_STRAIN_DO, PIN_STRAIN_SCK); #endif #if SK_ALS diff --git a/firmware/src/interface_task.h b/firmware/src/interface_task.h index ddd09412..5a007e05 100644 --- a/firmware/src/interface_task.h +++ b/firmware/src/interface_task.h @@ -12,6 +12,10 @@ #include "serial/uart_stream.h" #include "task.h" +#ifndef SK_FORCE_UART_STREAM + #define SK_FORCE_UART_STREAM 0 +#endif + class InterfaceTask : public Task, public Logger { friend class Task; // Allow base Task to invoke protected run() @@ -26,10 +30,10 @@ class InterfaceTask : public Task, public Logger { void run(); private: - #if DLOGS_STREAM == 0 - UartStream stream_; - #elif DLOGS_STREAM == 1 + #if defined(CONFIG_IDF_TARGET_ESP32S3) && !SK_FORCE_UART_STREAM HWCDC stream_; + #else + UartStream stream_; #endif MotorTask& motor_task_; DisplayTask* display_task_; diff --git a/platformio.ini b/platformio.ini index fa823142..2525fb0b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -36,13 +36,6 @@ lib_deps = ; otherwise not used during application firmware compilation. build_flags = -DMONITOR_SPEED=921600 - -DLOGS_STREAM=0 ; 0 - plaintext, 1 - HWCDC - - ; Strain config - -DSTRAIN_DO=38 - -DSTRAIN_SCK=2 - - -DSK_BACKLIGHT_BIT_DEPTH=16 [env:view] extends = base_config @@ -93,12 +86,16 @@ build_flags = -DPIN_MT_CSN=14 -DPIN_LED_DATA=7 -DPIN_LCD_BACKLIGHT=19 + -DPIN_STRAIN_DO=38 + -DPIN_STRAIN_SCK=2 -DDESCRIPTION_FONT=Roboto_Thin_24 -DDESCRIPTION_Y_OFFSET=20 -DVALUE_OFFSET=30 -DDRAW_ARC=0 + -DSK_BACKLIGHT_BIT_DEPTH=16 + ; TFT_eSPI setup -DUSER_SETUP_LOADED=1 -DGC9A01_DRIVER=1 @@ -146,7 +143,6 @@ lib_deps = build_flags = ${base_config.build_flags} - -DLOGS_STREAM=1 ; 0 - plaintext, 1 - HWCDC ; Display enabled: 1=enable, 0=disable -DSK_DISPLAY=0 ; Display orientation: 0=usb bottom, 2=usb top @@ -212,6 +208,8 @@ lib_deps = build_flags = ${base_config.build_flags} + ; Use physical UART for the serial stream rather than the S3 default USB CDC + -DSK_FORCE_UART_STREAM=1 -DMONITOR_SPEED=115200 ; Display enabled: 1=enable, 0=disable -DSK_DISPLAY=1 @@ -234,10 +232,6 @@ build_flags = -DMOTOR_WANZHIDA_ONCE_TOP=1 - ; Strain config - -DSTRAIN_DO=38 - -DSTRAIN_SCK=1 - ; Pin configurations ; Motor -DPIN_UH=20 @@ -259,6 +253,9 @@ build_flags = -DPIN_MT_CLOCK=13 -DPIN_MT_CSN=14 + -DPIN_STRAIN_DO=38 + -DPIN_STRAIN_SCK=1 + -DDESCRIPTION_FONT=Roboto_Thin_24 -DDESCRIPTION_Y_OFFSET=20 -DVALUE_OFFSET=30