From 0ad25f8618fbfe4e89e11e0c54708fbbeaa28cb3 Mon Sep 17 00:00:00 2001 From: katharine Date: Mon, 11 Nov 2024 20:54:59 -0500 Subject: [PATCH 01/37] add -C flag --- .envrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.envrc b/.envrc index 25cab32ec..d821eaaaa 100644 --- a/.envrc +++ b/.envrc @@ -58,5 +58,6 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi +export SCONSFLAGS="${SCONSFLAGS:+$SCONSFLAGS }-C $(pwd)" pre-commit install --allow-missing-config From e46b7f54ea5da5e545b5efa33ed7bf6e66b04b12 Mon Sep 17 00:00:00 2001 From: katharine Date: Tue, 12 Nov 2024 21:52:27 -0500 Subject: [PATCH 02/37] increased readability --- .envrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.envrc b/.envrc index d821eaaaa..207d80b02 100644 --- a/.envrc +++ b/.envrc @@ -8,6 +8,7 @@ watch_file './rust-toolchain.toml' watch_file './site_scons/env.py' eval $(./site_scons/env.py --export) +export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" @@ -58,6 +59,4 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi -export SCONSFLAGS="${SCONSFLAGS:+$SCONSFLAGS }-C $(pwd)" - pre-commit install --allow-missing-config From 3d9610ede3afe1c329ee1c689f49277ad92bbcd0 Mon Sep 17 00:00:00 2001 From: katharine Date: Wed, 13 Nov 2024 16:36:30 -0500 Subject: [PATCH 03/37] let code breathe --- .envrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.envrc b/.envrc index 207d80b02..8dacac439 100644 --- a/.envrc +++ b/.envrc @@ -8,6 +8,7 @@ watch_file './rust-toolchain.toml' watch_file './site_scons/env.py' eval $(./site_scons/env.py --export) + export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" @@ -59,4 +60,5 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi + pre-commit install --allow-missing-config From 11d036c9a0bc9bbf631ef56bdd1a0cbe0675e43c Mon Sep 17 00:00:00 2001 From: katharine Date: Mon, 11 Nov 2024 20:54:59 -0500 Subject: [PATCH 04/37] add -C flag --- .envrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.envrc b/.envrc index 8dacac439..f6dcc20ff 100644 --- a/.envrc +++ b/.envrc @@ -60,5 +60,6 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi +export SCONSFLAGS="${SCONSFLAGS:+$SCONSFLAGS }-C $(pwd)" pre-commit install --allow-missing-config From 239926a9962650527ae24271ba7ee25f5c6d409d Mon Sep 17 00:00:00 2001 From: katharine Date: Tue, 12 Nov 2024 21:52:27 -0500 Subject: [PATCH 05/37] increased readability --- .envrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.envrc b/.envrc index f6dcc20ff..625129885 100644 --- a/.envrc +++ b/.envrc @@ -8,6 +8,7 @@ watch_file './rust-toolchain.toml' watch_file './site_scons/env.py' eval $(./site_scons/env.py --export) +export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" @@ -60,6 +61,4 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi -export SCONSFLAGS="${SCONSFLAGS:+$SCONSFLAGS }-C $(pwd)" - pre-commit install --allow-missing-config From 692b9620fdbecaa7d04bbaf7d1372e114b9b19d1 Mon Sep 17 00:00:00 2001 From: katharine Date: Wed, 13 Nov 2024 16:36:30 -0500 Subject: [PATCH 06/37] let code breathe --- .envrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.envrc b/.envrc index 625129885..408cce337 100644 --- a/.envrc +++ b/.envrc @@ -8,6 +8,7 @@ watch_file './rust-toolchain.toml' watch_file './site_scons/env.py' eval $(./site_scons/env.py --export) + export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" @@ -61,4 +62,5 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi + pre-commit install --allow-missing-config From 467d9d3e5ce378d0ac6799303b17791e1fe73c06 Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 28 Feb 2025 16:24:00 -0500 Subject: [PATCH 07/37] added initial files --- components/sup/src/sup.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 63514639d..30956b7c1 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -1,5 +1,6 @@ #include "sup.h" +#include "driver/gpio.h" #include "firmware-base/state-machine.h" #include #include @@ -8,16 +9,46 @@ #include #include +#define LED_PIN 2 + +static void blink_led_10hz(); +static void init_led(); static void sup_100Hz(); static bool bbc_authorized; static bool throttle_authorized; static bool steer_authorized; +typedef enum { + SEG_A = 13, + SEG_B = 4, + SEG_C = 7, + SEG_D = 8, + SEG_E = 9, + SEG_F = 12, + SEG_G = 5, + SEG_DP = 11 +} SEVEN_SEG_PINS; + ember_rate_funcs_S module_rf = { + .call_init = init_led, + .call_10Hz = blink_led_10hz, .call_100Hz = sup_100Hz, }; +static void init_led() +{ + gpio_pad_select_gpio(LED_PIN); + gpio_set_direction(LED_PIN, GPIO_MODE_OUTPUT); +} + +static void blink_led_10hz() +{ + static int signal; + signal = !signal; + gpio_set_level(LED_PIN, signal); // Turn LED on +} + static void sup_100Hz() { bool authorized; From 8b2b78cbc1e7c349e3f7261dbd7112d59d20bd91 Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 7 Mar 2025 15:29:04 -0500 Subject: [PATCH 08/37] testing push --- components/sup/src/sup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 30956b7c1..9e821a1f4 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -45,8 +45,8 @@ static void init_led() static void blink_led_10hz() { static int signal; - signal = !signal; - gpio_set_level(LED_PIN, signal); // Turn LED on + // signal = !signal; + // gpio_set_level(LED_PIN, signal); // Turn LED on } static void sup_100Hz() From fdbf8bec41525cea2b87aa57e283daef6a8e31fa Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 7 Mar 2025 15:55:53 -0500 Subject: [PATCH 09/37] clanged sup.c --- components/sup/src/sup.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 9e821a1f4..82822b674 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -42,13 +42,6 @@ static void init_led() gpio_set_direction(LED_PIN, GPIO_MODE_OUTPUT); } -static void blink_led_10hz() -{ - static int signal; - // signal = !signal; - // gpio_set_level(LED_PIN, signal); // Turn LED on -} - static void sup_100Hz() { bool authorized; From a51ea58c874db4f36f25d9d8906e4fcba554cdc2 Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 7 Mar 2025 16:11:14 -0500 Subject: [PATCH 10/37] created enum arrays for zero/one --- components/sup/src/sup.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 82822b674..40f7c8556 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -27,9 +27,17 @@ typedef enum { SEG_E = 9, SEG_F = 12, SEG_G = 5, - SEG_DP = 11 + SEG_DP = 11, + SEG_1 = 1, + SEG_2 = 2, + SEG_3 = 3, + SEG_4 = 6, } SEVEN_SEG_PINS; +static enum SEVEN_SEG_PINS zero[] = {SEG_A, SEG_B, SEG_C, SEG_D, SEG_E, SEG_F}; + +static enum SEVEN_SEG_PINS one[] = {SEG_B, SEG_C}; + ember_rate_funcs_S module_rf = { .call_init = init_led, .call_10Hz = blink_led_10hz, From cafd6d174cf511c6c0024e24ac1c6cc1c57fbf0f Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 7 Mar 2025 16:16:59 -0500 Subject: [PATCH 11/37] initialized all the pins --- components/sup/src/sup.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 40f7c8556..1bd182baf 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -38,6 +38,34 @@ static enum SEVEN_SEG_PINS zero[] = {SEG_A, SEG_B, SEG_C, SEG_D, SEG_E, SEG_F}; static enum SEVEN_SEG_PINS one[] = {SEG_B, SEG_C}; +static void init_led() +{ + gpio_pad_select_gpio(SEG_A); + gpio_set_direction(SEG_A, GPIO_MODE_OUTPUT); + gpio_pad_select_gpio(SEG_B); + gpio_set_direction(SEG_B, GPIO_MODE_OUTPUT); + gpio_pad_select_gpio(SEG_C); + gpio_set_direction(SEG_C, GPIO_MODE_OUTPUT); + gpio_pad_select_gpio(SEG_D); + gpio_set_direction(SEG_D, GPIO_MODE_OUTPUT); + gpio_pad_select_gpio(SEG_E); + gpio_set_direction(SEG_E, GPIO_MODE_OUTPUT); + gpio_pad_select_gpio(SEG_F); + gpio_set_direction(SEG_F, GPIO_MODE_OUTPUT); + gpio_pad_select_gpio(SEG_G); + gpio_set_direction(SEG_G, GPIO_MODE_OUTPUT); + gpio_pad_select_gpio(SEG_DP); + gpio_set_direction(SEG_DP, GPIO_MODE_OUTPUT); + gpio_pad_select_gpio(SEG_1); + gpio_set_direction(SEG_1, GPIO_MODE_OUTPUT); + gpio_pad_select_gpio(SEG_2); + gpio_set_direction(SEG_2, GPIO_MODE_OUTPUT); + gpio_pad_select_gpio(SEG_3); + gpio_set_direction(SEG_3, GPIO_MODE_OUTPUT); + gpio_pad_select_gpio(SEG_4); + gpio_set_direction(SEG_4, GPIO_MODE_OUTPUT); +} + ember_rate_funcs_S module_rf = { .call_init = init_led, .call_10Hz = blink_led_10hz, From 4dccda1da78e842d19b675e6588edf67f6347489 Mon Sep 17 00:00:00 2001 From: Julie Hum Date: Fri, 7 Mar 2025 16:35:56 -0500 Subject: [PATCH 12/37] hum --- components/sup/src/sup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 1bd182baf..2b88f98d5 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -9,7 +9,7 @@ #include #include -#define LED_PIN 2 +#define LED_PIN 6 static void blink_led_10hz(); static void init_led(); @@ -66,6 +66,10 @@ static void init_led() gpio_set_direction(SEG_4, GPIO_MODE_OUTPUT); } +static void bts_authorization() +{ +} + ember_rate_funcs_S module_rf = { .call_init = init_led, .call_10Hz = blink_led_10hz, From 357e2c809915a929cf3c6d02c901147bc396715b Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 7 Mar 2025 16:27:43 -0500 Subject: [PATCH 13/37] added init --- components/sup/src/sup.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 2b88f98d5..2ec280b38 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -11,7 +11,7 @@ #define LED_PIN 6 -static void blink_led_10hz(); +static void authorize_led(); static void init_led(); static void sup_100Hz(); @@ -64,6 +64,11 @@ static void init_led() gpio_set_direction(SEG_3, GPIO_MODE_OUTPUT); gpio_pad_select_gpio(SEG_4); gpio_set_direction(SEG_4, GPIO_MODE_OUTPUT); + + + for (int i = 0; i < 6; i++) { + gpio_set_level(zero[i], 1); + } } static void bts_authorization() @@ -71,17 +76,11 @@ static void bts_authorization() } ember_rate_funcs_S module_rf = { - .call_init = init_led, - .call_10Hz = blink_led_10hz, + .call_init = init_led, + //.call_10Hz = blink_led_10hz, .call_100Hz = sup_100Hz, }; -static void init_led() -{ - gpio_pad_select_gpio(LED_PIN); - gpio_set_direction(LED_PIN, GPIO_MODE_OUTPUT); -} - static void sup_100Hz() { bool authorized; From fbaf1f12bbcdf343c0d5a35f23ad0abd74865d82 Mon Sep 17 00:00:00 2001 From: Julie Hum Date: Fri, 7 Mar 2025 16:46:18 -0500 Subject: [PATCH 14/37] s --- components/sup/src/sup.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 2ec280b38..63c88a929 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -71,8 +71,24 @@ static void init_led() } } +static void set_one() +{ + for (int i = 0; i < 2; i++) { + gpio_set_level(one[i], 1); + } +} + static void bts_authorization() { + if (!bbc_authorized) { + set_one(); + } + if (!throttle_authorized) { + set_one(); + } + if (!steer_authorized) { + set_one(); + } } ember_rate_funcs_S module_rf = { From bdedc4ec5e99a3126490d744a656f0bf2707e372 Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 7 Mar 2025 16:40:28 -0500 Subject: [PATCH 15/37] added digit 1-3 on --- components/sup/src/sup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 63c88a929..0a26b5564 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -69,6 +69,9 @@ static void init_led() for (int i = 0; i < 6; i++) { gpio_set_level(zero[i], 1); } + gpio_set_level(SEG_1, 1); + gpio_set_level(SEG_2, 1); + gpio_set_level(SEG_3, 1); } static void set_one() From 1416ccfda091aa14d8059d4f80f289d4d39fa612 Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 7 Mar 2025 19:52:25 -0500 Subject: [PATCH 16/37] wrote bts_authorization with 100ms view delay --- components/sup/src/sup.c | 100 +++++++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 41 deletions(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 0a26b5564..112f49d4e 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -9,11 +9,14 @@ #include #include -#define LED_PIN 6 -static void authorize_led(); +static void bts_authorization(); static void init_led(); static void sup_100Hz(); +static void init_pin(SEVEN_SEG_PINS pin); +static void set_one(); +static void set_zero(); + static bool bbc_authorized; static bool throttle_authorized; @@ -34,38 +37,33 @@ typedef enum { SEG_4 = 6, } SEVEN_SEG_PINS; -static enum SEVEN_SEG_PINS zero[] = {SEG_A, SEG_B, SEG_C, SEG_D, SEG_E, SEG_F}; +static const SEVEN_SEG_PINS zero[] + = {SEG_A, SEG_B, SEG_C, SEG_D, SEG_E, SEG_F}; -static enum SEVEN_SEG_PINS one[] = {SEG_B, SEG_C}; +static const SEVEN_SEG_PINS one[] = {SEG_B, SEG_C}; -static void init_led() +static void init_pin(SEVEN_SEG_PINS pin) { - gpio_pad_select_gpio(SEG_A); - gpio_set_direction(SEG_A, GPIO_MODE_OUTPUT); - gpio_pad_select_gpio(SEG_B); - gpio_set_direction(SEG_B, GPIO_MODE_OUTPUT); - gpio_pad_select_gpio(SEG_C); - gpio_set_direction(SEG_C, GPIO_MODE_OUTPUT); - gpio_pad_select_gpio(SEG_D); - gpio_set_direction(SEG_D, GPIO_MODE_OUTPUT); - gpio_pad_select_gpio(SEG_E); - gpio_set_direction(SEG_E, GPIO_MODE_OUTPUT); - gpio_pad_select_gpio(SEG_F); - gpio_set_direction(SEG_F, GPIO_MODE_OUTPUT); - gpio_pad_select_gpio(SEG_G); - gpio_set_direction(SEG_G, GPIO_MODE_OUTPUT); - gpio_pad_select_gpio(SEG_DP); - gpio_set_direction(SEG_DP, GPIO_MODE_OUTPUT); - gpio_pad_select_gpio(SEG_1); - gpio_set_direction(SEG_1, GPIO_MODE_OUTPUT); - gpio_pad_select_gpio(SEG_2); - gpio_set_direction(SEG_2, GPIO_MODE_OUTPUT); - gpio_pad_select_gpio(SEG_3); - gpio_set_direction(SEG_3, GPIO_MODE_OUTPUT); - gpio_pad_select_gpio(SEG_4); - gpio_set_direction(SEG_4, GPIO_MODE_OUTPUT); - + gpio_pad_select_gpio(pin); + gpio_set_direction(pin, GPIO_MODE_OUTPUT); +} +static void init_led() +{ + init_pin(SEG_A); + init_pin(SEG_B); + init_pin(SEG_C); + init_pin(SEG_D); + init_pin(SEG_E); + init_pin(SEG_F); + init_pin(SEG_G); + init_pin(SEG_DP); + init_pin(SEG_1); + init_pin(SEG_2); + init_pin(SEG_3); + init_pin(SEG_4); + + // set default state to 0 for (int i = 0; i < 6; i++) { gpio_set_level(zero[i], 1); } @@ -81,23 +79,43 @@ static void set_one() } } -static void bts_authorization() +static void set_zero() { - if (!bbc_authorized) { - set_one(); - } - if (!throttle_authorized) { - set_one(); + for (int i = 0; i < 6; i++) { + gpio_set_level(zero[i], 1); } - if (!steer_authorized) { - set_one(); +} + +static void bts_authorization() +{ + for (int i = 0; i < 3; i++) { + if (i == 0) { + if (!bbc_authorized) { + set_one(); + } else { + set_zero(); + } + } else if (i == 1) { + if (!throttle_authorized) { + set_one(); + } else { + set_zero(); + } + } else { + if (!steer_authorized) { + set_one(); + } else { + set_zero(); + } + } + vTaskDelay(100 / portTICK_PERIOD_MS); } } ember_rate_funcs_S module_rf = { - .call_init = init_led, - //.call_10Hz = blink_led_10hz, - .call_100Hz = sup_100Hz, + .call_init = init_led, + .call_1000Hz = bts_authorization, + .call_100Hz = sup_100Hz, }; static void sup_100Hz() From ef1d459d65b4cff4d6eefe6b0449a3ab07070905 Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 7 Mar 2025 21:46:38 -0500 Subject: [PATCH 17/37] fixed enum def before func --- components/sup/src/sup.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 112f49d4e..77f6b9190 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -9,19 +9,6 @@ #include #include - -static void bts_authorization(); -static void init_led(); -static void sup_100Hz(); -static void init_pin(SEVEN_SEG_PINS pin); -static void set_one(); -static void set_zero(); - - -static bool bbc_authorized; -static bool throttle_authorized; -static bool steer_authorized; - typedef enum { SEG_A = 13, SEG_B = 4, @@ -37,6 +24,19 @@ typedef enum { SEG_4 = 6, } SEVEN_SEG_PINS; +static void bts_authorization(); +static void init_led(); +static void sup_100Hz(); +static void init_pin(SEVEN_SEG_PINS pin); +static void set_one(); +static void set_zero(); + + +static bool bbc_authorized; +static bool throttle_authorized; +static bool steer_authorized; + + static const SEVEN_SEG_PINS zero[] = {SEG_A, SEG_B, SEG_C, SEG_D, SEG_E, SEG_F}; @@ -113,9 +113,9 @@ static void bts_authorization() } ember_rate_funcs_S module_rf = { - .call_init = init_led, - .call_1000Hz = bts_authorization, - .call_100Hz = sup_100Hz, + .call_init = init_led, + .call_100Hz = bts_authorization, + .call_100Hz = sup_100Hz, }; static void sup_100Hz() From 63ffdc262f5d4612accfe42658a6fa6221dc79df Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 14 Mar 2025 15:50:11 -0400 Subject: [PATCH 18/37] fixed set_one to remove zero --- components/sup/src/sup.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 77f6b9190..cbb11be18 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -74,6 +74,9 @@ static void init_led() static void set_one() { + for (int i = 0; i < 6; i++) { + gpio_set_level(zero[i], 0); + } for (int i = 0; i < 2; i++) { gpio_set_level(one[i], 1); } @@ -92,6 +95,7 @@ static void bts_authorization() if (i == 0) { if (!bbc_authorized) { set_one(); + } else { set_zero(); } From c8150589eaafc33fd894bdcb4871ff095333151a Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 14 Mar 2025 16:03:25 -0400 Subject: [PATCH 19/37] trying selected digits --- components/sup/src/sup.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index cbb11be18..0cc42fe6a 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -93,6 +93,9 @@ static void bts_authorization() { for (int i = 0; i < 3; i++) { if (i == 0) { + gpio_set_level(SEG_1, 1); + gpio_set_level(SEG_2, 0); + gpio_set_level(SEG_3, 0); if (!bbc_authorized) { set_one(); @@ -100,12 +103,18 @@ static void bts_authorization() set_zero(); } } else if (i == 1) { + gpio_set_level(SEG_1, 0); + gpio_set_level(SEG_2, 1); + gpio_set_level(SEG_3, 0); if (!throttle_authorized) { set_one(); } else { set_zero(); } } else { + gpio_set_level(SEG_1, 0); + gpio_set_level(SEG_2, 0); + gpio_set_level(SEG_3, 1); if (!steer_authorized) { set_one(); } else { From d50d7c7639268b2675d892ca5722565c69afeccf Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 14 Mar 2025 16:18:00 -0400 Subject: [PATCH 20/37] changed to active low --- components/sup/src/sup.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 0cc42fe6a..4c472cf40 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -64,9 +64,7 @@ static void init_led() init_pin(SEG_4); // set default state to 0 - for (int i = 0; i < 6; i++) { - gpio_set_level(zero[i], 1); - } + set_zero(); gpio_set_level(SEG_1, 1); gpio_set_level(SEG_2, 1); gpio_set_level(SEG_3, 1); @@ -75,18 +73,20 @@ static void init_led() static void set_one() { for (int i = 0; i < 6; i++) { - gpio_set_level(zero[i], 0); + gpio_set_level(zero[i], 1); } for (int i = 0; i < 2; i++) { - gpio_set_level(one[i], 1); + gpio_set_level(one[i], 0); } + gpio_set_level(SEG_G, 1); } static void set_zero() { for (int i = 0; i < 6; i++) { - gpio_set_level(zero[i], 1); + gpio_set_level(zero[i], 0); // active low } + gpio_set_level(SEG_G, 1); } static void bts_authorization() From eee1b82149c36ead070a3e63f3bd1940a9b2b716 Mon Sep 17 00:00:00 2001 From: Julie Hum Date: Fri, 21 Mar 2025 20:04:12 -0400 Subject: [PATCH 21/37] edit --- components/sup/src/sup.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 4c472cf40..177b3e042 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -32,6 +32,9 @@ static void set_one(); static void set_zero(); +static bool bbc = 0; +static bool throttle = 0; +static bool steer = 0; static bool bbc_authorized; static bool throttle_authorized; static bool steer_authorized; @@ -64,6 +67,7 @@ static void init_led() init_pin(SEG_4); // set default state to 0 + set_zero(); gpio_set_level(SEG_1, 1); gpio_set_level(SEG_2, 1); @@ -96,38 +100,34 @@ static void bts_authorization() gpio_set_level(SEG_1, 1); gpio_set_level(SEG_2, 0); gpio_set_level(SEG_3, 0); - if (!bbc_authorized) { + // set_one(); + if (bbc == 0) { set_one(); - - } else { - set_zero(); } + printf("bbb"); } else if (i == 1) { gpio_set_level(SEG_1, 0); gpio_set_level(SEG_2, 1); gpio_set_level(SEG_3, 0); - if (!throttle_authorized) { + if (!throttle) { set_one(); - } else { - set_zero(); } } else { gpio_set_level(SEG_1, 0); gpio_set_level(SEG_2, 0); gpio_set_level(SEG_3, 1); - if (!steer_authorized) { + if (!steer) { set_one(); - } else { - set_zero(); } } - vTaskDelay(100 / portTICK_PERIOD_MS); + + for (int j = 0; j < 10000; j++) void; } } ember_rate_funcs_S module_rf = { .call_init = init_led, - .call_100Hz = bts_authorization, + .call_1Hz = bts_authorization, .call_100Hz = sup_100Hz, }; From 6d9ef43997f8b9c8dbafde006bd4edf22e2c196e Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 28 Mar 2025 14:29:56 -0400 Subject: [PATCH 22/37] testing static bts authorize --- components/sup/src/sup.c | 59 +++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 177b3e042..b5b16609f 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -45,6 +45,12 @@ static const SEVEN_SEG_PINS zero[] static const SEVEN_SEG_PINS one[] = {SEG_B, SEG_C}; +static enum { + bbc_state, + throttle_state, + steer_state +} current_state = bbc_state; + static void init_pin(SEVEN_SEG_PINS pin) { gpio_pad_select_gpio(pin); @@ -95,34 +101,37 @@ static void set_zero() static void bts_authorization() { - for (int i = 0; i < 3; i++) { - if (i == 0) { - gpio_set_level(SEG_1, 1); - gpio_set_level(SEG_2, 0); - gpio_set_level(SEG_3, 0); - // set_one(); - if (bbc == 0) { - set_one(); - } - printf("bbb"); - } else if (i == 1) { - gpio_set_level(SEG_1, 0); - gpio_set_level(SEG_2, 1); - gpio_set_level(SEG_3, 0); - if (!throttle) { - set_one(); - } + if (current_state == bbc_state) { + if (bbc_authorized) { + // if bbc is authorized, show 0 + set_zero(); } else { - gpio_set_level(SEG_1, 0); - gpio_set_level(SEG_2, 0); - gpio_set_level(SEG_3, 1); - if (!steer) { - set_one(); - } + // if not authorized, show 1 + set_one(); } - - for (int j = 0; j < 10000; j++) void; + gpio_set_level(SEG_1, 1); + gpio_set_level(SEG_2, 0); + gpio_set_level(SEG_3, 0); + } else if (current_state == throttle_state) { + if (throttle_authorized) { + set_zero(); + } else { + set_one(); + } + gpio_set_level(SEG_1, 0); + gpio_set_level(SEG_2, 1); + gpio_set_level(SEG_3, 0); + } else if (current_state == steer_state) { + if (steer_authorized) { + set_zero(); + } else { + set_one(); + } + gpio_set_level(SEG_1, 0); + gpio_set_level(SEG_2, 0); + gpio_set_level(SEG_3, 1); } + current_state = (current_state + 1) % 3; } ember_rate_funcs_S module_rf = { From f44575886b4c1927e5cac1e0b1b37b652b3b5302 Mon Sep 17 00:00:00 2001 From: katharine Date: Mon, 11 Nov 2024 20:54:59 -0500 Subject: [PATCH 23/37] add -C flag --- .envrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.envrc b/.envrc index 408cce337..6e45a6a37 100644 --- a/.envrc +++ b/.envrc @@ -62,5 +62,6 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi +export SCONSFLAGS="${SCONSFLAGS:+$SCONSFLAGS }-C $(pwd)" pre-commit install --allow-missing-config From 98f45dce2f88445e0028bf4833bfb85fba858376 Mon Sep 17 00:00:00 2001 From: katharine Date: Tue, 12 Nov 2024 21:52:27 -0500 Subject: [PATCH 24/37] increased readability --- .envrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.envrc b/.envrc index 6e45a6a37..16f93006b 100644 --- a/.envrc +++ b/.envrc @@ -8,6 +8,7 @@ watch_file './rust-toolchain.toml' watch_file './site_scons/env.py' eval $(./site_scons/env.py --export) +export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" @@ -62,6 +63,4 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi -export SCONSFLAGS="${SCONSFLAGS:+$SCONSFLAGS }-C $(pwd)" - pre-commit install --allow-missing-config From eabe265a5878d64d8ccc822a4dee550ee2f037d1 Mon Sep 17 00:00:00 2001 From: katharine Date: Wed, 13 Nov 2024 16:36:30 -0500 Subject: [PATCH 25/37] let code breathe --- .envrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.envrc b/.envrc index 16f93006b..ae96590d4 100644 --- a/.envrc +++ b/.envrc @@ -8,6 +8,7 @@ watch_file './rust-toolchain.toml' watch_file './site_scons/env.py' eval $(./site_scons/env.py --export) + export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" @@ -63,4 +64,5 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi + pre-commit install --allow-missing-config From d3e7f57f9668801ee15d7bbd2855970ce8f3977b Mon Sep 17 00:00:00 2001 From: katharine Date: Mon, 11 Nov 2024 20:54:59 -0500 Subject: [PATCH 26/37] add -C flag --- .envrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.envrc b/.envrc index ae96590d4..268a0d055 100644 --- a/.envrc +++ b/.envrc @@ -64,5 +64,6 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi +export SCONSFLAGS="${SCONSFLAGS:+$SCONSFLAGS }-C $(pwd)" pre-commit install --allow-missing-config From 7bac742253c04bc97e9c72d53afc6b193833c89e Mon Sep 17 00:00:00 2001 From: katharine Date: Tue, 12 Nov 2024 21:52:27 -0500 Subject: [PATCH 27/37] increased readability --- .envrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.envrc b/.envrc index 268a0d055..a4a944d44 100644 --- a/.envrc +++ b/.envrc @@ -8,6 +8,7 @@ watch_file './rust-toolchain.toml' watch_file './site_scons/env.py' eval $(./site_scons/env.py --export) +export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" @@ -64,6 +65,4 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi -export SCONSFLAGS="${SCONSFLAGS:+$SCONSFLAGS }-C $(pwd)" - pre-commit install --allow-missing-config From 35b6e48232e4c5cc319129c9513386b4d546cfdc Mon Sep 17 00:00:00 2001 From: katharine Date: Wed, 13 Nov 2024 16:36:30 -0500 Subject: [PATCH 28/37] let code breathe --- .envrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.envrc b/.envrc index a4a944d44..f958d94f0 100644 --- a/.envrc +++ b/.envrc @@ -8,6 +8,7 @@ watch_file './rust-toolchain.toml' watch_file './site_scons/env.py' eval $(./site_scons/env.py --export) + export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" @@ -65,4 +66,5 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi + pre-commit install --allow-missing-config From 8a87234f7cf41f735feb5c7556ae4db0edf53716 Mon Sep 17 00:00:00 2001 From: katharine Date: Mon, 11 Nov 2024 20:54:59 -0500 Subject: [PATCH 29/37] add -C flag --- .envrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.envrc b/.envrc index f958d94f0..cfaa31b3b 100644 --- a/.envrc +++ b/.envrc @@ -66,5 +66,6 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi +export SCONSFLAGS="${SCONSFLAGS:+$SCONSFLAGS }-C $(pwd)" pre-commit install --allow-missing-config From 1d93a403eb25cf95a0713afeab5b8b65c0fa08d8 Mon Sep 17 00:00:00 2001 From: katharine Date: Tue, 12 Nov 2024 21:52:27 -0500 Subject: [PATCH 30/37] increased readability --- .envrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.envrc b/.envrc index cfaa31b3b..0bc864b4b 100644 --- a/.envrc +++ b/.envrc @@ -8,6 +8,7 @@ watch_file './rust-toolchain.toml' watch_file './site_scons/env.py' eval $(./site_scons/env.py --export) +export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" @@ -66,6 +67,4 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi -export SCONSFLAGS="${SCONSFLAGS:+$SCONSFLAGS }-C $(pwd)" - pre-commit install --allow-missing-config From 5997ded2d58820368c5fda984f0b8ecfd9b50539 Mon Sep 17 00:00:00 2001 From: katharine Date: Wed, 13 Nov 2024 16:36:30 -0500 Subject: [PATCH 31/37] let code breathe --- .envrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.envrc b/.envrc index 0bc864b4b..be6a14ded 100644 --- a/.envrc +++ b/.envrc @@ -8,6 +8,7 @@ watch_file './rust-toolchain.toml' watch_file './site_scons/env.py' eval $(./site_scons/env.py --export) + export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" @@ -67,4 +68,5 @@ if [ ! -f "$DIRENV_INSTALLED_CRATES" ]; then invoke deps.cargo.install fi + pre-commit install --allow-missing-config From adcbaa7d1e0a0edc72e1470b0ced4dcadf81f915 Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 7 Mar 2025 16:27:43 -0500 Subject: [PATCH 32/37] added init --- components/sup/src/sup.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index b5b16609f..fe05307a1 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -9,6 +9,16 @@ #include #include +#define LED_PIN 6 + +static void blink_led_10hz(); +static void init_led(); +static void sup_100Hz(); + +static bool bbc_authorized; +static bool throttle_authorized; +static bool steer_authorized; + typedef enum { SEG_A = 13, SEG_B = 4, @@ -136,7 +146,7 @@ static void bts_authorization() ember_rate_funcs_S module_rf = { .call_init = init_led, - .call_1Hz = bts_authorization, + .call_10Hz = blink_led_10hz, .call_100Hz = sup_100Hz, }; From 6bd300827943dff9fab79b51fb42cb291dbfb220 Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 7 Mar 2025 16:40:28 -0500 Subject: [PATCH 33/37] added digit 1-3 on --- components/sup/src/sup.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index fe05307a1..b5b16609f 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -9,16 +9,6 @@ #include #include -#define LED_PIN 6 - -static void blink_led_10hz(); -static void init_led(); -static void sup_100Hz(); - -static bool bbc_authorized; -static bool throttle_authorized; -static bool steer_authorized; - typedef enum { SEG_A = 13, SEG_B = 4, @@ -146,7 +136,7 @@ static void bts_authorization() ember_rate_funcs_S module_rf = { .call_init = init_led, - .call_10Hz = blink_led_10hz, + .call_1Hz = bts_authorization, .call_100Hz = sup_100Hz, }; From 20ea781a36f05d51e1b074630ea31cbb832af7e8 Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 4 Apr 2025 16:43:59 -0400 Subject: [PATCH 34/37] switched to 1khz --- components/sup/src/sup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index b5b16609f..99f6d7578 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -136,7 +136,7 @@ static void bts_authorization() ember_rate_funcs_S module_rf = { .call_init = init_led, - .call_1Hz = bts_authorization, + .call_1kHz = bts_authorization, .call_100Hz = sup_100Hz, }; From 537a4360fcc78e2072eea2a48031051ce883efa0 Mon Sep 17 00:00:00 2001 From: zidanekarim Date: Fri, 4 Apr 2025 16:45:38 -0400 Subject: [PATCH 35/37] removed tester variables --- components/sup/src/sup.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 99f6d7578..01a4b015c 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -32,9 +32,6 @@ static void set_one(); static void set_zero(); -static bool bbc = 0; -static bool throttle = 0; -static bool steer = 0; static bool bbc_authorized; static bool throttle_authorized; static bool steer_authorized; From 23483cd53e8a82d1265f63ba7544b73ae99ba07d Mon Sep 17 00:00:00 2001 From: Julie Hum Date: Fri, 25 Apr 2025 15:26:01 -0400 Subject: [PATCH 36/37] updated to use gpio_config and bitmasking --- components/sup/src/sup.c | 154 +++++++++++++++++---------------------- 1 file changed, 65 insertions(+), 89 deletions(-) diff --git a/components/sup/src/sup.c b/components/sup/src/sup.c index 01a4b015c..2339befc9 100644 --- a/components/sup/src/sup.c +++ b/components/sup/src/sup.c @@ -2,6 +2,7 @@ #include "driver/gpio.h" #include "firmware-base/state-machine.h" +#include "soc/gpio_num.h" #include #include #include @@ -10,130 +11,105 @@ #include typedef enum { - SEG_A = 13, - SEG_B = 4, - SEG_C = 7, - SEG_D = 8, - SEG_E = 9, - SEG_F = 12, - SEG_G = 5, - SEG_DP = 11, - SEG_1 = 1, - SEG_2 = 2, - SEG_3 = 3, - SEG_4 = 6, -} SEVEN_SEG_PINS; - -static void bts_authorization(); + PIN_SEG_A = GPIO_NUM_13, + PIN_SEG_B = GPIO_NUM_4, + PIN_SEG_C = GPIO_NUM_7, + PIN_SEG_D = GPIO_NUM_8, + PIN_SEG_E = GPIO_NUM_9, + PIN_SEG_F = GPIO_NUM_12, + PIN_SEG_1 = GPIO_NUM_1, + PIN_SEG_2 = GPIO_NUM_2, + PIN_SEG_3 = GPIO_NUM_5, +} seven_segment_pin_t; + +static void display_authorization(); static void init_led(); static void sup_100Hz(); -static void init_pin(SEVEN_SEG_PINS pin); -static void set_one(); -static void set_zero(); +static void init_pin(seven_segment_pin_t pin); +static void set_pins(char bitfield); static bool bbc_authorized; static bool throttle_authorized; static bool steer_authorized; - -static const SEVEN_SEG_PINS zero[] - = {SEG_A, SEG_B, SEG_C, SEG_D, SEG_E, SEG_F}; - -static const SEVEN_SEG_PINS one[] = {SEG_B, SEG_C}; +static const char ZERO = 0x3F; +static const char ONE = 0x06; static enum { - bbc_state, - throttle_state, - steer_state -} current_state = bbc_state; - -static void init_pin(SEVEN_SEG_PINS pin) -{ - gpio_pad_select_gpio(pin); - gpio_set_direction(pin, GPIO_MODE_OUTPUT); -} + BBC_STATE, + THROTTLE_STATE, + STEER_STATE, + STATES_TOTAL +} CURRENT_STATE = BBC_STATE; + +gpio_config_t pin_init = {.mode = GPIO_MODE_OUTPUT, + .pin_bit_mask = (1ULL << PIN_SEG_A) | (1ULL << PIN_SEG_B) + | (1ULL << PIN_SEG_C) | (1ULL << PIN_SEG_D) + | (1ULL << PIN_SEG_E) | (1ULL << PIN_SEG_F) + | (1ULL << PIN_SEG_1) | (1ULL << PIN_SEG_2) + | (1ULL << PIN_SEG_3), + .pull_down_en = 0, + .pull_up_en = 0, + .intr_type = GPIO_INTR_DISABLE}; static void init_led() { - init_pin(SEG_A); - init_pin(SEG_B); - init_pin(SEG_C); - init_pin(SEG_D); - init_pin(SEG_E); - init_pin(SEG_F); - init_pin(SEG_G); - init_pin(SEG_DP); - init_pin(SEG_1); - init_pin(SEG_2); - init_pin(SEG_3); - init_pin(SEG_4); - - // set default state to 0 - - set_zero(); - gpio_set_level(SEG_1, 1); - gpio_set_level(SEG_2, 1); - gpio_set_level(SEG_3, 1); + gpio_config(&pin_init); + set_pins(0x3F); + gpio_set_level(PIN_SEG_1, 1); + gpio_set_level(PIN_SEG_2, 1); + gpio_set_level(PIN_SEG_3, 1); } -static void set_one() +static void set_pins(char bitfield) { - for (int i = 0; i < 6; i++) { - gpio_set_level(zero[i], 1); - } - for (int i = 0; i < 2; i++) { - gpio_set_level(one[i], 0); - } - gpio_set_level(SEG_G, 1); -} - -static void set_zero() -{ - for (int i = 0; i < 6; i++) { - gpio_set_level(zero[i], 0); // active low - } - gpio_set_level(SEG_G, 1); + gpio_set_level(PIN_SEG_A, !((bitfield >> 0) & 1)); + gpio_set_level(PIN_SEG_B, !((bitfield >> 1) & 1)); + gpio_set_level(PIN_SEG_C, !((bitfield >> 2) & 1)); + gpio_set_level(PIN_SEG_D, !((bitfield >> 3) & 1)); + gpio_set_level(PIN_SEG_E, !((bitfield >> 4) & 1)); + gpio_set_level(PIN_SEG_F, !((bitfield >> 5) & 1)); } -static void bts_authorization() +static void display_authorization() { - if (current_state == bbc_state) { + if (CURRENT_STATE == BBC_STATE) { if (bbc_authorized) { // if bbc is authorized, show 0 - set_zero(); + set_pins(ZERO); } else { // if not authorized, show 1 - set_one(); + set_pins(ONE); } - gpio_set_level(SEG_1, 1); - gpio_set_level(SEG_2, 0); - gpio_set_level(SEG_3, 0); - } else if (current_state == throttle_state) { + gpio_set_level(PIN_SEG_1, 1); + gpio_set_level(PIN_SEG_2, 0); + gpio_set_level(PIN_SEG_3, 0); + } else if (CURRENT_STATE == THROTTLE_STATE) { if (throttle_authorized) { - set_zero(); + set_pins(ZERO); } else { - set_one(); + set_pins(ONE); } - gpio_set_level(SEG_1, 0); - gpio_set_level(SEG_2, 1); - gpio_set_level(SEG_3, 0); - } else if (current_state == steer_state) { + gpio_set_level(PIN_SEG_1, 0); + gpio_set_level(PIN_SEG_2, 1); + gpio_set_level(PIN_SEG_3, 0); + } else if (CURRENT_STATE == STEER_STATE) { if (steer_authorized) { - set_zero(); + set_pins(ZERO); } else { - set_one(); + set_pins(ONE); } - gpio_set_level(SEG_1, 0); - gpio_set_level(SEG_2, 0); - gpio_set_level(SEG_3, 1); + gpio_set_level(PIN_SEG_1, 0); + gpio_set_level(PIN_SEG_2, 0); + gpio_set_level(PIN_SEG_3, 1); } - current_state = (current_state + 1) % 3; + CURRENT_STATE = (CURRENT_STATE + 1) % STATES_TOTAL; } ember_rate_funcs_S module_rf = { .call_init = init_led, - .call_1kHz = bts_authorization, + .call_1kHz = display_authorization, .call_100Hz = sup_100Hz, }; From cda05e7f93677c2359b4a2d5a369b22ca84f6232 Mon Sep 17 00:00:00 2001 From: Julie Hum Date: Fri, 25 Apr 2025 15:28:01 -0400 Subject: [PATCH 37/37] fix .envrc --- .envrc | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.envrc b/.envrc index be6a14ded..25cab32ec 100644 --- a/.envrc +++ b/.envrc @@ -11,16 +11,6 @@ eval $(./site_scons/env.py --export) export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" -export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" - -export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" - -export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" - -export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" - -export SCONSFLAGS="${SCONSFLAGS:-} --directory=$(expand_path .)" - COLOR_MAGENTA="\033[1;35m"