From 42b28396be1e24fc5118ca481d867e48e809bb0e Mon Sep 17 00:00:00 2001
From: Serge Bazanski <q3k@q3k.org>
Date: Sun, 13 Aug 2023 02:30:53 +0200
Subject: [PATCH] *: rename HW P6 to C23

Prototype 6 turned out to be the production board.

Also, retire p3/p4 builds.
---
 .gitlab-ci.yml                               | 24 +++-----------------
 components/flow3r_bsp/Kconfig                | 10 ++++----
 components/flow3r_bsp/flow3r_bsp_captouch.c  |  2 +-
 components/flow3r_bsp/flow3r_bsp_hwconfig.c  |  4 ++--
 components/flow3r_bsp/flow3r_bsp_i2c.c       |  2 +-
 components/flow3r_bsp/flow3r_bsp_spio.c      |  2 +-
 components/micropython/usermodule/mp_audio.c |  2 +-
 idf_ext.py                                   |  6 ++---
 recovery/sdkconfig.defaults                  |  2 +-
 9 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 14c00c4438..e68a3d51bd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -43,30 +43,12 @@ format:
     - "bash tools/format.sh"
     - "[ -z \"$(git status --porcelain)\" ] || (echo 'Differences found, please run tools/format.sh.' && git diff HEAD && exit 1)"
 
-build-p3:
+build:
   stage: build
   script:
-    - idf.py -g p3 build
+    - idf.py -g c23 build
   artifacts:
-    expose_as: 'Proto 3 ELF'
-    paths: ['build/flow3r.elf']
-    expire_in: 5 hours
-
-build-p4:
-  stage: build
-  script:
-    - idf.py -g p4 build
-  artifacts:
-    expose_as: 'Proto 4 ELF'
-    paths: ['build/flow3r.elf']
-    expire_in: 5 hours
-
-build-p6:
-  stage: build
-  script:
-    - idf.py -g p6 build
-  artifacts:
-    expose_as: 'Proto 6 ELF'
+    expose_as: 'C23 ELF'
     paths: ['build/flow3r.elf']
     expire_in: 5 hours
 
diff --git a/components/flow3r_bsp/Kconfig b/components/flow3r_bsp/Kconfig
index 8d1c4a2aa3..4657d24741 100644
--- a/components/flow3r_bsp/Kconfig
+++ b/components/flow3r_bsp/Kconfig
@@ -1,7 +1,7 @@
 menu "Flow3r Config"
     choice FLOW3R_HW_GEN
         prompt "Badge23 Hardware Generation"
-        default FLOW3R_HW_GEN_P4
+        default FLOW3R_HW_GEN_C23
         config FLOW3R_HW_GEN_P3
             help
                 Prototype version 3, a.k.a. proto3
@@ -16,12 +16,12 @@ menu "Flow3r Config"
                   - Sticker with B4xx (xx being arbitrary digits) on the back
             select FLOW3R_ESP32S3
             bool "Prototype 4"
-        config FLOW3R_HW_GEN_P6
+        config FLOW3R_HW_GEN_C23
             help
-                Prototype version 6, a.k.a. proto6
-                  - Sticker with B6xx (xx being arbitrary digits) on the back
+                As seen on CCCamp 2023.
+                Previously known as prototype version 6, a.k.a. proto6.
             select FLOW3R_ESP32S3
-            bool "Prototype 6"
+            bool "CCCamp 2023"
     endchoice
 
     config FLOW3R_ESP32S3
diff --git a/components/flow3r_bsp/flow3r_bsp_captouch.c b/components/flow3r_bsp/flow3r_bsp_captouch.c
index 02903671b5..8c5a3e711f 100644
--- a/components/flow3r_bsp/flow3r_bsp_captouch.c
+++ b/components/flow3r_bsp/flow3r_bsp_captouch.c
@@ -55,7 +55,7 @@ static const pad_mapping_t _map_bot[13] = {
 static gpio_num_t _interrupt_gpio_top = GPIO_NUM_15;
 static gpio_num_t _interrupt_gpio_bot = GPIO_NUM_15;
 static bool _interrupt_shared = true;
-#elif defined(CONFIG_FLOW3R_HW_GEN_P4) || defined(CONFIG_FLOW3R_HW_GEN_P6)
+#elif defined(CONFIG_FLOW3R_HW_GEN_P4) || defined(CONFIG_FLOW3R_HW_GEN_C23)
 static const pad_mapping_t _map_top[12] = {
     { 0, petal_pad_ccw },   // 0
     { 0, petal_pad_base },  // 1
diff --git a/components/flow3r_bsp/flow3r_bsp_hwconfig.c b/components/flow3r_bsp/flow3r_bsp_hwconfig.c
index 3f5e24094b..7edd3c6c62 100644
--- a/components/flow3r_bsp/flow3r_bsp_hwconfig.c
+++ b/components/flow3r_bsp/flow3r_bsp_hwconfig.c
@@ -4,8 +4,8 @@
 const char *flow3r_bsp_hw_name = "proto3";
 #elif defined(CONFIG_FLOW3R_HW_GEN_P4)
 const char *flow3r_bsp_hw_name = "proto4";
-#elif defined(CONFIG_FLOW3R_HW_GEN_P6)
-const char *flow3r_bsp_hw_name = "proto6";
+#elif defined(CONFIG_FLOW3R_HW_GEN_C23)
+const char *flow3r_bsp_hw_name = "camp23";
 #else
 #error "Badge23 Hardware Generation must be set!"
 #endif
diff --git a/components/flow3r_bsp/flow3r_bsp_i2c.c b/components/flow3r_bsp/flow3r_bsp_i2c.c
index c282838bd7..350d725d70 100644
--- a/components/flow3r_bsp/flow3r_bsp_i2c.c
+++ b/components/flow3r_bsp/flow3r_bsp_i2c.c
@@ -25,7 +25,7 @@ const flow3r_i2c_addressdef flow3r_i2c_addresses = {
     .touch_bottom = 0x2d,
     .portexp = { 0x6e, 0x6d },
 };
-#elif defined(CONFIG_FLOW3R_HW_GEN_P6)
+#elif defined(CONFIG_FLOW3R_HW_GEN_C23)
 const flow3r_i2c_addressdef flow3r_i2c_addresses = {
     .codec = 0x10,
     .touch_top = 0x2c,
diff --git a/components/flow3r_bsp/flow3r_bsp_spio.c b/components/flow3r_bsp/flow3r_bsp_spio.c
index f9cb5f5db5..553a81eee9 100644
--- a/components/flow3r_bsp/flow3r_bsp_spio.c
+++ b/components/flow3r_bsp/flow3r_bsp_spio.c
@@ -96,7 +96,7 @@ const flow3r_bsp_spio_programmable_pins_t flow3r_bsp_spio_programmable_pins = {
     .badgelink_right_ring = 5,
 };
 #define PORTEXP_MAX7321S
-#elif defined(CONFIG_FLOW3R_HW_GEN_P6)
+#elif defined(CONFIG_FLOW3R_HW_GEN_C23)
 static const flow3r_bsp_iodef_t iodef = {
     .tripos_left =
         {
diff --git a/components/micropython/usermodule/mp_audio.c b/components/micropython/usermodule/mp_audio.c
index 6f15f2aa2a..48a3d2f7a4 100644
--- a/components/micropython/usermodule/mp_audio.c
+++ b/components/micropython/usermodule/mp_audio.c
@@ -271,7 +271,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_input_thru_get_mute_obj,
 
 STATIC mp_obj_t mp_codec_i2c_write(mp_obj_t reg_in, mp_obj_t data_in) {
 #if defined(CONFIG_FLOW3R_HW_GEN_P3) || defined(CONFIG_FLOW3R_HW_GEN_P4) || \
-    defined(CONFIG_FLOW3R_HW_GEN_P6)
+    defined(CONFIG_FLOW3R_HW_GEN_C23)
     uint8_t reg = mp_obj_get_int(reg_in);
     uint8_t data = mp_obj_get_int(data_in);
     flow3r_bsp_audio_register_poke(reg, data);
diff --git a/idf_ext.py b/idf_ext.py
index abe1aebf7f..12bd646bb6 100644
--- a/idf_ext.py
+++ b/idf_ext.py
@@ -16,7 +16,7 @@ def action_extensions(base_actions, project_path=os.getcwd()):
     GENERATIONS = {
         'p3': ['proto3'],
         'p4': ['proto4'],
-        'p6': ['proto6'],
+        'c23': ['proto6', 'camp23', 'cccamp23', 'cccamp2023', 'camp2023'],
     }
 
     def generation_callback(ctx, global_args, tasks):
@@ -26,7 +26,7 @@ def action_extensions(base_actions, project_path=os.getcwd()):
         """
         generation = global_args.generation
         if generation is None:
-            generation = os.environ.get('BADGE_GENERATION', 'proto6')
+            generation = os.environ.get('BADGE_GENERATION', 'camp23')
 
         name = None
         if generation in GENERATIONS:
@@ -62,7 +62,7 @@ def action_extensions(base_actions, project_path=os.getcwd()):
     extensions = {
         'global_options': [{
             'names': ['-g', '--generation'],
-            'help': 'Specify badge generation to build for (one of: proto1, proto3, proto4, proto6, proto6-spiral). Defaults to proto4.',
+            'help': 'Specify badge generation to build for (one of: proto1, proto3, proto4, camp23). Defaults to proto4.',
             'scope': 'shared',
             'multiple': False,
         }],
diff --git a/recovery/sdkconfig.defaults b/recovery/sdkconfig.defaults
index 836679a291..bad48d1e44 100644
--- a/recovery/sdkconfig.defaults
+++ b/recovery/sdkconfig.defaults
@@ -24,5 +24,5 @@ CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
 CONFIG_FATFS_LFN_HEAP=y
 CONFIG_FATFS_API_ENCODING_UTF_8=y
 CONFIG_LOG_DEFAULT_LEVEL_INFO=y
-CONFIG_FLOW3R_HW_GEN_P6=y
+CONFIG_FLOW3R_HW_GEN_C23=y
 CONFIG_FLOW3R_CTX_FLAVOUR_SMOL=y
-- 
GitLab