Skip to content

Commit

Permalink
Build flag tweaks - add PIN_ prefix to strain pin defs, move UART on …
Browse files Browse the repository at this point in the history
…S3 to a SK_FORCE_UART_STREAM flag, avoid redefinition warnings by moving build flags out of base config
  • Loading branch information
scottbez1 committed Nov 14, 2023
1 parent 68ebb3b commit adef601
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion firmware/src/interface_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions firmware/src/interface_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<InterfaceTask>, public Logger {
friend class Task<InterfaceTask>; // Allow base Task to invoke protected run()

Expand All @@ -26,10 +30,10 @@ class InterfaceTask : public Task<InterfaceTask>, 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_;
Expand Down
21 changes: 9 additions & 12 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit adef601

Please # to comment.