From ee83ffcae08c3a777d1c0dd2d222ed17768e0360 Mon Sep 17 00:00:00 2001
From: Serge Bazanski <q3k@q3k.org>
Date: Thu, 20 Jul 2023 13:42:28 +0200
Subject: [PATCH] *: kill p6 spike/spirals difference

We're going with spirals for the production model, and the code fork
doesn't make much sense anyway, as it all ended up being the same (so
far). Whenever the behaviour between spiral/spikes changes, we should
just drop support for spikes.
---
 components/badge23/captouch.c | 22 ----------------------
 components/flow3r_bsp/Kconfig | 13 -------------
 idf_ext.py                    |  7 +------
 3 files changed, 1 insertion(+), 41 deletions(-)

diff --git a/components/badge23/captouch.c b/components/badge23/captouch.c
index 9f5077bb79..d90536ac13 100644
--- a/components/badge23/captouch.c
+++ b/components/badge23/captouch.c
@@ -272,7 +272,6 @@ static void captouch_init_petals(){
 int32_t captouch_get_petal_rad(uint8_t petal){
     if(petal > 9) petal = 9;
     uint8_t cf = petals[petal].config_mask;
-    #if defined(CONFIG_FLOW3R_TOP_BOARD_SPIKES)
     if(cf == 0b1110){ //CCW, CW, BASE
         int32_t left = petals[petal].pads[PETAL_PAD_CCW].cdc;
         left -= petals[petal].pads[PETAL_PAD_CCW].amb;
@@ -282,17 +281,6 @@ int32_t captouch_get_petal_rad(uint8_t petal){
         base -= petals[petal].pads[PETAL_PAD_BASE].amb;
         return (left + right)/2 - base;
     }
-    #elif defined(CONFIG_FLOW3R_TOP_BOARD_SPIRALS)
-    if(cf == 0b1110){ //CCW, CW, BASE
-        int32_t left = petals[petal].pads[PETAL_PAD_CCW].cdc;
-        left -= petals[petal].pads[PETAL_PAD_CCW].amb;
-        int32_t right = petals[petal].pads[PETAL_PAD_CW].cdc;
-        right -= petals[petal].pads[PETAL_PAD_CW].amb;
-        int32_t base = petals[petal].pads[PETAL_PAD_BASE].cdc;
-        base -= petals[petal].pads[PETAL_PAD_BASE].amb;
-        return (left + right)/2 - base;
-    }
-    #endif
     if(cf == 0b111){ //CCW, CW, TIP
         int32_t left = petals[petal].pads[PETAL_PAD_CCW].cdc;
         left -= petals[petal].pads[PETAL_PAD_CCW].amb;
@@ -320,15 +308,6 @@ int32_t captouch_get_petal_rad(uint8_t petal){
 int32_t captouch_get_petal_phi(uint8_t petal){
     if(petal > 9) petal = 9;
     uint8_t cf = petals[petal].config_mask;
-    #if defined(CONFIG_FLOW3R_TOP_BOARD_SPIKES)
-    if((cf == 0b1110) || (cf == 0b110) || (cf == 0b111)){ //CCW, CW, (BASE)
-        int32_t left = petals[petal].pads[PETAL_PAD_CCW].cdc;
-        left -= petals[petal].pads[PETAL_PAD_CCW].amb;
-        int32_t right = petals[petal].pads[PETAL_PAD_CW].cdc;
-        right -= petals[petal].pads[PETAL_PAD_CW].amb;
-        return left - right;
-    }
-    #elif defined(CONFIG_FLOW3R_TOP_BOARD_SPIRALS)
     if((cf == 0b1110) || (cf == 0b110) || (cf == 0b111)){ //CCW, CW, (BASE)
         int32_t left = petals[petal].pads[PETAL_PAD_CCW].cdc;
         left -= petals[petal].pads[PETAL_PAD_CCW].amb;
@@ -336,7 +315,6 @@ int32_t captouch_get_petal_phi(uint8_t petal){
         right -= petals[petal].pads[PETAL_PAD_CW].amb;
         return left - right;
     }
-    #endif
     return 0;
 }
 
diff --git a/components/flow3r_bsp/Kconfig b/components/flow3r_bsp/Kconfig
index b757d787da..8d1c4a2aa3 100644
--- a/components/flow3r_bsp/Kconfig
+++ b/components/flow3r_bsp/Kconfig
@@ -24,19 +24,6 @@ menu "Flow3r Config"
             bool "Prototype 6"
     endchoice
 
-    choice FLOW3R_TOP_BOARD_STYLE
-        prompt "Badge23 top board style (mainly for proto6)"
-        default FLOW3R_TOP_BOARD_SPIRALS
-        config FLOW3R_TOP_BOARD_SPIKES
-            help
-                Spikes between captouch pads
-            bool "Spikes"
-        config FLOW3R_TOP_BOARD_SPIRALS
-            help
-                Spirals between captouch pads
-            bool "Spirals"
-    endchoice
-
     config FLOW3R_ESP32S3
         bool
 
diff --git a/idf_ext.py b/idf_ext.py
index 7db2dd20c2..86853883e8 100644
--- a/idf_ext.py
+++ b/idf_ext.py
@@ -17,7 +17,6 @@ def action_extensions(base_actions, project_path=os.getcwd()):
         'p3': ['proto3'],
         'p4': ['proto4'],
         'p6': ['proto6'],
-        'p6spike': ['proto6-spike'],
     }
 
     def generation_callback(ctx, global_args, tasks):
@@ -51,11 +50,7 @@ def action_extensions(base_actions, project_path=os.getcwd()):
         sdkconfig_defaults_path = os.path.join(project_path, 'sdkconfig.defaults')
         sdkconfig_generated_path = os.path.join(project_path, '.sdkconfig.defaults.generated')
         with open(sdkconfig_generated_path, 'w') as f:
-            if name == 'p6spike':
-                f.write('CONFIG_FLOW3R_HW_GEN_P6=y\n')
-                f.write('CONFIG_FLOW3R_TOP_BOARD_SPIKES=y\n')
-            else:
-                f.write(f'CONFIG_FLOW3R_HW_GEN_{name.upper()}=y\n')
+            f.write(f'CONFIG_FLOW3R_HW_GEN_{name.upper()}=y\n')
             with open(sdkconfig_defaults_path) as f2:
                 f.write(f2.read())
 
-- 
GitLab