fix(sr): Update ESP_SR to the latest features (#12376)

* fix(sr): Update ESP_SR to the latest features

* fix(example): Define light pin if LED_BUILTIN is undefined

* fix(build): Rework variable used only in debug

* fix(sr): Apply suggestions

* ci(pre-commit): Apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
Me No Dev
2026-02-27 01:17:25 +02:00
committed by GitHub
parent 14381e214f
commit 233768369e
6 changed files with 222 additions and 275 deletions

View File

@@ -513,9 +513,9 @@ esp32p4.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592
esp32p4.menu.PartitionScheme.app13M_data7M_32MB=32M Flash (13MB APP/6.75MB SPIFFS)
esp32p4.menu.PartitionScheme.app13M_data7M_32MB.build.partitions=default_32MB
esp32p4.menu.PartitionScheme.app13M_data7M_32MB.upload.maximum_size=13107200
esp32p4.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
esp32p4.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
esp32p4.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
esp32p4.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
esp32p4.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
esp32p4.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
esp32p4.menu.PartitionScheme.custom=Custom
esp32p4.menu.PartitionScheme.custom.build.partitions=
@@ -1344,9 +1344,9 @@ esp32s3.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592
esp32s3.menu.PartitionScheme.app13M_data7M_32MB=32M Flash (13MB APP/6.75MB SPIFFS)
esp32s3.menu.PartitionScheme.app13M_data7M_32MB.build.partitions=default_32MB
esp32s3.menu.PartitionScheme.app13M_data7M_32MB.upload.maximum_size=13107200
esp32s3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
esp32s3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
esp32s3.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
esp32s3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
esp32s3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
esp32s3.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
esp32s3.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs
esp32s3.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr
@@ -2670,9 +2670,9 @@ esp32s3box.menu.PartitionScheme.rainmaker.upload.maximum_size=1966080
esp32s3box.menu.PartitionScheme.rainmaker_4MB=RainMaker 4MB No OTA
esp32s3box.menu.PartitionScheme.rainmaker_4MB.build.partitions=rainmaker_4MB_no_ota
esp32s3box.menu.PartitionScheme.rainmaker_4MB.upload.maximum_size=4038656
esp32s3box.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
esp32s3box.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
esp32s3box.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
esp32s3box.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
esp32s3box.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
esp32s3box.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
esp32s3box.menu.PartitionScheme.custom=Custom
esp32s3box.menu.PartitionScheme.custom.build.partitions=
@@ -3301,9 +3301,9 @@ esp32p4_core_board.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
esp32p4_core_board.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS)
esp32p4_core_board.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
esp32p4_core_board.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
esp32p4_core_board.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
esp32p4_core_board.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
esp32p4_core_board.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
esp32p4_core_board.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
esp32p4_core_board.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
esp32p4_core_board.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
esp32p4_core_board.menu.PartitionScheme.custom=Custom
esp32p4_core_board.menu.PartitionScheme.custom.build.partitions=
@@ -6872,9 +6872,9 @@ twatchs3.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
twatchs3.menu.PartitionScheme.rainmaker=RainMaker
twatchs3.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
twatchs3.menu.PartitionScheme.rainmaker.upload.maximum_size=1966080
twatchs3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
twatchs3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
twatchs3.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
twatchs3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
twatchs3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
twatchs3.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
twatchs3.menu.PartitionScheme.custom=Custom
twatchs3.menu.PartitionScheme.custom.build.partitions=
@@ -7037,9 +7037,9 @@ twatch_ultra.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
twatch_ultra.menu.PartitionScheme.rainmaker=RainMaker
twatch_ultra.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
twatch_ultra.menu.PartitionScheme.rainmaker.upload.maximum_size=1966080
twatch_ultra.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
twatch_ultra.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
twatch_ultra.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
twatch_ultra.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
twatch_ultra.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
twatch_ultra.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
twatch_ultra.menu.PartitionScheme.custom=Custom
twatch_ultra.menu.PartitionScheme.custom.build.partitions=
@@ -7201,9 +7201,9 @@ tlora_pager.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
tlora_pager.menu.PartitionScheme.rainmaker=RainMaker
tlora_pager.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
tlora_pager.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728
tlora_pager.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
tlora_pager.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
tlora_pager.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
tlora_pager.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
tlora_pager.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
tlora_pager.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
tlora_pager.menu.PartitionScheme.custom=Custom
tlora_pager.menu.PartitionScheme.custom.build.partitions=
@@ -13463,9 +13463,9 @@ dfrobot_firebeetle2_esp32p4.menu.PartitionScheme.fatflash.upload.maximum_size=20
dfrobot_firebeetle2_esp32p4.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS)
dfrobot_firebeetle2_esp32p4.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
dfrobot_firebeetle2_esp32p4.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
dfrobot_firebeetle2_esp32p4.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
dfrobot_firebeetle2_esp32p4.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
dfrobot_firebeetle2_esp32p4.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
dfrobot_firebeetle2_esp32p4.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
dfrobot_firebeetle2_esp32p4.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
dfrobot_firebeetle2_esp32p4.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
dfrobot_firebeetle2_esp32p4.menu.PartitionScheme.custom=Custom
dfrobot_firebeetle2_esp32p4.menu.PartitionScheme.custom.build.partitions=
@@ -19049,9 +19049,9 @@ nologo_esp32s3_pico.menu.PartitionScheme.rainmaker_4MB.upload.maximum_size=40386
nologo_esp32s3_pico.menu.PartitionScheme.rainmaker_8MB=RainMaker 8MB
nologo_esp32s3_pico.menu.PartitionScheme.rainmaker_8MB.build.partitions=rainmaker_8MB
nologo_esp32s3_pico.menu.PartitionScheme.rainmaker_8MB.upload.maximum_size=4096000
nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
nologo_esp32s3_pico.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs
nologo_esp32s3_pico.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr
@@ -20639,9 +20639,9 @@ esp32s3-devkitlipo.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=47
esp32s3-devkitlipo.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS)
esp32s3-devkitlipo.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB
esp32s3-devkitlipo.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592
esp32s3-devkitlipo.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
esp32s3-devkitlipo.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
esp32s3-devkitlipo.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
esp32s3-devkitlipo.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
esp32s3-devkitlipo.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
esp32s3-devkitlipo.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
esp32s3-devkitlipo.menu.PartitionScheme.custom=Custom
esp32s3-devkitlipo.menu.PartitionScheme.custom.build.partitions=
@@ -23344,9 +23344,9 @@ m5stack_cores3.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=471859
m5stack_cores3.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS)
m5stack_cores3.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB
m5stack_cores3.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592
m5stack_cores3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
m5stack_cores3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
m5stack_cores3.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
m5stack_cores3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
m5stack_cores3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
m5stack_cores3.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
m5stack_cores3.menu.PartitionScheme.custom=Custom
m5stack_cores3.menu.PartitionScheme.custom.build.partitions=
@@ -24069,9 +24069,9 @@ m5stack_unit_cams3.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=47
m5stack_unit_cams3.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS)
m5stack_unit_cams3.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB
m5stack_unit_cams3.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592
m5stack_unit_cams3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
m5stack_unit_cams3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
m5stack_unit_cams3.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
m5stack_unit_cams3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
m5stack_unit_cams3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
m5stack_unit_cams3.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
m5stack_unit_cams3.menu.PartitionScheme.custom=Custom
m5stack_unit_cams3.menu.PartitionScheme.custom.build.partitions=
@@ -25069,9 +25069,9 @@ m5stack_stamp_s3.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=4718
m5stack_stamp_s3.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS)
m5stack_stamp_s3.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB
m5stack_stamp_s3.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592
m5stack_stamp_s3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
m5stack_stamp_s3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
m5stack_stamp_s3.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
m5stack_stamp_s3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
m5stack_stamp_s3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
m5stack_stamp_s3.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
m5stack_stamp_s3.menu.PartitionScheme.custom=Custom
m5stack_stamp_s3.menu.PartitionScheme.custom.build.partitions=
@@ -25306,9 +25306,9 @@ m5stack_capsule.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=47185
m5stack_capsule.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS)
m5stack_capsule.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB
m5stack_capsule.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592
m5stack_capsule.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
m5stack_capsule.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
m5stack_capsule.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
m5stack_capsule.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
m5stack_capsule.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
m5stack_capsule.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
m5stack_capsule.menu.PartitionScheme.custom=Custom
m5stack_capsule.menu.PartitionScheme.custom.build.partitions=
@@ -25546,9 +25546,9 @@ m5stack_cardputer.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=471
m5stack_cardputer.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS)
m5stack_cardputer.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB
m5stack_cardputer.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592
m5stack_cardputer.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
m5stack_cardputer.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
m5stack_cardputer.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
m5stack_cardputer.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
m5stack_cardputer.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
m5stack_cardputer.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
m5stack_cardputer.menu.PartitionScheme.custom=Custom
m5stack_cardputer.menu.PartitionScheme.custom.build.partitions=
@@ -25783,9 +25783,9 @@ m5stack_dial.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=4718592
m5stack_dial.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS)
m5stack_dial.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB
m5stack_dial.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592
m5stack_dial.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
m5stack_dial.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
m5stack_dial.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
m5stack_dial.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
m5stack_dial.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
m5stack_dial.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
m5stack_dial.menu.PartitionScheme.custom=Custom
m5stack_dial.menu.PartitionScheme.custom.build.partitions=
@@ -26020,9 +26020,9 @@ m5stack_dinmeter.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=4718
m5stack_dinmeter.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS)
m5stack_dinmeter.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB
m5stack_dinmeter.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592
m5stack_dinmeter.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
m5stack_dinmeter.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
m5stack_dinmeter.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
m5stack_dinmeter.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
m5stack_dinmeter.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
m5stack_dinmeter.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
m5stack_dinmeter.menu.PartitionScheme.custom=Custom
m5stack_dinmeter.menu.PartitionScheme.custom.build.partitions=
@@ -47999,9 +47999,9 @@ waveshare_esp32_s3_touch_lcd_185.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB)
waveshare_esp32_s3_touch_lcd_185.menu.UploadMode.cdc.upload.use_1200bps_touch=true
waveshare_esp32_s3_touch_lcd_185.menu.UploadMode.cdc.upload.wait_for_upload_port=true
waveshare_esp32_s3_touch_lcd_185.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
waveshare_esp32_s3_touch_lcd_185.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
waveshare_esp32_s3_touch_lcd_185.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
waveshare_esp32_s3_touch_lcd_185.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
waveshare_esp32_s3_touch_lcd_185.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
waveshare_esp32_s3_touch_lcd_185.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
waveshare_esp32_s3_touch_lcd_185.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS)
waveshare_esp32_s3_touch_lcd_185.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
@@ -48576,9 +48576,9 @@ waveshare_esp32_s3_lcd_185.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB)
waveshare_esp32_s3_lcd_185.menu.UploadMode.cdc.upload.use_1200bps_touch=true
waveshare_esp32_s3_lcd_185.menu.UploadMode.cdc.upload.wait_for_upload_port=true
waveshare_esp32_s3_lcd_185.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
waveshare_esp32_s3_lcd_185.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
waveshare_esp32_s3_lcd_185.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
waveshare_esp32_s3_lcd_185.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
waveshare_esp32_s3_lcd_185.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
waveshare_esp32_s3_lcd_185.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
waveshare_esp32_s3_lcd_185.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS)
waveshare_esp32_s3_lcd_185.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
@@ -48813,9 +48813,9 @@ waveshare_esp32_s3_touch_lcd_146.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB)
waveshare_esp32_s3_touch_lcd_146.menu.UploadMode.cdc.upload.use_1200bps_touch=true
waveshare_esp32_s3_touch_lcd_146.menu.UploadMode.cdc.upload.wait_for_upload_port=true
waveshare_esp32_s3_touch_lcd_146.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
waveshare_esp32_s3_touch_lcd_146.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
waveshare_esp32_s3_touch_lcd_146.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
waveshare_esp32_s3_touch_lcd_146.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
waveshare_esp32_s3_touch_lcd_146.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
waveshare_esp32_s3_touch_lcd_146.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
waveshare_esp32_s3_touch_lcd_146.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS)
waveshare_esp32_s3_touch_lcd_146.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
@@ -49050,9 +49050,9 @@ waveshare_esp32_s3_lcd_146.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB)
waveshare_esp32_s3_lcd_146.menu.UploadMode.cdc.upload.use_1200bps_touch=true
waveshare_esp32_s3_lcd_146.menu.UploadMode.cdc.upload.wait_for_upload_port=true
waveshare_esp32_s3_lcd_146.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
waveshare_esp32_s3_lcd_146.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
waveshare_esp32_s3_lcd_146.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
waveshare_esp32_s3_lcd_146.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
waveshare_esp32_s3_lcd_146.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
waveshare_esp32_s3_lcd_146.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
waveshare_esp32_s3_lcd_146.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS)
waveshare_esp32_s3_lcd_146.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
@@ -49287,9 +49287,9 @@ waveshare_esp32_s3_touch_lcd_185_box.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB)
waveshare_esp32_s3_touch_lcd_185_box.menu.UploadMode.cdc.upload.use_1200bps_touch=true
waveshare_esp32_s3_touch_lcd_185_box.menu.UploadMode.cdc.upload.wait_for_upload_port=true
waveshare_esp32_s3_touch_lcd_185_box.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
waveshare_esp32_s3_touch_lcd_185_box.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
waveshare_esp32_s3_touch_lcd_185_box.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
waveshare_esp32_s3_touch_lcd_185_box.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
waveshare_esp32_s3_touch_lcd_185_box.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
waveshare_esp32_s3_touch_lcd_185_box.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
waveshare_esp32_s3_touch_lcd_185_box.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS)
waveshare_esp32_s3_touch_lcd_185_box.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
@@ -49569,9 +49569,9 @@ waveshare_esp32_s3_lcd_147.menu.PartitionScheme.noota_ffat.upload.maximum_size=2
waveshare_esp32_s3_lcd_147.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
waveshare_esp32_s3_lcd_147.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
waveshare_esp32_s3_lcd_147.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
waveshare_esp32_s3_lcd_147.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
waveshare_esp32_s3_lcd_147.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
waveshare_esp32_s3_lcd_147.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
waveshare_esp32_s3_lcd_147.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
waveshare_esp32_s3_lcd_147.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
waveshare_esp32_s3_lcd_147.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
waveshare_esp32_s3_lcd_147.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs
waveshare_esp32_s3_lcd_147.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr
@@ -49806,9 +49806,9 @@ waveshare_esp32_s3_touch_lcd_21.menu.PartitionScheme.noota_ffat.upload.maximum_s
waveshare_esp32_s3_touch_lcd_21.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
waveshare_esp32_s3_touch_lcd_21.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
waveshare_esp32_s3_touch_lcd_21.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
waveshare_esp32_s3_touch_lcd_21.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
waveshare_esp32_s3_touch_lcd_21.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
waveshare_esp32_s3_touch_lcd_21.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
waveshare_esp32_s3_touch_lcd_21.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
waveshare_esp32_s3_touch_lcd_21.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
waveshare_esp32_s3_touch_lcd_21.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
waveshare_esp32_s3_touch_lcd_21.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs
waveshare_esp32_s3_touch_lcd_21.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr
@@ -50043,9 +50043,9 @@ waveshare_esp32_s3_touch_lcd_28.menu.PartitionScheme.noota_ffat.upload.maximum_s
waveshare_esp32_s3_touch_lcd_28.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
waveshare_esp32_s3_touch_lcd_28.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
waveshare_esp32_s3_touch_lcd_28.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
waveshare_esp32_s3_touch_lcd_28.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
waveshare_esp32_s3_touch_lcd_28.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
waveshare_esp32_s3_touch_lcd_28.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
waveshare_esp32_s3_touch_lcd_28.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
waveshare_esp32_s3_touch_lcd_28.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
waveshare_esp32_s3_touch_lcd_28.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
waveshare_esp32_s3_touch_lcd_28.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs
waveshare_esp32_s3_touch_lcd_28.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr
@@ -50283,9 +50283,9 @@ waveshare_esp32_s3_relay_6ch.menu.PartitionScheme.noota_ffat.upload.maximum_size
waveshare_esp32_s3_relay_6ch.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
waveshare_esp32_s3_relay_6ch.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
waveshare_esp32_s3_relay_6ch.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
waveshare_esp32_s3_relay_6ch.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
waveshare_esp32_s3_relay_6ch.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
waveshare_esp32_s3_relay_6ch.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
waveshare_esp32_s3_relay_6ch.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
waveshare_esp32_s3_relay_6ch.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
waveshare_esp32_s3_relay_6ch.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
waveshare_esp32_s3_relay_6ch.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs
waveshare_esp32_s3_relay_6ch.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr
@@ -53111,9 +53111,9 @@ cyobot_v2_esp32s3.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=471
cyobot_v2_esp32s3.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS)
cyobot_v2_esp32s3.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB
cyobot_v2_esp32s3.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592
cyobot_v2_esp32s3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
cyobot_v2_esp32s3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
cyobot_v2_esp32s3.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
cyobot_v2_esp32s3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
cyobot_v2_esp32s3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
cyobot_v2_esp32s3.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
cyobot_v2_esp32s3.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs
cyobot_v2_esp32s3.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr
@@ -56490,9 +56490,9 @@ pandabyte_xs3.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718
pandabyte_xs3.menu.PartitionScheme.app13M_data7M_32MB=32M Flash (13MB APP/6.75MB SPIFFS)
pandabyte_xs3.menu.PartitionScheme.app13M_data7M_32MB.build.partitions=default_32MB
pandabyte_xs3.menu.PartitionScheme.app13M_data7M_32MB.upload.maximum_size=13107200
pandabyte_xs3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
pandabyte_xs3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
pandabyte_xs3.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
pandabyte_xs3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
pandabyte_xs3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
pandabyte_xs3.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
pandabyte_xs3.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs
pandabyte_xs3.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr
@@ -56717,9 +56717,9 @@ rootmaker.menu.PartitionScheme.rainmaker_4MB.upload.maximum_size=4038656
rootmaker.menu.PartitionScheme.rainmaker_8MB=RainMaker 8MB
rootmaker.menu.PartitionScheme.rainmaker_8MB.build.partitions=rainmaker_8MB
rootmaker.menu.PartitionScheme.rainmaker_8MB.upload.maximum_size=4096000
rootmaker.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL)
rootmaker.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/6MB SPIFFS/3.9MB MODEL)
rootmaker.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728
rootmaker.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin
rootmaker.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xC10000 {build.path}/srmodels.bin
rootmaker.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16
rootmaker.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs
rootmaker.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr

View File

@@ -2,47 +2,88 @@
#include "ESP_I2S.h"
#include "ESP_SR.h"
// Pins for I2S Microphone
#define I2S_PIN_BCK 17
#define I2S_PIN_WS 47
#define I2S_PIN_DIN 16
#define I2S_PIN_WS 15
#define LIGHT_PIN 40
#define FAN_PIN 41
// Pins for PDM Microphone
#define PDM_PIN_CLK 12
#define PDM_PIN_DATA 9
#ifndef LED_BUILTIN
#define LED_BUILTIN 3
#endif
#define LIGHT_PIN LED_BUILTIN
#define FAN_PIN 18
// ESP_SR requires 16bit audio with 16kHz sample rate
#define I2S_SAMPLE_RATE 16000
#define I2S_DATA_WIDTH I2S_DATA_BIT_WIDTH_16BIT
/**
* The input format:
* SR_INPUT_FORMAT:
* M to represent the microphone channel
* R to represent the playback reference channel
* N to represent an unknown or unused channel
*
* For example, input_format="MMNR" indicates that the input data consists of four channels,
* which are the microphone channel, the microphone channel, an unused channel, and the playback channel
* For example, SR_INPUT_FORMAT="MN" indicates that the input data consists of two channels,
* which are the microphone channel and an unused channel
*
* SR_INPUT_CHANNELS: Equal to how many channels is the input data.
* This should be less or equal to the SR_INPUT_FORMAT length. Best to be equal!
*
* I2S_OUTPUT_CHANNELS: Equal to how many channels is the I2S data.
* This should be equal to SR_INPUT_CHANNELS
*/
#define SR_INPUT_FORMAT "MM"
// Mono microphone on mono bus
#define SR_INPUT_FORMAT "M"
#define SR_INPUT_CHANNELS SR_CHANNELS_MONO
#define I2S_OUTPUT_CHANNELS I2S_SLOT_MODE_MONO
// Mono microphone (left) on stereo bus
// #define SR_INPUT_FORMAT "MN"
// #define SR_INPUT_CHANNELS SR_CHANNELS_STEREO
// #define I2S_OUTPUT_CHANNELS I2S_SLOT_MODE_STEREO
// Stereo microphones on stereo bus
// #define SR_INPUT_FORMAT "MM"
// #define SR_INPUT_CHANNELS SR_CHANNELS_STEREO
// #define I2S_OUTPUT_CHANNELS I2S_SLOT_MODE_STEREO
I2SClass i2s;
// Generated using the following command:
// python3 tools/gen_sr_commands.py "Turn on the light,Switch on the light;Turn off the light,Switch off the light,Go dark;Start fan;Stop fan"
// Command IDs
enum {
SR_CMD_TURN_ON_THE_LIGHT,
SR_CMD_TURN_OFF_THE_LIGHT,
SR_CMD_START_FAN,
SR_CMD_STOP_FAN,
SR_CMD_LIGHT_ON,
SR_CMD_LIGHT_OFF,
SR_CMD_FAN_ON,
SR_CMD_FAN_OFF,
};
// Command phrases. Can have multiple phrases for given command ID
static const sr_cmd_t sr_commands[] = {
{0, "Turn on the light", "TkN nN jc LiT"},
{0, "Switch on the light", "SWgp nN jc LiT"},
{1, "Turn off the light", "TkN eF jc LiT"},
{1, "Switch off the light", "SWgp eF jc LiT"},
{1, "Go dark", "Gb DnRK"},
{2, "Start fan", "STnRT FaN"},
{3, "Stop fan", "STnP FaN"},
{SR_CMD_LIGHT_ON, "Turn on the light"},
{SR_CMD_LIGHT_ON, "Switch on the light"},
{SR_CMD_LIGHT_ON, "Lights on"},
{SR_CMD_LIGHT_OFF, "Turn off the light"},
{SR_CMD_LIGHT_OFF, "Switch off the light"},
{SR_CMD_LIGHT_OFF, "Lights off"},
{SR_CMD_LIGHT_OFF, "Go dark"},
{SR_CMD_FAN_ON, "Start fan"},
{SR_CMD_FAN_ON, "Fan on"},
{SR_CMD_FAN_OFF, "Stop fan"},
{SR_CMD_FAN_OFF, "Fan off"},
};
void onSrEvent(sr_event_t event, int command_id, int phrase_id) {
switch (event) {
case SR_EVENT_WAKEWORD: Serial.println("WakeWord Detected!"); break;
case SR_EVENT_WAKEWORD:
Serial.println("WakeWord Detected!");
if (strlen(SR_INPUT_FORMAT) == 1) { // Mono recognition does not get CHANNEL event
ESP_SR.setMode(SR_MODE_COMMAND); // Switch to Command detection
}
break;
case SR_EVENT_WAKEWORD_CHANNEL:
Serial.printf("WakeWord Channel %d Verified!\n", command_id);
ESP_SR.setMode(SR_MODE_COMMAND); // Switch to Command detection
@@ -52,16 +93,28 @@ void onSrEvent(sr_event_t event, int command_id, int phrase_id) {
ESP_SR.setMode(SR_MODE_WAKEWORD); // Switch back to WakeWord detection
break;
case SR_EVENT_COMMAND:
Serial.printf("Command %d Detected! %s\n", command_id, sr_commands[phrase_id].str);
Serial.printf("Command ID %d Detected!\n", command_id);
switch (command_id) {
case SR_CMD_TURN_ON_THE_LIGHT: digitalWrite(LIGHT_PIN, HIGH); break;
case SR_CMD_TURN_OFF_THE_LIGHT: digitalWrite(LIGHT_PIN, LOW); break;
case SR_CMD_START_FAN: digitalWrite(FAN_PIN, HIGH); break;
case SR_CMD_STOP_FAN: digitalWrite(FAN_PIN, LOW); break;
default: Serial.println("Unknown Command!"); break;
case SR_CMD_LIGHT_ON:
Serial.println("Light On");
digitalWrite(LIGHT_PIN, HIGH);
break;
case SR_CMD_LIGHT_OFF:
Serial.println("Light Off");
digitalWrite(LIGHT_PIN, LOW);
break;
case SR_CMD_FAN_ON:
Serial.println("Fan On");
digitalWrite(FAN_PIN, HIGH);
break;
case SR_CMD_FAN_OFF:
Serial.println("Fan Off");
digitalWrite(FAN_PIN, LOW);
break;
default: Serial.printf("Unknown Command ID %d!\n", command_id); break;
}
ESP_SR.setMode(SR_MODE_COMMAND); // Allow for more commands to be given, before timeout
// ESP_SR.setMode(SR_MODE_WAKEWORD); // Switch back to WakeWord detection
//ESP_SR.setMode(SR_MODE_WAKEWORD); // Switch back to WakeWord detection
break;
default: Serial.println("Unknown Event!"); break;
}
@@ -75,12 +128,28 @@ void setup() {
pinMode(FAN_PIN, OUTPUT);
digitalWrite(FAN_PIN, LOW);
i2s.setPins(I2S_PIN_BCK, I2S_PIN_WS, -1, I2S_PIN_DIN);
i2s.setTimeout(1000);
i2s.begin(I2S_MODE_STD, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO);
// I2S Microphone
// i2s.setPins(I2S_PIN_BCK, I2S_PIN_WS, -1, I2S_PIN_DIN);
// i2s.begin(I2S_MODE_STD, I2S_SAMPLE_RATE, I2S_DATA_WIDTH, I2S_OUTPUT_CHANNELS, I2S_STD_SLOT_LEFT);
// SPH0645 I2S Microphone (requires data transform to 16bit)
// i2s.setPins(I2S_PIN_BCK, I2S_PIN_WS, -1, I2S_PIN_DIN);
// i2s.begin(I2S_MODE_STD, I2S_SAMPLE_RATE, I2S_DATA_BIT_WIDTH_32BIT, I2S_OUTPUT_CHANNELS, I2S_STD_SLOT_LEFT);
// i2s.configureRX(I2S_SAMPLE_RATE, I2S_DATA_BIT_WIDTH_32BIT, I2S_OUTPUT_CHANNELS, I2S_RX_TRANSFORM_32_TO_16);
// PDM Microphone
i2s.setPinsPdmRx(PDM_PIN_CLK, PDM_PIN_DATA);
i2s.begin(I2S_MODE_PDM_RX, I2S_SAMPLE_RATE, I2S_DATA_WIDTH, I2S_OUTPUT_CHANNELS, I2S_STD_SLOT_RIGHT);
ESP_SR.onEvent(onSrEvent);
ESP_SR.begin(i2s, sr_commands, sizeof(sr_commands) / sizeof(sr_cmd_t), SR_CHANNELS_STEREO, SR_MODE_WAKEWORD, SR_INPUT_FORMAT);
ESP_SR.begin(i2s, sr_commands, sizeof(sr_commands) / sizeof(sr_cmd_t), SR_INPUT_CHANNELS, SR_MODE_WAKEWORD, SR_INPUT_FORMAT);
}
void loop() {}
void loop() {
// uint8_t buf[64];
// i2s.readBytes((char *)buf, 64);
// log_buf_d((const uint8_t *)buf, 64);
delay(100);
}

View File

@@ -33,6 +33,7 @@
#include "esp_afe_sr_iface.h"
#include "esp_mn_iface.h"
#include "model_path.h"
#include "flite_g2p.h"
#include "driver/i2s_common.h"
#include "esp32-hal-sr.h"
@@ -91,8 +92,6 @@ typedef struct {
EventGroupHandle_t event_group;
} sr_data_t;
static int SR_CHANNEL_NUM = 3;
static srmodel_list_t *models = NULL;
static sr_data_t *g_sr_data = NULL;
@@ -119,6 +118,7 @@ void sr_handler_task(void *pvParam) {
continue;
}
#ifndef CONFIG_SR_MN_EN_NONE
if (ESP_MN_STATE_DETECTED == result.state) {
if (g_sr_data->user_cb) {
g_sr_data->user_cb(g_sr_data->user_cb_arg, SR_EVENT_COMMAND, result.command_id, result.phrase_id);
@@ -132,6 +132,7 @@ void sr_handler_task(void *pvParam) {
}
continue;
}
#endif
}
vTaskDelete(NULL);
}
@@ -139,10 +140,10 @@ void sr_handler_task(void *pvParam) {
static void audio_feed_task(void *arg) {
size_t bytes_read = 0;
int audio_chunksize = g_sr_data->afe_handle->get_feed_chunksize(g_sr_data->afe_data);
log_i("audio_chunksize=%d, feed_channel=%d", audio_chunksize, SR_CHANNEL_NUM);
int feed_channel = g_sr_data->afe_handle->get_feed_channel_num(g_sr_data->afe_data);
/* Allocate audio buffer and check for result */
int16_t *audio_buffer = heap_caps_malloc(audio_chunksize * sizeof(int16_t) * SR_CHANNEL_NUM, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
int16_t *audio_buffer = heap_caps_malloc(audio_chunksize * sizeof(int16_t) * feed_channel, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
if (NULL == audio_buffer) {
esp_system_abort("No mem for audio buffer");
}
@@ -173,21 +174,16 @@ static void audio_feed_task(void *arg) {
}
/* Channel Adjust */
if (g_sr_data->i2s_rx_chan_num == 1) {
if (g_sr_data->i2s_rx_chan_num < feed_channel) {
for (int i = audio_chunksize - 1; i >= 0; i--) {
audio_buffer[i * SR_CHANNEL_NUM + 2] = 0;
audio_buffer[i * SR_CHANNEL_NUM + 1] = 0;
audio_buffer[i * SR_CHANNEL_NUM + 0] = audio_buffer[i];
for (int f = feed_channel - 1; f >= 0; f--) {
if (f >= g_sr_data->i2s_rx_chan_num) {
audio_buffer[i * feed_channel + f] = 0;
} else {
audio_buffer[i * feed_channel + f] = audio_buffer[i * g_sr_data->i2s_rx_chan_num + f];
}
}
}
} else if (g_sr_data->i2s_rx_chan_num == 2) {
for (int i = audio_chunksize - 1; i >= 0; i--) {
audio_buffer[i * SR_CHANNEL_NUM + 2] = 0;
audio_buffer[i * SR_CHANNEL_NUM + 1] = audio_buffer[i * 2 + 1];
audio_buffer[i * SR_CHANNEL_NUM + 0] = audio_buffer[i * 2 + 0];
}
} else {
vTaskDelay(100);
continue;
}
/* Feed samples of an audio stream to the AFE_SR */
@@ -198,9 +194,11 @@ static void audio_feed_task(void *arg) {
}
static void audio_detect_task(void *arg) {
#ifndef CONFIG_SR_MN_EN_NONE
int afe_chunksize = g_sr_data->afe_handle->get_fetch_chunksize(g_sr_data->afe_data);
int mu_chunksize = g_sr_data->multinet->get_samp_chunksize(g_sr_data->model_data);
assert(mu_chunksize == afe_chunksize);
#endif
log_i("------------detect start------------");
while (true) {
@@ -215,6 +213,8 @@ static void audio_detect_task(void *arg) {
afe_fetch_result_t *res = g_sr_data->afe_handle->fetch(g_sr_data->afe_data);
if (!res || res->ret_value == ESP_FAIL) {
log_e("fetch failed");
vTaskDelay(100);
continue;
}
@@ -241,6 +241,7 @@ static void audio_detect_task(void *arg) {
}
}
#ifndef CONFIG_SR_MN_EN_NONE
if (g_sr_data->mode == SR_MODE_COMMAND) {
esp_mn_state_t mn_state = ESP_MN_STATE_DETECTING;
@@ -267,12 +268,12 @@ static void audio_detect_task(void *arg) {
sr_set_mode(SR_MODE_OFF);
esp_mn_results_t *mn_result = g_sr_data->multinet->get_results(g_sr_data->model_data);
for (int i = 0; i < mn_result->num; i++) {
log_d("TOP %d, command_id: %d, phrase_id: %d, prob: %f", i + 1, mn_result->command_id[i], mn_result->phrase_id[i], mn_result->prob[i]);
log_d("TOP %d, command_id: %d, phrase_id: %d, probability: %f", i + 1, mn_result->command_id[i], mn_result->phrase_id[i], mn_result->prob[i]);
}
int sr_command_id = mn_result->command_id[0];
int sr_phrase_id = mn_result->phrase_id[0];
log_d("Detected command : %d, phrase: %d", sr_command_id, sr_phrase_id);
log_d("Detected command_id : %d, phrase_id: %d, string: %s, raw_string: %s", sr_command_id, sr_phrase_id, mn_result->string, mn_result->raw_string);
sr_result_t result = {
.wakenet_mode = WAKENET_NO_DETECT,
.state = mn_state,
@@ -284,6 +285,7 @@ static void audio_detect_task(void *arg) {
}
log_e("Exception unhandled");
}
#endif
}
vTaskDelete(NULL);
}
@@ -301,11 +303,15 @@ esp_err_t sr_set_mode(sr_mode_t mode) {
g_sr_data->afe_handle->enable_wakenet(g_sr_data->afe_data);
}
break;
#ifndef CONFIG_SR_MN_EN_NONE
case SR_MODE_COMMAND:
if (g_sr_data->mode == SR_MODE_WAKEWORD) {
g_sr_data->afe_handle->disable_wakenet(g_sr_data->afe_data);
}
break;
#else
case SR_MODE_COMMAND: log_e("SR_MODE_COMMAND is not supported when CONFIG_SR_MN_EN_NONE is enabled"); return ESP_ERR_NOT_SUPPORTED;
#endif
default: return ESP_FAIL;
}
g_sr_data->mode = mode;
@@ -341,13 +347,16 @@ esp_err_t sr_start(
models = esp_srmodel_init("model");
// Load WakeWord Detection
log_d("init wakenet");
afe_config_t *afe_config = afe_config_init(input_format, models, AFE_TYPE_SR, AFE_MODE_LOW_COST);
g_sr_data->afe_handle = esp_afe_handle_from_config(afe_config);
log_d("load wakenet '%s'", afe_config->wakenet_model_name);
g_sr_data->afe_data = g_sr_data->afe_handle->create_from_config(afe_config);
afe_config_free(afe_config);
// Load Custom Command Detection
// Load Custom Command Detection
#ifndef CONFIG_SR_MN_EN_NONE
log_d("init multinet");
char *mn_name = esp_srmodel_filter(models, ESP_MN_PREFIX, ESP_MN_ENGLISH);
log_d("load multinet '%s'", mn_name);
g_sr_data->multinet = esp_mn_handle_from_name(mn_name);
@@ -358,7 +367,13 @@ esp_err_t sr_start(
esp_mn_commands_alloc((esp_mn_iface_t *)g_sr_data->multinet, (model_iface_data_t *)g_sr_data->model_data);
log_i("add %d commands", cmd_number);
for (size_t i = 0; i < cmd_number; i++) {
esp_mn_commands_add(sr_commands[i].command_id, (char *)(sr_commands[i].phoneme));
char *phonemes = flite_g2p(sr_commands[i].str, 1);
if (phonemes == NULL) {
log_e("failed to generate phonemes for cmd[%d] phrase[%d]:'%s'", sr_commands[i].command_id, i, sr_commands[i].str);
continue;
}
esp_mn_commands_phoneme_add(sr_commands[i].command_id, (const char *)(sr_commands[i].str), phonemes);
free(phonemes);
log_i(" cmd[%d] phrase[%d]:'%s'", sr_commands[i].command_id, i, sr_commands[i].str);
}
@@ -369,6 +384,14 @@ esp_err_t sr_start(
log_e("err cmd id:%d", err_id->phrases[i]->command_id);
}
}
#endif
int feed_channel = g_sr_data->afe_handle->get_feed_channel_num(g_sr_data->afe_data);
log_i(
"audio_chunksize=%d, feed_channel=%d, i2s_rx_chan_num=%d", g_sr_data->afe_handle->get_feed_chunksize(g_sr_data->afe_data), feed_channel,
g_sr_data->i2s_rx_chan_num
);
assert(feed_channel >= g_sr_data->i2s_rx_chan_num);
//Start tasks
log_d("start tasks");
@@ -378,7 +401,6 @@ esp_err_t sr_start(
ret_val = xTaskCreatePinnedToCore(&audio_detect_task, "SR Detect Task", 8 * 1024, NULL, 5, &g_sr_data->detect_task, 1);
ESP_GOTO_ON_FALSE(pdPASS == ret_val, ESP_FAIL, err, "Failed create audio detect task");
ret_val = xTaskCreatePinnedToCore(&sr_handler_task, "SR Handler Task", 6 * 1024, NULL, configMAX_PRIORITIES - 1, &g_sr_data->handle_task, 1);
//ret_val = xTaskCreatePinnedToCore(&sr_handler_task, "SR Handler Task", 6 * 1024, NULL, configMAX_PRIORITIES - 1, &g_sr_data->handle_task, 0);
ESP_GOTO_ON_FALSE(pdPASS == ret_val, ESP_FAIL, err, "Failed create audio handler task");
return ESP_OK;
@@ -408,9 +430,11 @@ esp_err_t sr_stop(void) {
g_sr_data->event_group = NULL;
}
#ifndef CONFIG_SR_MN_EN_NONE
if (g_sr_data->model_data) {
g_sr_data->multinet->destroy(g_sr_data->model_data);
}
#endif
if (g_sr_data->afe_data) {
g_sr_data->afe_handle->destroy(g_sr_data->afe_data);

View File

@@ -15,13 +15,11 @@
extern "C" {
#endif
#define SR_CMD_STR_LEN_MAX 64
#define SR_CMD_PHONEME_LEN_MAX 64
#define SR_CMD_STR_LEN_MAX 256
typedef struct sr_cmd_t {
int command_id;
char str[SR_CMD_STR_LEN_MAX];
char phoneme[SR_CMD_PHONEME_LEN_MAX];
} sr_cmd_t;
typedef enum {
@@ -42,6 +40,8 @@ typedef enum {
typedef enum {
SR_CHANNELS_MONO,
SR_CHANNELS_STEREO,
SR_CHANNELS_TRIPLE,
SR_CHANNELS_QUAD,
SR_CHANNELS_MAX
} sr_channels_t;
@@ -58,18 +58,18 @@ esp_err_t sr_resume(void);
esp_err_t sr_set_mode(sr_mode_t mode);
// static const sr_cmd_t sr_commands[] = {
// {0, "Turn On the Light", "TkN nN jc LiT"},
// {0, "Switch On the Light", "SWgp nN jc LiT"},
// {1, "Switch Off the Light", "SWgp eF jc LiT"},
// {1, "Turn Off the Light", "TkN eF jc LiT"},
// {2, "Turn Red", "TkN RfD"},
// {3, "Turn Green", "TkN GRmN"},
// {4, "Turn Blue", "TkN BLo"},
// {5, "Customize Color", "KcSTcMiZ KcLk"},
// {6, "Sing a song", "Sgl c Sel"},
// {7, "Play Music", "PLd MYoZgK"},
// {8, "Next Song", "NfKST Sel"},
// {9, "Pause Playing", "PeZ PLdgl"},
// {0, "Turn On the Light"},
// {0, "Switch On the Light"},
// {1, "Switch Off the Light"},
// {1, "Turn Off the Light"},
// {2, "Turn Red"},
// {3, "Turn Green"},
// {4, "Turn Blue"},
// {5, "Customize Color"},
// {6, "Sing a song"},
// {7, "Play Music"},
// {8, "Next Song"},
// {9, "Pause Playing"},
// };
#ifdef __cplusplus

View File

@@ -1,146 +0,0 @@
# pip3 install g2p_en
from g2p_en import G2p
import argparse
# python3 gen_sr_commands.py "Turn on the light,Switch on the light;Turn off the light,Switch off the light,Go dark;\
# Start fan;Stop fan;Volume down,Turn down;Mute sound;Next song;Pause playback"
# enum {
# SR_CMD_TURN_ON_THE_LIGHT,
# SR_CMD_TURN_OFF_THE_LIGHT,
# SR_CMD_START_FAN,
# SR_CMD_STOP_FAN,
# SR_CMD_VOLUME_DOWN,
# SR_CMD_MUTE_SOUND,
# SR_CMD_NEXT_SONG,
# SR_CMD_PAUSE_PLAYBACK,
# };
# static const sr_cmd_t sr_commands[] = {
# { 0, "Turn on the light", "TkN nN jc LiT"},
# { 0, "Switch on the light", "SWgp nN jc LiT"},
# { 1, "Turn off the light", "TkN eF jc LiT"},
# { 1, "Switch off the light", "SWgp eF jc LiT"},
# { 1, "Go dark", "Gb DnRK"},
# { 2, "Start fan", "STnRT FaN"},
# { 3, "Stop fan", "STnP FaN"},
# { 4, "Volume down", "VnLYoM DtN"},
# { 4, "Turn down", "TkN DtN"},
# { 5, "Mute sound", "MYoT StND"},
# { 6, "Next song", "NfKST Sel"},
# { 7, "Pause playback", "PeZ PLdBaK"},
# };
def english_g2p(text):
g2p = G2p()
out = "static const sr_cmd_t sr_commands[] = {\n"
enum = "enum {\n"
alphabet = {
"AE1": "a",
"N": "N",
" ": " ",
"OW1": "b",
"V": "V",
"AH0": "c",
"L": "L",
"F": "F",
"EY1": "d",
"S": "S",
"B": "B",
"R": "R",
"AO1": "e",
"D": "D",
"AH1": "c",
"EH1": "f",
"OW0": "b",
"IH0": "g",
"G": "G",
"HH": "h",
"K": "K",
"IH1": "g",
"W": "W",
"AY1": "i",
"T": "T",
"M": "M",
"Z": "Z",
"DH": "j",
"ER0": "k",
"P": "P",
"NG": "l",
"IY1": "m",
"AA1": "n",
"Y": "Y",
"UW1": "o",
"IY0": "m",
"EH2": "f",
"CH": "p",
"AE0": "a",
"JH": "q",
"ZH": "r",
"AA2": "n",
"SH": "s",
"AW1": "t",
"OY1": "u",
"AW2": "t",
"IH2": "g",
"AE2": "a",
"EY2": "d",
"ER1": "k",
"TH": "v",
"UH1": "w",
"UW2": "o",
"OW2": "b",
"AY2": "i",
"UW0": "o",
"AH2": "c",
"EH0": "f",
"AW0": "t",
"AO2": "e",
"AO0": "e",
"UH0": "w",
"UH2": "w",
"AA0": "n",
"AY0": "i",
"IY2": "m",
"EY0": "d",
"ER2": "k",
"OY2": "u",
"OY0": "u",
}
cmd_id = 0
phrase_id = 0
text_list = text.split(";")
for item in text_list:
item = item.split(",")
phrase_id = 0
for phrase in item:
labels = g2p(phrase)
phoneme = ""
for char in labels:
if char not in alphabet:
print("skip %s, not found in alphabet")
continue
else:
phoneme += alphabet[char]
out += " { " + str(cmd_id) + ', "' + phrase + '", "' + phoneme + '"},\n'
if phrase_id == 0:
enum += " SR_CMD_" + phrase.upper().replace(" ", "_") + ",\n"
phrase_id += 1
cmd_id += 1
out += "};"
enum += "};"
# print(text)
print(enum)
print(out)
return out
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog="English Speech Commands G2P")
parser.add_argument("text", type=str, default=None, help="input text")
args = parser.parse_args()
if args.text is not None:
english_g2p(args.text)

View File

@@ -3,6 +3,6 @@ nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x300000,
app1, app, ota_1, 0x310000, 0x300000,
spiffs, data, spiffs, 0x610000, 0x700000,
model, data, spiffs, 0xD10000, 0x2E0000,
spiffs, data, spiffs, 0x610000, 0x600000,
model, data, spiffs, 0xC10000, 0x3E0000,
coredump, data, coredump,0xFF0000, 0x10000,
1 # Name Type SubType Offset Size Flags
3 otadata data ota 0xe000 0x2000
4 app0 app ota_0 0x10000 0x300000
5 app1 app ota_1 0x310000 0x300000
6 spiffs data spiffs 0x610000 0x700000 0x600000
7 model data spiffs 0xD10000 0xC10000 0x2E0000 0x3E0000
8 coredump data coredump 0xFF0000 0x10000