backend for Muse

This commit is contained in:
Philippe G
2022-01-19 00:51:35 -08:00
parent de025602ac
commit 533ee5e408
10 changed files with 265 additions and 29 deletions

View File

@@ -26,6 +26,8 @@ menu "Squeezelite-ESP32"
help
Set logging level info|debug|sdebug
endmenu
config AMP_LOCKED
bool
config JACK_LOCKED
bool
config BAT_LOCKED
@@ -55,11 +57,17 @@ menu "Squeezelite-ESP32"
select LED_LOCKED
select SPKFAULT_LOCKED
config BASIC_I2C_BT
bool "Generic I2S & Bluetooth"
config TWATCH2020
bool "T-WATCH2020 by LilyGo"
bool "Generic I2S & Bluetooth"
config TWATCH2020
bool "T-WATCH2020 by LilyGo"
select I2C_LOCKED
config MUSE
bool "Muse"
select JACK_LOCKED
select BAT_LOCKED
select I2C_LOCKED
endchoice
select AMP_LOCKED
endchoice
config RELEASE_API
string "Software update URL"
default "https://api.github.com/repos/sle118/squeezelite-esp32/releases"
@@ -76,11 +84,13 @@ menu "Squeezelite-ESP32"
string
default "SqueezeAMP" if SQUEEZEAMP
default "Squeezelite-TWATCH" if TWATCH2020
default "Muse" if MUSE
default "Squeezelite-ESP32"
config FW_PLATFORM_NAME
string
default "SqueezeAmp" if SQUEEZEAMP
default "TWATCH" if TWATCH2020
default "Muse" if MUSE
default "ESP32"
# AGGREGATES - begin
# these parameters are "aggregates" that take precedence. They must have a default value
@@ -88,6 +98,7 @@ menu "Squeezelite-ESP32"
string
default "model=TAS57xx,bck=33,ws=25,do=32,sda=27,scl=26,mute=14:0" if SQUEEZEAMP
default "model=I2S,bck=26,ws=25,do=33,i2c=53,sda=21,scl=22" if TWATCH2020
default "model=I2S,bck=5,ws=25,do=26,di=35,i2c=16,sda=18,scl=23,mck" if MUSE
default ""
config SPDIF_CONFIG
string
@@ -98,7 +109,8 @@ menu "Squeezelite-ESP32"
default ""
config SPI_CONFIG
string
default "dc=27,data=19,clk=18" if TWATCH2020
default "dc=27,data=19,clk=18" if TWATCH2020
default "mosi=15,miso=2,clk=14" if MUSE
default ""
config DISPLAY_CONFIG
string
@@ -107,17 +119,25 @@ menu "Squeezelite-ESP32"
config ETH_CONFIG
string
default ""
# AGGREGATES - end
config DAC_CONTROLSET
string
default '{ "init": [ {"reg":41, "val":128}, {"reg":18, "val":255} ], "poweron": [ {"reg":18, "val":64, "mode":"or"} ], "poweroff": [ {"reg":18, "val":191, "mode":"and" } ] }' if TWATCH2020
default "{ \"init\": [ {\"reg\":41, \"val\":128}, {\"reg\":18, \"val\":255} ], \"poweron\": [ {\"reg\":18, \"val\":64, \"mode\":\"or\"} ], \"poweroff\": [ {\"reg\":18, \"val\":191, \"mode\":\"and\"} ] }" if TWATCH2020
default "{\"init\":[ {\"reg\":0,\"val\":128}, {\"reg\":0,\"val\":0}, {\"reg\":25,\"val\":4}, {\"reg\":1,\"val\":80}, {\"reg\":2,\"val\":0}, {\"reg\":8,\"val\":0}, {\"reg\":4,\"val\":192}, {\"reg\":0,\"val\":18}, {\"reg\":1,\"val\":0}, {\"reg\":23,\"val\":24}, {\"reg\":24,\"val\":2}, {\"reg\":38,\"val\":9}, {\"reg\":39,\"val\":144}, {\"reg\":42,\"val\":144}, {\"reg\":43,\"val\":128}, {\"reg\":45,\"val\":128}, {\"reg\":27,\"val\":0}, {\"reg\":26,\"val\":0}, {\"reg\":2,\"val\":240}, {\"reg\":2,\"val\":0}, {\"reg\":29,\"val\":28}, {\"reg\":4,\"val\":48}, {\"reg\":25,\"val\":0} ]}" if MUSE
default ""
config AUDIO_CONTROLS
string
default "[{\"gpio\":32, \"pull\":true, \"debounce\":10, \"normal\":{\"pressed\":\"ACTRLS_VOLDOWN\"}}, {\"gpio\":19, \"pull\":true, \"debounce\":40, \"normal\":{\"pressed\":\"ACTRLS_VOLUP\"}}, {\"gpio\":12, \"pull\":true, \"debounce\":40, \"longpress\":1000, \"normal\":{\"pressed\":\"ACTRLS_TOGGLE\"},\"longpress\":{\"pressed\":\"ACTRLS_POWER\"}}]" if MUSE
default ""
# AGGREGATES - end
# VARs that must be reset when changign target
default -1
config AMP_GPIO
int
default 21 if MUSE
default -1
config JACK_GPIO
int
default 34 if SQUEEZEAMP
default -1
default 34 if SQUEEZEAMP || MUSE
default -1
config SPKFAULT_GPIO
int
default 2 if SQUEEZEAMP
@@ -129,6 +149,7 @@ menu "Squeezelite-ESP32"
config LED_GREEN_GPIO
int
default 12 if SQUEEZEAMP
default 22 if MUSE
default -1
config LED_RED_GPIO
int
@@ -274,6 +295,14 @@ menu "Squeezelite-ESP32"
help
Enable Spotify connect using CSpot
endmenu
menu "Controls"
depends on !MUSE
config AUDIO_CONTROLS
string "Audio buttons set (JSON)"
help
Configuration of buttons (see README for syntax)
endmenu
menu "Display Screen"
depends on !TWATCH2020
@@ -320,8 +349,9 @@ menu "Squeezelite-ESP32"
Set parameters of GPIO extender
model=<model>[,addr=<addr>][,base=<100..N>][,count=<0..32>][,intr=<gpio>][,port=dac|system]
endmenu
menu "LED configuration"
visible if !SQUEEZEAMP && !TWATCH2020
visible if !SQUEEZEAMP && !TWATCH2020 && !MUSE
config LED_GREEN_GPIO
int "Green led GPIO"
help
@@ -329,7 +359,7 @@ menu "Squeezelite-ESP32"
config LED_GREEN_GPIO_LEVEL
int "Green led ON level"
depends on LED_GREEN_GPIO != -1
config LED_RED_GPIO
config LED_RED_GPIO
int "Red led GPIO"
help
Set to -1 for no LED
@@ -339,9 +369,10 @@ menu "Squeezelite-ESP32"
default 0 if SQUEEZEAMP
default 1
endmenu
menu "Audio JACK"
visible if !SQUEEZEAMP && !TWATCH2020
config JACK_GPIO
menu "Audio JACK"
visible if !SQUEEZEAMP && !TWATCH2020 && !MUSE
config JACK_GPIO
int "Jack insertion GPIO"
help
GPIO to detect speaker jack insertion. Set to -1 for no detection.
@@ -349,10 +380,23 @@ menu "Squeezelite-ESP32"
depends on JACK_GPIO != -1
int "Level when inserted (0/1)"
default 0
endmenu
menu "Speaker Fault"
visible if !SQUEEZEAMP && !TWATCH2020
config SPKFAULT_GPIO
endmenu
menu "Amplifier"
visible if !SQUEEZEAMP && !TWATCH2020 && !MUSE
config AMP_GPIO
int "Amplifier GPIO"
help
GPIO to switch on/off amplifier. Set to -1 for no amplifier.
config AMP_GPIO_LEVEL
depends on AMP_GPIO != -1
int "Active level(0/1)"
default 1
endmenu
menu "Speaker Fault"
visible if !SQUEEZEAMP && !TWATCH2020 && !MUSE
config SPKFAULT_GPIO
int "Speaker fault GPIO"
help
GPIO to detect speaker fault condition. Set to -1 for no detection.

View File

@@ -71,6 +71,7 @@ extern const uint8_t server_cert_pem_end[] asm("_binary_github_pem_end");
// as an exception _init function don't need include
extern void services_init(void);
extern void display_init(char *welcome);
extern void target_init(void);
const char * str_or_unknown(const char * str) { return (str?str:unknown_string_placeholder); }
const char * str_or_null(const char * str) { return (str?str:null_string_placeholder); }
bool is_recovery_running;
@@ -446,6 +447,7 @@ void app_main()
ESP_LOGI(TAG,"Initializing display");
display_init("SqueezeESP32");
MEMTRACE_PRINT_DELTA();
target_init();
if(is_recovery_running && display){
GDS_ClearExt(display, true);
GDS_SetFont(display, &Font_line_2 );