Compare commits

..

20 Commits

Author SHA1 Message Date
Sebastien L
60b163676a Fix protocol generation - release 2022-11-30 14:46:51 -05:00
github-actions
f49c3f7206 Update prebuilt objects [skip actions] 2022-11-30 05:54:53 +00:00
philippe44
3fade26793 build protobuf 2022-11-29 16:49:35 -08:00
philippe44
856303d8f1 Add GPIO config for Infrared on SqueezeAMP 3.20 2022-11-29 13:58:09 -08:00
philippe44
b20c8306fa fix a few spotify key bugs and remove BTDM 2022-11-28 21:09:27 -08:00
Sebastien L
877f16181b Activate new workflow 2022-11-28 13:57:31 -05:00
Sebastien
2cba6972ff update build_tools [skip actions] 2022-11-28 13:45:10 -05:00
Sebastien
fbd9516667 one more update to web push - [skip actions] 2022-11-28 10:46:15 -05:00
Sebastien
646a220fd0 Merge branch 'master-v4.3' of https://github.com/sle118/squeezelite-esp32 into master-v4.3 2022-11-28 10:45:04 -05:00
Sebastien
962dbf89c8 Add more auth methods for build - [skip actions] 2022-11-28 10:44:59 -05:00
github-actions
3a658f3ba2 Update prebuilt objects [skip actions] 2022-11-28 15:22:22 +00:00
github-actions
4f5a7ade9d Update prebuilt objects [skip actions] 2022-11-28 14:57:44 +00:00
Sebastien L
f15f846030 One more fix to the build system - skip actions 2022-11-28 09:52:24 -05:00
Sebastien L
14f4caf584 Allow compiling out cspot 2022-11-28 09:22:46 -05:00
Sebastien L
46eb732d82 Merge remote-tracking branch 'origin/master-v4.3' into master-v4.3 2022-11-28 09:13:02 -05:00
Sebastien L
d092ae093c Write version.txt file before build 2022-11-28 09:12:58 -05:00
philippe44
4a51efd556 Merge pull request #206 from wizmo2/display-spi-mode-v4.3
add shaffenmeisters PR and add web config
2022-11-26 19:06:06 -08:00
Wizmo2
c1375444b4 fixed backlite 2022-11-26 21:08:39 -05:00
Wizmo2
e5eabcaf86 add shaffenmeisters PR and add web config 2022-11-25 19:40:17 -05:00
github-actions
93465db1b8 Update prebuilt objects [skip actions] 2022-11-25 19:06:15 +00:00
45 changed files with 207 additions and 133 deletions

View File

@@ -1,5 +1,8 @@
name: Manually executable test for ESP-IDF v4.3.1 name: Platform Build
on: on:
push:
branches:
- '**4.3'
workflow_dispatch: workflow_dispatch:
inputs: inputs:
ui_build: ui_build:
@@ -10,9 +13,6 @@ on:
description: 'Force a Release build. When not forced, the system will check for release word in the last commit message to trigger a release' description: 'Force a Release build. When not forced, the system will check for release word in the last commit message to trigger a release'
required: true required: true
type: boolean type: boolean
# push:
# branches:
# - '**4.3'
jobs: jobs:
bootstrap: bootstrap:

View File

@@ -15,7 +15,7 @@ ENV GCC_TOOLS_BASE=/opt/esp/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32
# To run the image interactive (windows): # To run the image interactive (windows):
# docker run --rm -v %cd%:/project -w /project -it sle118/squeezelite-esp32-idfv43 # docker run --rm -v %cd%:/project -w /project -it sle118/squeezelite-esp32-idfv43
# To run the image interactive (linux): # To run the image interactive (linux):
# docker run --rm -v `pwd`:/project -w /project -it sle118/squeezelite-esp32-idfv4-master # docker run --rm -v `pwd`:/project -w /project -it sle118/squeezelite-esp32-idfv43
# to build the web app inside of the interactive session # to build the web app inside of the interactive session
# pushd components/wifi-manager/webapp/ && npm install && npm run-script build && popd # pushd components/wifi-manager/webapp/ && npm install && npm run-script build && popd
# #
@@ -90,7 +90,7 @@ RUN : \
&& pip show pygit2 \ && pip show pygit2 \
&& python --version \ && python --version \
&& pip --version \ && pip --version \
&& pip3 install protobuf grpcio-tools \ && pip install protobuf grpcio-tools \
&& rm -rf $IDF_TOOLS_PATH/dist \ && rm -rf $IDF_TOOLS_PATH/dist \
&& : && :

View File

@@ -188,13 +188,14 @@ Ground -------------------------- coax signal ground
The NVS parameter "display_config" sets the parameters for an optional display. Syntax is The NVS parameter "display_config" sets the parameters for an optional display. Syntax is
``` ```
I2C,width=<pixels>,height=<pixels>[address=<i2c_address>][,reset=<gpio>][,HFlip][,VFlip][driver=SSD1306|SSD1326[:1|4]|SSD1327|SH1106] I2C,width=<pixels>,height=<pixels>[address=<i2c_address>][,reset=<gpio>][,HFlip][,VFlip][driver=SSD1306|SSD1326[:1|4]|SSD1327|SH1106]
SPI,width=<pixels>,height=<pixels>,cs=<gpio>[,back=<gpio>][,reset=<gpio>][,speed=<speed>][,HFlip][,VFlip][driver=SSD1306|SSD1322|SSD1326[:1|4]|SSD1327|SH1106|SSD1675|ST7735|ST7789|ILI9341[:16|18][,rotate]] SPI,width=<pixels>,height=<pixels>,cs=<gpio>[,back=<gpio>][,reset=<gpio>][,speed=<speed>][,HFlip][,VFlip][driver=SSD1306|SSD1322|SSD1326[:1|4]|SSD1327|SH1106|SSD1675|ST7735|ST7789|ILI9341[:16|18][,rotate]][,mode=<mode>]
``` ```
- back: a LED backlight used by some older devices (ST7735). It is PWM controlled for brightness - back: a LED backlight used by some older devices (ST7735). It is PWM controlled for brightness
- reset: some display have a reset pin that is should normally be pulled up if unused - reset: some display have a reset pin that is should normally be pulled up if unused
- VFlip and HFlip are optional can be used to change display orientation - VFlip and HFlip are optional can be used to change display orientation
- rotate: for non-square *drivers*, move to portrait mode. Note that *width* and *height* must be inverted then - rotate: for non-square *drivers*, move to portrait mode. Note that *width* and *height* must be inverted then
- Default speed is 8000000 (8MHz) but SPI can work up to 26MHz or even 40MHz - Default speed is 8000000 (8MHz) but SPI can work up to 26MHz or even 40MHz
- mode: Default mode = 0. Some display modules use different transaction line timings. Check the module documentation if a non-standard mode is required.
- SH1106 is 128x64 monochrome I2C/SPI [here]((https://www.waveshare.com/wiki/1.3inch_OLED_HAT)) - SH1106 is 128x64 monochrome I2C/SPI [here]((https://www.waveshare.com/wiki/1.3inch_OLED_HAT))
- SSD1306 is 128x32 monochrome I2C/SPI [here](https://www.buydisplay.com/i2c-blue-0-91-inch-oled-display-module-128x32-arduino-raspberry-pi) - SSD1306 is 128x32 monochrome I2C/SPI [here](https://www.buydisplay.com/i2c-blue-0-91-inch-oled-display-module-128x32-arduino-raspberry-pi)
- SSD1322 is 256x64 grayscale 16-levels SPI in multiple sizes [here](https://www.buydisplay.com/oled-display/oled-display-module?resolution=159) - it is very nice - SSD1322 is 256x64 grayscale 16-levels SPI in multiple sizes [here](https://www.buydisplay.com/oled-display/oled-display-module?resolution=159) - it is very nice

View File

@@ -259,7 +259,7 @@ CONFIG_CSPOT_SINK=y
# Various I/O # Various I/O
# #
CONFIG_I2C_CONFIG="" CONFIG_I2C_CONFIG=""
CONFIG_SET_GPIO="" CONFIG_SET_GPIO="0=ir"
CONFIG_ROTARY_ENCODER="" CONFIG_ROTARY_ENCODER=""
# end of Various I/O # end of Various I/O

View File

@@ -11,7 +11,7 @@ bool GDS_I2CInit( int PortNumber, int SDA, int SCL, int speed );
bool GDS_I2CAttachDevice( struct GDS_Device* Device, int Width, int Height, int I2CAddress, int RSTPin, int BacklightPin ); bool GDS_I2CAttachDevice( struct GDS_Device* Device, int Width, int Height, int I2CAddress, int RSTPin, int BacklightPin );
bool GDS_SPIInit( int SPI, int DC ); bool GDS_SPIInit( int SPI, int DC );
bool GDS_SPIAttachDevice( struct GDS_Device* Device, int Width, int Height, int CSPin, int RSTPin, int Speed, int BacklightPin ); bool GDS_SPIAttachDevice( struct GDS_Device* Device, int Width, int Height, int CSPin, int RSTPin, int Speed, int BacklightPin, int Mode );
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -34,7 +34,7 @@ bool GDS_SPIInit( int SPI, int DC ) {
return true; return true;
} }
bool GDS_SPIAttachDevice( struct GDS_Device* Device, int Width, int Height, int CSPin, int RSTPin, int BackLightPin, int Speed ) { bool GDS_SPIAttachDevice( struct GDS_Device* Device, int Width, int Height, int CSPin, int RSTPin, int BackLightPin, int Speed, int Mode ) {
spi_device_interface_config_t SPIDeviceConfig = { }; spi_device_interface_config_t SPIDeviceConfig = { };
spi_device_handle_t SPIDevice; spi_device_handle_t SPIDevice;
@@ -48,6 +48,7 @@ bool GDS_SPIAttachDevice( struct GDS_Device* Device, int Width, int Height, int
SPIDeviceConfig.clock_speed_hz = Speed > 0 ? Speed : SPI_MASTER_FREQ_8M; SPIDeviceConfig.clock_speed_hz = Speed > 0 ? Speed : SPI_MASTER_FREQ_8M;
SPIDeviceConfig.spics_io_num = CSPin; SPIDeviceConfig.spics_io_num = CSPin;
SPIDeviceConfig.queue_size = 1; SPIDeviceConfig.queue_size = 1;
SPIDeviceConfig.mode = Mode;
SPIDeviceConfig.flags = SPI_DEVICE_NO_DUMMY; SPIDeviceConfig.flags = SPI_DEVICE_NO_DUMMY;
if (Device->SPIParams) Device->SPIParams(SPIDeviceConfig.clock_speed_hz, &SPIDeviceConfig.mode, if (Device->SPIParams) Device->SPIParams(SPIDeviceConfig.clock_speed_hz, &SPIDeviceConfig.mode,
&SPIDeviceConfig.cs_ena_pretrans, &SPIDeviceConfig.cs_ena_posttrans); &SPIDeviceConfig.cs_ena_pretrans, &SPIDeviceConfig.cs_ena_posttrans);

View File

@@ -119,14 +119,15 @@ void display_init(char *welcome) {
ESP_LOGI(TAG, "Display is I2C on port %u", address); ESP_LOGI(TAG, "Display is I2C on port %u", address);
} else if (strcasestr(config, "SPI") && spi_system_host != -1) { } else if (strcasestr(config, "SPI") && spi_system_host != -1) {
int CS_pin = -1, speed = 0; int CS_pin = -1, speed = 0, mode = 0;
PARSE_PARAM(config, "cs", '=', CS_pin); PARSE_PARAM(config, "cs", '=', CS_pin);
PARSE_PARAM(config, "speed", '=', speed); PARSE_PARAM(config, "speed", '=', speed);
PARSE_PARAM(config, "mode", '=', mode);
init = true; init = true;
GDS_SPIInit( spi_system_host, spi_system_dc_gpio ); GDS_SPIInit( spi_system_host, spi_system_dc_gpio );
GDS_SPIAttachDevice( display, width, height, CS_pin, RST_pin, backlight_pin, speed ); GDS_SPIAttachDevice( display, width, height, CS_pin, RST_pin, backlight_pin, speed, mode );
ESP_LOGI(TAG, "Display is SPI host %u with cs:%d", spi_system_host, CS_pin); ESP_LOGI(TAG, "Display is SPI host %u with cs:%d", spi_system_host, CS_pin);
} else { } else {

View File

@@ -83,15 +83,13 @@ static void bt_app_task_handler(void *arg)
esp_bt_controller_mem_release(ESP_BT_MODE_BLE); esp_bt_controller_mem_release(ESP_BT_MODE_BLE);
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
if(esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE ){ if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE ) {
if ((err = esp_bt_controller_init(&bt_cfg)) != ESP_OK) { if ((err = esp_bt_controller_init(&bt_cfg)) != ESP_OK) {
ESP_LOGE(TAG, "%s initialize controller failed: %s\n", __func__, esp_err_to_name(err)); ESP_LOGE(TAG, "%s initialize controller failed: %s\n", __func__, esp_err_to_name(err));
goto exit; goto exit;
} }
if ((err = esp_bt_controller_enable(ESP_BT_MODE_BTDM)) != ESP_OK) { if ((err = esp_bt_controller_enable(ESP_BT_MODE_CLASSIC_BT)) != ESP_OK) {
ESP_LOGE(TAG, "%s enable controller failed: %s\n", __func__, esp_err_to_name(err)); ESP_LOGE(TAG, "%s enable controller failed: %s\n", __func__, esp_err_to_name(err));
goto exit; goto exit;
} }

View File

@@ -592,6 +592,8 @@ static int is_valid_gpio_number(int gpio, const char * name, FILE *f, bool manda
} }
return 0; return 0;
} }
#ifdef CONFIG_CSPOT_SINK
static int do_cspot_config(int argc, char **argv){ static int do_cspot_config(int argc, char **argv){
int nerrors = arg_parse_msg(argc, argv,(struct arg_hdr **)&cspot_args); int nerrors = arg_parse_msg(argc, argv,(struct arg_hdr **)&cspot_args);
if (nerrors != 0) { if (nerrors != 0) {
@@ -639,6 +641,7 @@ static int do_cspot_config(int argc, char **argv){
FREE_AND_NULL(buf); FREE_AND_NULL(buf);
return nerrors; return nerrors;
} }
#endif
static int do_i2s_cmd(int argc, char **argv) static int do_i2s_cmd(int argc, char **argv)
{ {
i2s_platform_config_t i2s_dac_pin = { i2s_platform_config_t i2s_dac_pin = {
@@ -746,6 +749,7 @@ cJSON * known_model_cb(){
} }
return values; return values;
} }
#ifdef CONFIG_CSPOT_SINK
cJSON * cspot_cb(){ cJSON * cspot_cb(){
cJSON * values = cJSON_CreateObject(); cJSON * values = cJSON_CreateObject();
if(!values){ if(!values){
@@ -769,6 +773,7 @@ cJSON * cspot_cb(){
cJSON_Delete(cspot_config); cJSON_Delete(cspot_config);
return values; return values;
} }
#endif
cJSON * i2s_cb(){ cJSON * i2s_cb(){
cJSON * values = cJSON_CreateObject(); cJSON * values = cJSON_CreateObject();
@@ -1172,7 +1177,7 @@ static void register_known_templates_config(){
cmd_to_json_with_cb(&cmd,&known_model_cb); cmd_to_json_with_cb(&cmd,&known_model_cb);
ESP_ERROR_CHECK(esp_console_cmd_register(&cmd)); ESP_ERROR_CHECK(esp_console_cmd_register(&cmd));
} }
#ifdef CONFIG_CSPOT_SINK
static void register_cspot_config(){ static void register_cspot_config(){
cspot_args.deviceName = arg_str1(NULL,"deviceName","","Device Name"); cspot_args.deviceName = arg_str1(NULL,"deviceName","","Device Name");
cspot_args.bitrate = arg_int1(NULL,"bitrate","96|160|320","Streaming Bitrate (kbps)"); cspot_args.bitrate = arg_int1(NULL,"bitrate","96|160|320","Streaming Bitrate (kbps)");
@@ -1188,6 +1193,7 @@ static void register_cspot_config(){
cmd_to_json_with_cb(&cmd,&cspot_cb); cmd_to_json_with_cb(&cmd,&cspot_cb);
ESP_ERROR_CHECK(esp_console_cmd_register(&cmd)); ESP_ERROR_CHECK(esp_console_cmd_register(&cmd));
} }
#endif
static void register_i2s_config(void){ static void register_i2s_config(void){
i2s_args.model_name = arg_str1(NULL,"model_name",STR_OR_BLANK(get_dac_list()),"DAC Model Name"); i2s_args.model_name = arg_str1(NULL,"model_name",STR_OR_BLANK(get_dac_list()),"DAC Model Name");
i2s_args.clear = arg_lit0(NULL, "clear", "Clear configuration"); i2s_args.clear = arg_lit0(NULL, "clear", "Clear configuration");
@@ -1329,8 +1335,11 @@ static void register_squeezelite_config(void){
void register_config_cmd(void){ void register_config_cmd(void){
if(!is_dac_config_locked()){ if(!is_dac_config_locked()){
register_known_templates_config(); register_known_templates_config();
} }
#ifdef CONFIG_CSPOT_SINK
register_cspot_config(); register_cspot_config();
#endif
register_audio_config(); register_audio_config();
// register_squeezelite_config(); // register_squeezelite_config();
register_bt_source_config(); register_bt_source_config();

View File

@@ -101,6 +101,7 @@ static struct {
struct arg_int *reset; struct arg_int *reset;
struct arg_lit *clear; struct arg_lit *clear;
struct arg_lit *invert; struct arg_lit *invert;
struct arg_int *mode;
struct arg_end *end; struct arg_end *end;
} i2cdisp_args; } i2cdisp_args;
@@ -377,6 +378,13 @@ static int do_i2c_set_display(int argc, char **argv)
} }
/* Check "--cs" option */ /* Check "--cs" option */
nerrors +=is_output_gpio(i2cdisp_args.cs,f,&config.CS_pin, false); nerrors +=is_output_gpio(i2cdisp_args.cs,f,&config.CS_pin, false);
/* Check "--mode" option */
if (i2cdisp_args.mode->count) {
config.mode=i2cdisp_args.mode->ival[0];
}
else {
config.mode = 0;
}
} }
nerrors +=is_output_gpio(i2cdisp_args.reset,f,&config.RST_pin, false); nerrors +=is_output_gpio(i2cdisp_args.reset,f,&config.RST_pin, false);
@@ -964,6 +972,9 @@ cJSON * i2c_set_display_cb(){
cJSON_AddBoolToObject(values,"hf",conf->hflip); cJSON_AddBoolToObject(values,"hf",conf->hflip);
cJSON_AddBoolToObject(values,"vf",conf->vflip); cJSON_AddBoolToObject(values,"vf",conf->vflip);
cJSON_AddBoolToObject(values,"invert",conf->invert); cJSON_AddBoolToObject(values,"invert",conf->invert);
if(conf->mode>=0){
cJSON_AddNumberToObject(values,"mode",conf->mode);
}
} }
return values; return values;
} }
@@ -986,6 +997,7 @@ static void register_i2c_set_display(){
i2cdisp_args.rotate = arg_lit0("r", "rotate", "Rotate 180 degrees"); i2cdisp_args.rotate = arg_lit0("r", "rotate", "Rotate 180 degrees");
i2cdisp_args.invert = arg_lit0("i", "invert", "Invert colors"); i2cdisp_args.invert = arg_lit0("i", "invert", "Invert colors");
i2cdisp_args.clear = arg_lit0(NULL, "clear", "clear configuration and return"); i2cdisp_args.clear = arg_lit0(NULL, "clear", "clear configuration and return");
i2cdisp_args.mode = arg_int0("m", "mode", "<n>","SPI Only. Transaction Line Mode (Default 0)");
i2cdisp_args.end = arg_end(8); i2cdisp_args.end = arg_end(8);
const esp_console_cmd_t i2c_set_display= { const esp_console_cmd_t i2c_set_display= {
.command = CFG_TYPE_HW("display"), .command = CFG_TYPE_HW("display"),

View File

@@ -352,6 +352,10 @@ esp_err_t config_display_set(const display_config_t * config){
snprintf(config_buffer2,buffer_size,"%s,speed=%i",config_buffer,config->speed); snprintf(config_buffer2,buffer_size,"%s,speed=%i",config_buffer,config->speed);
strcpy(config_buffer,config_buffer2); strcpy(config_buffer,config_buffer2);
} }
if(config->mode >=0 && strcasecmp("SPI",config->type)==0){
snprintf(config_buffer2,buffer_size,"%s,mode=%i",config_buffer,config->mode);
strcpy(config_buffer,config_buffer2);
}
snprintf(config_buffer2,buffer_size,"%s,driver=%s%s%s%s",config_buffer,config->drivername,config->hflip?",HFlip":"",config->vflip?",VFlip":"",config->rotate?",rotate":""); snprintf(config_buffer2,buffer_size,"%s,driver=%s%s%s%s",config_buffer,config->drivername,config->hflip?",HFlip":"",config->vflip?",VFlip":"",config->rotate?",rotate":"");
strcpy(config_buffer,config_buffer2); strcpy(config_buffer,config_buffer2);
log_send_messaging(MESSAGING_INFO,"Updating display configuration to %s",config_buffer); log_send_messaging(MESSAGING_INFO,"Updating display configuration to %s",config_buffer);
@@ -465,6 +469,7 @@ const display_config_t * config_display_get(){
.rotate = false, .rotate = false,
.invert = false, .invert = false,
.colorswap = 0, .colorswap = 0,
.mode = 0,
}; };
char *config = config_alloc_get(NVS_TYPE_STR, "display_config"); char *config = config_alloc_get(NVS_TYPE_STR, "display_config");
if (!config) { if (!config) {
@@ -484,6 +489,8 @@ const display_config_t * config_display_get(){
PARSE_PARAM(config, "address", '=', dstruct.address); PARSE_PARAM(config, "address", '=', dstruct.address);
PARSE_PARAM(config, "cs", '=', dstruct.CS_pin); PARSE_PARAM(config, "cs", '=', dstruct.CS_pin);
PARSE_PARAM(config, "speed", '=', dstruct.speed); PARSE_PARAM(config, "speed", '=', dstruct.speed);
PARSE_PARAM(config, "back", '=', dstruct.back);
PARSE_PARAM(config, "mode", '=', dstruct.mode);
if (strstr(config, "I2C") ) dstruct.type=i2c_name_type; if (strstr(config, "I2C") ) dstruct.type=i2c_name_type;
if (strstr(config, "SPI") ) dstruct.type=spi_name_type; if (strstr(config, "SPI") ) dstruct.type=spi_name_type;

View File

@@ -33,6 +33,7 @@ typedef struct {
bool rotate; bool rotate;
bool invert; bool invert;
int colorswap; int colorswap;
int mode;
} display_config_t; } display_config_t;
typedef struct eth_config_struct { typedef struct eth_config_struct {

View File

@@ -415,7 +415,7 @@ bool create_rotary(void *id, int A, int B, int SW, int long_press, rotary_handle
// create companion button if rotary has a switch // create companion button if rotary has a switch
if (SW != -1) button_create(id, SW, BUTTON_LOW, true, 0, rotary_button_handler, long_press, -1); if (SW != -1) button_create(id, SW, BUTTON_LOW, true, 0, rotary_button_handler, long_press, -1);
ESP_LOGI(TAG, "Creating rotary encoder A:%d B:%d, SW:%d", A, B, SW); ESP_LOGI(TAG, "Created rotary encoder A:%d B:%d, SW:%d", A, B, SW);
return true; return true;
} }
@@ -432,5 +432,7 @@ bool create_infrared(int gpio, infrared_handler handler) {
common_task_init(); common_task_init();
xRingbufferAddToQueueSetRead(infrared.rb, common_queue_set); xRingbufferAddToQueueSetRead(infrared.rb, common_queue_set);
ESP_LOGI(TAG, "Created infrared receiver using GPIO %u", gpio);
return (infrared.rb != NULL); return (infrared.rb != NULL);
} }

View File

@@ -162,6 +162,8 @@ ESP_LOGI(TAG, "Getting Spotify event %d ", (int) event.eventType);
} }
}); });
// need to make sure mercuryManager is running otherwise we'll loop and destroy instances
while (!mercuryManager->isRunning) vTaskDelay(pdMS_TO_TICKS(25));
mercuryManager->reconnectedCallback = []() { mercuryManager->reconnectedCallback = []() {
return spircController->subscribe(); return spircController->subscribe();
}; };

View File

@@ -36,7 +36,7 @@ if(UNIX AND NOT APPLE)
endif() endif()
# Build protobuf code # Build protobuf code
if(0) if(1)
set(NANOPB_OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}") set(NANOPB_OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB PROTOS protobuf/*.proto) file(GLOB PROTOS protobuf/*.proto)
nanopb_generate_cpp(PROTO_SRCS PROTO_HDRS RELPATH ${CMAKE_CURRENT_SOURCE_DIR} ${PROTOS}) nanopb_generate_cpp(PROTO_SRCS PROTO_HDRS RELPATH ${CMAKE_CURRENT_SOURCE_DIR} ${PROTOS})

View File

@@ -10,5 +10,4 @@
# --plugin= on the command line. # --plugin= on the command line.
MYPATH=$(dirname "$0") MYPATH=$(dirname "$0")
echo "Executing $MYPATH/nanopb_generator.py "
exec "$MYPATH/nanopb_generator.py" --protoc-plugin exec "$MYPATH/nanopb_generator.py" --protoc-plugin

View File

@@ -179,6 +179,7 @@ size_t PlainConnection::writeBlock(const std::vector<uint8_t> &data)
break; break;
default: default:
if (retries++ > 4) throw std::runtime_error("Error in write"); if (retries++ > 4) throw std::runtime_error("Error in write");
goto WRITE;
} }
} }
idx += n; idx += n;

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -17,6 +17,10 @@ declare function getStatus(): {};
declare function getStatus(): {}; declare function getStatus(): {};
declare function getStatus(): {}; declare function getStatus(): {};
declare function getStatus(): {}; declare function getStatus(): {};
declare function getStatus(): {};
declare function getStatus(): {};
declare function getStatus(): {};
declare function getStatus(): {};
declare function getRadioButton(entry: any): string; declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string; declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string; declare function getRadioButton(entry: any): string;
@@ -36,6 +40,14 @@ declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string; declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string; declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string; declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
declare function getRadioButton(entry: any): string;
declare function pushStatus(): void;
declare function pushStatus(): void;
declare function pushStatus(): void;
declare function pushStatus(): void;
declare function pushStatus(): void; declare function pushStatus(): void;
declare function pushStatus(): void; declare function pushStatus(): void;
declare function pushStatus(): void; declare function pushStatus(): void;

View File

@@ -1,5 +1,5 @@
target_add_binary_data( __idf_wifi-manager webapp/dist/css/index.7964a13ec910c36040b8.css.gz BINARY) target_add_binary_data( __idf_wifi-manager webapp/dist/css/index.7964a13ec910c36040b8.css.gz BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/favicon-32x32.png BINARY) target_add_binary_data( __idf_wifi-manager webapp/dist/favicon-32x32.png BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/index.html.gz BINARY) target_add_binary_data( __idf_wifi-manager webapp/dist/index.html.gz BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/js/index.fff661.bundle.js.gz BINARY) target_add_binary_data( __idf_wifi-manager webapp/dist/js/index.6ae91e.bundle.js.gz BINARY)
target_add_binary_data( __idf_wifi-manager webapp/dist/js/node_vendors.fff661.bundle.js.gz BINARY) target_add_binary_data( __idf_wifi-manager webapp/dist/js/node_vendors.6ae91e.bundle.js.gz BINARY)

View File

@@ -6,29 +6,29 @@ extern const uint8_t _favicon_32x32_png_start[] asm("_binary_favicon_32x32_png_s
extern const uint8_t _favicon_32x32_png_end[] asm("_binary_favicon_32x32_png_end"); extern const uint8_t _favicon_32x32_png_end[] asm("_binary_favicon_32x32_png_end");
extern const uint8_t _index_html_gz_start[] asm("_binary_index_html_gz_start"); extern const uint8_t _index_html_gz_start[] asm("_binary_index_html_gz_start");
extern const uint8_t _index_html_gz_end[] asm("_binary_index_html_gz_end"); extern const uint8_t _index_html_gz_end[] asm("_binary_index_html_gz_end");
extern const uint8_t _index_fff661_bundle_js_gz_start[] asm("_binary_index_fff661_bundle_js_gz_start"); extern const uint8_t _index_6ae91e_bundle_js_gz_start[] asm("_binary_index_6ae91e_bundle_js_gz_start");
extern const uint8_t _index_fff661_bundle_js_gz_end[] asm("_binary_index_fff661_bundle_js_gz_end"); extern const uint8_t _index_6ae91e_bundle_js_gz_end[] asm("_binary_index_6ae91e_bundle_js_gz_end");
extern const uint8_t _node_vendors_fff661_bundle_js_gz_start[] asm("_binary_node_vendors_fff661_bundle_js_gz_start"); extern const uint8_t _node_vendors_6ae91e_bundle_js_gz_start[] asm("_binary_node_vendors_6ae91e_bundle_js_gz_start");
extern const uint8_t _node_vendors_fff661_bundle_js_gz_end[] asm("_binary_node_vendors_fff661_bundle_js_gz_end"); extern const uint8_t _node_vendors_6ae91e_bundle_js_gz_end[] asm("_binary_node_vendors_6ae91e_bundle_js_gz_end");
const char * resource_lookups[] = { const char * resource_lookups[] = {
"/css/index.7964a13ec910c36040b8.css.gz", "/css/index.7964a13ec910c36040b8.css.gz",
"/favicon-32x32.png", "/favicon-32x32.png",
"/index.html.gz", "/index.html.gz",
"/js/index.fff661.bundle.js.gz", "/js/index.6ae91e.bundle.js.gz",
"/js/node_vendors.fff661.bundle.js.gz", "/js/node_vendors.6ae91e.bundle.js.gz",
"" ""
}; };
const uint8_t * resource_map_start[] = { const uint8_t * resource_map_start[] = {
_index_7964a13ec910c36040b8_css_gz_start, _index_7964a13ec910c36040b8_css_gz_start,
_favicon_32x32_png_start, _favicon_32x32_png_start,
_index_html_gz_start, _index_html_gz_start,
_index_fff661_bundle_js_gz_start, _index_6ae91e_bundle_js_gz_start,
_node_vendors_fff661_bundle_js_gz_start _node_vendors_6ae91e_bundle_js_gz_start
}; };
const uint8_t * resource_map_end[] = { const uint8_t * resource_map_end[] = {
_index_7964a13ec910c36040b8_css_gz_end, _index_7964a13ec910c36040b8_css_gz_end,
_favicon_32x32_png_end, _favicon_32x32_png_end,
_index_html_gz_end, _index_html_gz_end,
_index_fff661_bundle_js_gz_end, _index_6ae91e_bundle_js_gz_end,
_node_vendors_fff661_bundle_js_gz_end _node_vendors_6ae91e_bundle_js_gz_end
}; };

View File

@@ -1,6 +1,6 @@
/*********************************** /***********************************
webpack_headers webpack_headers
dist/css/index.7964a13ec910c36040b8.css.gz,dist/favicon-32x32.png,dist/index.html.gz,dist/js/index.fff661.bundle.js.gz,dist/js/node_vendors.fff661.bundle.js.gz dist/css/index.7964a13ec910c36040b8.css.gz,dist/favicon-32x32.png,dist/index.html.gz,dist/js/index.6ae91e.bundle.js.gz,dist/js/node_vendors.6ae91e.bundle.js.gz
***********************************/ ***********************************/
#pragma once #pragma once
#include <inttypes.h> #include <inttypes.h>

View File

@@ -12,18 +12,29 @@ import io
from os import walk from os import walk
from requests import Response from requests import Response
NEWLINE_CHAR = '\n'
def print_message(message,prefix=''): class Logger:
trimmed=re.sub(r'\n', r'%0A', message,flags=re.MULTILINE) NEWLINE_CHAR = '\n'
print(f'{prefix}{trimmed}') with_crlf = False
@classmethod
def print_debug(message): def print_message(cls,message,prefix=''):
print_message(message,'::debug::') if not Logger.with_crlf:
trimmed=re.sub(r'\n', r'%0A', message,flags=re.MULTILINE)
print(f'{prefix}{trimmed}')
@classmethod
def debug(cls,message):
cls.print_message(message,'::debug::')
def print_error(message): @classmethod
print_message(message,'::error::') def error(cls,message):
cls.print_message(message,'::error::')
@classmethod
def notice(cls,message):
cls.print_message(message,'::notice::')
@classmethod
def warning(cls,message):
cls.print_message(message,'::notice::')
try: try:
@@ -34,7 +45,6 @@ try:
import glob import glob
import json import json
import logging
import re import re
import shutil import shutil
import stat import stat
@@ -60,12 +70,12 @@ try:
from genericpath import isdir from genericpath import isdir
except ImportError as ex: except ImportError as ex:
print_error( Logger.error(
f'Failed importing module {ex.name}, using interpreter {sys.executable}. {NEWLINE_CHAR} Installed packages:') f'Failed importing module {ex.name}, using interpreter {sys.executable}. {Logger.NEWLINE_CHAR} Installed packages:')
installed_packages = pkg_resources.working_set installed_packages = pkg_resources.working_set
installed_packages_list = sorted( installed_packages_list = sorted(
["%s==%s" % (i.key, i.version) for i in installed_packages]) ["%s==%s" % (i.key, i.version) for i in installed_packages])
print(NEWLINE_CHAR.join(installed_packages_list)) print(Logger.NEWLINE_CHAR.join(installed_packages_list))
print(f'Environment: ') print(f'Environment: ')
envlist = "\n".join([f"{k}={v}" for k, v in sorted(os.environ.items())]) envlist = "\n".join([f"{k}={v}" for k, v in sorted(os.environ.items())])
print(f'{envlist}') print(f'{envlist}')
@@ -74,13 +84,15 @@ except ImportError as ex:
tool_version = "1.0.7" tool_version = "1.0.7"
WEB_INSTALLER_DEFAULT_PATH = './web_installer/' WEB_INSTALLER_DEFAULT_PATH = './web_installer/'
FORMAT = '%(asctime)s %(message)s' FORMAT = '%(asctime)s %(message)s'
logging.basicConfig(format=FORMAT)
github_env = type('', (), {})() github_env = type('', (), {})()
manifest = { manifest = {
"name": "", "name": "",
"version": "", "version": "",
"home_assistant_domain": "slim_player", "home_assistant_domain": "slim_player",
"funding_url": "https://esphome.io/guides/supporters.html", "funding_url": "https://esphome.io/guides/supporters.html",
"new_install_prompt_erase": True,
"new_install_improv_wait_time" : 20,
"builds": [ "builds": [
{ {
"chipFamily": "ESP32", "chipFamily": "ESP32",
@@ -121,10 +133,16 @@ parser = argparse.ArgumentParser(
description='Handles some parts of the squeezelite-esp32 build process') description='Handles some parts of the squeezelite-esp32 build process')
parser.add_argument('--cwd', type=str, parser.add_argument('--cwd', type=str,
help='Working directory', default=os.getcwd()) help='Working directory', default=os.getcwd())
parser.add_argument('--with_crlf', action='store_true',help='To prevent replacing cr/lf with hex representation')
parser.add_argument('--loglevel', type=str, choices={ parser.add_argument('--loglevel', type=str, choices={
'CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTSET'}, help='Logging level', default='INFO') 'CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTSET'}, help='Logging level', default='INFO')
subparsers = parser.add_subparsers(dest='command', required=True) subparsers = parser.add_subparsers(dest='command', required=True)
parser_commits = subparsers.add_parser("list_commits",add_help=False,
description="Commits list",
help="Lists the last commits"
)
parser_dir = subparsers.add_parser("list_files", parser_dir = subparsers.add_parser("list_files",
add_help=False, add_help=False,
description="List Files parser", description="List Files parser",
@@ -198,13 +216,13 @@ parser_build_flags.add_argument(
parser_build_flags.add_argument( parser_build_flags.add_argument(
'--ui_build', action='store_true', help='Include building the web UI') '--ui_build', action='store_true', help='Include building the web UI')
def format_commit(commit): def format_commit(commit):
# 463a9d8b7 Merge branch 'bugfix/ci_deploy_tags_v4.0' into 'release/v4.0' (2020-01-11T14:08:55+08:00) # 463a9d8b7 Merge branch 'bugfix/ci_deploy_tags_v4.0' into 'release/v4.0' (2020-01-11T14:08:55+08:00)
dt = datetime.fromtimestamp(float(commit.author.time), timezone( dt = datetime.fromtimestamp(float(commit.author.time), timezone(
timedelta(minutes=commit.author.offset))) timedelta(minutes=commit.author.offset)))
timestr = dt.strftime('%c%z') #timestr = dt.strftime('%c%z')
cmesg = commit.message.replace('\n', ' ') timestr = dt.strftime('%F %R %Z')
cmesg:str = commit.message.replace('\n', ' ').replace('\r','').replace('*','-')
return f'{commit.short_id} {cmesg} ({timestr}) <{commit.author.name}>'.replace(' ', ' ', ) return f'{commit.short_id} {cmesg} ({timestr}) <{commit.author.name}>'.replace(' ', ' ', )
@@ -277,21 +295,21 @@ class BinFile():
self.source_full_path = os.path.join( self.source_full_path = os.path.join(
source_path, file_build_path).rstrip() source_path, file_build_path).rstrip()
self.offset = offset self.offset = offset
self.target_name = f'{release_details.format_prefix()}-{self.name}'.rstrip() self.target_name = f'{release_details.format_prefix()}-{release_details.bitrate}-{self.name}'.rstrip()
def get_manifest(self): def get_manifest(self):
return {"path": self.target_name, "offset": self.offset} return {"path": self.target_name, "offset": self.offset}
def copy(self, target_folder) -> str: def copy(self, target_folder) -> str:
self.target_fullpath = os.path.join(target_folder, self.target_name) self.target_fullpath = os.path.join(target_folder, self.target_name)
print_debug( Logger.debug(
f'File {self.source_full_path} will be copied to {self.target_fullpath}') f'File {self.source_full_path} will be copied to {self.target_fullpath}')
try: try:
os.makedirs(target_folder, exist_ok=True) os.makedirs(target_folder, exist_ok=True)
shutil.copyfile(self.source_full_path, shutil.copyfile(self.source_full_path,
self.target_fullpath, follow_symlinks=True) self.target_fullpath, follow_symlinks=True)
except Exception as ex: except Exception as ex:
print_error(f"Error while copying {self.source_full_path} to {self.target_fullpath}{NEWLINE_CHAR}Content of {os.path.dirname(self.source_full_path.rstrip())}:{NEWLINE_CHAR}{NEWLINE_CHAR.join(get_file_list(os.path.dirname(self.source_full_path.rstrip())))}") Logger.error(f"Error while copying {self.source_full_path} to {self.target_fullpath}{Logger.NEWLINE_CHAR}Content of {os.path.dirname(self.source_full_path.rstrip())}:{Logger.NEWLINE_CHAR}{Logger.NEWLINE_CHAR.join(get_file_list(os.path.dirname(self.source_full_path.rstrip())))}")
@@ -323,7 +341,7 @@ class PlatformRelease():
flash_file_path: str flash_file_path: str
def get_manifest_name(self) -> str: def get_manifest_name(self) -> str:
return f'{self.name_prefix}-{self.release_details.format_prefix()}.json' return f'{self.name_prefix}-{self.release_details.format_prefix()}-{self.release_details.bitrate}.json'
def __init__(self, flash_file_path, git_release, build_dir, branch, name_prefix) -> None: def __init__(self, flash_file_path, git_release, build_dir, branch, name_prefix) -> None:
self.name = git_release.tag_name self.name = git_release.tag_name
@@ -389,8 +407,7 @@ class PlatformRelease():
self.has_artifacts = False self.has_artifacts = False
def cleanup(self): def cleanup(self):
print( Logger.debug(f'removing temp directory for platform release {self.name}')
f'removing temp directory for platform release {self.name}')
shutil.rmtree(self.tempfolder) shutil.rmtree(self.tempfolder)
def get_attributes(self): def get_attributes(self):
@@ -438,7 +455,6 @@ class Releases():
return result return result
def append(self, value: PlatformRelease): def append(self, value: PlatformRelease):
# optional processing here
if self.count(value) == 0: if self.count(value) == 0:
self._dict[value.platform()] = [] self._dict[value.platform()] = []
if self.should_add(value): if self.should_add(value):
@@ -465,8 +481,7 @@ class Releases():
def add_package(self, package: PlatformRelease, with_artifacts: bool = True): def add_package(self, package: PlatformRelease, with_artifacts: bool = True):
if self.branch != package.branch: if self.branch != package.branch:
print( Logger.debug(f'Skipping release {package.name} from branch {package.branch}')
f'Skipping release {package.name} from branch {package.branch}')
elif package.has_artifacts or not with_artifacts: elif package.has_artifacts or not with_artifacts:
self.append(package) self.append(package)
@@ -476,7 +491,7 @@ class Releases():
if last is None: if last is None:
return '' return ''
else: else:
return last.message.replace(NEWLINE_CHAR, ' ') return last.message.replace(Logger.NEWLINE_CHAR, ' ')
@classmethod @classmethod
def get_last_author(cls, repo_obj: Repository = None) -> Signature: def get_last_author(cls, repo_obj: Repository = None) -> Signature:
@@ -505,7 +520,7 @@ class Releases():
print( print(
f'Last commit for {head.shorthand} is {format_commit(cls.last_commit)}') f'Last commit for {head.shorthand} is {format_commit(cls.last_commit)}')
except Exception as e: except Exception as e:
print_error( Logger.error(
f'Unable to retrieve last commit for {head.shorthand}/{target}: {e}') f'Unable to retrieve last commit for {head.shorthand}/{target}: {e}')
cls.last_commit = None cls.last_commit = None
return cls.last_commit return cls.last_commit
@@ -517,7 +532,7 @@ class Releases():
print(f'Opening repository from {path}') print(f'Opening repository from {path}')
cls.repo = Repository(path=path) cls.repo = Repository(path=path)
except GitError as ex: except GitError as ex:
print_error(f"Unable to access the repository({ex}).\nContent of {path}:\n{NEWLINE_CHAR.join(get_file_list(path, 1))}") Logger.error(f"Unable to access the repository({ex}).\nContent of {path}:\n{Logger.NEWLINE_CHAR.join(get_file_list(path, 1))}")
raise raise
return cls.repo return cls.repo
@@ -558,11 +573,11 @@ class Releases():
packages: Releases = cls(branch=repo.head.shorthand, maxcount=maxcount) packages: Releases = cls(branch=repo.head.shorthand, maxcount=maxcount)
build_dir = os.path.dirname(flash_file_path) build_dir = os.path.dirname(flash_file_path)
for page in range(1, 999): for page in range(1, 999):
print_debug(f'Getting releases page {page}') Logger.debug(f'Getting releases page {page}')
releases = get_github_data( releases = get_github_data(
repo, f'releases?per_page=50&page={page}') repo, f'releases?per_page=50&page={page}')
if len(releases) == 0: if len(releases) == 0:
print_debug(f'No more release found for page {page}') Logger.debug(f'No more release found for page {page}')
break break
for release_entry in [AttributeDict(platform) for platform in releases]: for release_entry in [AttributeDict(platform) for platform in releases]:
packages.add_package(PlatformRelease(flash_file_path, release_entry, build_dir, packages.add_package(PlatformRelease(flash_file_path, release_entry, build_dir,
@@ -588,14 +603,14 @@ class Releases():
break break
except Exception as e: except Exception as e:
print_error( Logger.error(
f'Unable to get commit list starting at {last.id}: {e}') f'Unable to get commit list starting at {last.id}: {e}')
return commit_list return commit_list
@classmethod @classmethod
def get_commit_list_descriptions(cls) -> str: def get_commit_list_descriptions(cls) -> str:
return '<<~EOD\n### Revision Log\n'+NEWLINE_CHAR.join(cls.get_commit_list())+'\n~EOD' return '<<~EOD\n### Revision Log\n'+Logger.NEWLINE_CHAR.join(cls.get_commit_list())+'\n~EOD'
def update(self, *args, **kwargs): def update(self, *args, **kwargs):
if args: if args:
@@ -626,34 +641,27 @@ def parse_json(filename: str):
try: try:
with open(fname) as f: with open(fname) as f:
content = f.read() content = f.read()
print_debug(f'Loading json\n{content}') Logger.debug(f'Loading json\n{content}')
return json.loads(content) return json.loads(content)
except JSONDecodeError as ex: except JSONDecodeError as ex:
print_error(f'Error parsing {content}') Logger.error(f'Error parsing {content}')
except Exception as ex: except Exception as ex:
print_error( Logger.error(
f"Unable to parse flasher args json file. Content of {folder}:{NEWLINE_CHAR.join(get_file_list(folder))}") f"Unable to parse flasher args json file. Content of {folder}:{Logger.NEWLINE_CHAR.join(get_file_list(folder))}")
raise raise
def write_github_env(args): def write_github_env_file(values,env_file):
print(f'Writing environment details to {args.env_file}...') print(f'Writing content to {env_file}...')
with open(args.env_file, "w") as env_file: with open(env_file, "w") as env_file:
for attr in [attr for attr in dir(github_env) if not attr.startswith('_')]: for attr in [attr for attr in dir(values) if not attr.startswith('_')]:
line = f'{attr}{"=" if attr != "description" else ""}{getattr(github_env,attr)}' line = f'{attr}{"=" if attr != "description" else ""}{getattr(values,attr)}'
print(line) print(line)
env_file.write(f'{line}\n') env_file.write(f'{line}\n')
os.environ[attr] = str(getattr(github_env, attr)) os.environ[attr] = str(getattr(values, attr))
print(f'Done writing environment details to {args.env_file}!') print(f'Done writing to {env_file}!')
def set_workflow_output(args):
print(f'Outputting job variables ...')
for attr in [attr for attr in dir(github_env) if not attr.startswith('_')]:
print(f'::set-output name={attr}::{getattr(github_env,attr)}')
os.environ[attr] = str(getattr(github_env, attr))
print(f'Done outputting job variables!')
def format_artifact_from_manifest(manif_json: AttributeDict): def format_artifact_from_manifest(manif_json: AttributeDict):
if len(manif_json) == 0: if len(manif_json) == 0:
@@ -674,7 +682,19 @@ def handle_build_flags(args):
github_env.release_flag = 1 if args.mock or args.force or 'release' in commit_message.lower() else 0 github_env.release_flag = 1 if args.mock or args.force or 'release' in commit_message.lower() else 0
github_env.ui_build = 1 if args.mock or args.ui_build or '[ui-build]' in commit_message.lower( github_env.ui_build = 1 if args.mock or args.ui_build or '[ui-build]' in commit_message.lower(
) or github_env.release_flag == 1 else 0 ) or github_env.release_flag == 1 else 0
set_workflow_output(github_env) write_github_env_file(github_env,os.environ.get('GITHUB_OUTPUT'))
def write_version_number(file_path:str,env_details):
# app_name="${TARGET_BUILD_NAME}.${DEPTH}.dev-$(git log --pretty=format:'%h' --max-count=1).${branch_name}"
# echo "${app_name}">version.txt
try:
version:str = f'{env_details.TARGET_BUILD_NAME}.{env_details.DEPTH}.{env_details.major}.{env_details.BUILD_NUMBER}.{env_details.branch_name}'
with open(file_path, "w") as version_file:
version_file.write(version)
except Exception as ex:
Logger.error(f'Unable to set version string {version} in file {file_path}')
raise Exception('Version error')
Logger.notice(f'Firmware version set to {version}')
def handle_environment(args): def handle_environment(args):
@@ -706,7 +726,8 @@ def handle_environment(args):
github_env.artifact_bin_file_name = f"{github_env.artifact_prefix}.bin" github_env.artifact_bin_file_name = f"{github_env.artifact_prefix}.bin"
github_env.PROJECT_VER = f'{args.node}-{ args.build }' github_env.PROJECT_VER = f'{args.node}-{ args.build }'
github_env.description = Releases.get_commit_list_descriptions() github_env.description = Releases.get_commit_list_descriptions()
write_github_env(args) write_github_env_file(github_env,args.env_file)
write_version_number("version.txt",github_env)
def handle_artifacts(args): def handle_artifacts(args):
@@ -722,7 +743,7 @@ def handle_artifacts(args):
os.makedirs(target_dir, exist_ok=True) os.makedirs(target_dir, exist_ok=True)
shutil.copyfile(source, target, follow_symlinks=True) shutil.copyfile(source, target, follow_symlinks=True)
except Exception as ex: except Exception as ex:
print_error(f"Error while copying {source} to {target}\nContent of {target_dir}:\n{NEWLINE_CHAR.join(get_file_list(os.path.dirname(attr[0].rstrip())))}") Logger.error(f"Error while copying {source} to {target}\nContent of {target_dir}:\n{Logger.NEWLINE_CHAR.join(get_file_list(os.path.dirname(attr[0].rstrip())))}")
raise raise
@@ -731,16 +752,16 @@ def delete_folder(path):
for root, dirs, files in os.walk(path, topdown=True): for root, dirs, files in os.walk(path, topdown=True):
for dir in dirs: for dir in dirs:
fulldirpath = os.path.join(root, dir) fulldirpath = os.path.join(root, dir)
print_debug(f'Drilling down in {fulldirpath}') Logger.debug(f'Drilling down in {fulldirpath}')
delete_folder(fulldirpath) delete_folder(fulldirpath)
for fname in files: for fname in files:
full_path = os.path.join(root, fname) full_path = os.path.join(root, fname)
print_debug(f'Setting file read/write {full_path}') Logger.debug(f'Setting file read/write {full_path}')
os.chmod(full_path, stat.S_IWRITE) os.chmod(full_path, stat.S_IWRITE)
print_debug(f'Deleting file {full_path}') Logger.debug(f'Deleting file {full_path}')
os.remove(full_path) os.remove(full_path)
if os.path.exists(path): if os.path.exists(path):
print_debug(f'Changing folder read/write {path}') Logger.debug(f'Changing folder read/write {path}')
os.chmod(path, stat.S_IWRITE) os.chmod(path, stat.S_IWRITE)
print(f'WARNING: Deleting Folder {path}') print(f'WARNING: Deleting Folder {path}')
os.rmdir(path) os.rmdir(path)
@@ -797,7 +818,7 @@ def handle_manifest(args):
man['builds'][0]['parts'] = release.process_files(args.outdir) man['builds'][0]['parts'] = release.process_files(args.outdir)
man['name'] = release.platform() man['name'] = release.platform()
man['version'] = release.release_details.version man['version'] = release.release_details.version
print_debug(f'Generated manifest: \n{json.dumps(man)}') Logger.debug(f'Generated manifest: \n{json.dumps(man)}')
fullpath = os.path.join(args.outdir, release.get_manifest_name()) fullpath = os.path.join(args.outdir, release.get_manifest_name())
print(f'Writing manifest to {fullpath}') print(f'Writing manifest to {fullpath}')
with open(fullpath, "w") as f: with open(fullpath, "w") as f:
@@ -827,7 +848,7 @@ def copy_no_overwrite(source: str, target: str):
print(f'Copying {f} to target') print(f'Copying {f} to target')
shutil.copy(source_file, target_file) shutil.copy(source_file, target_file)
else: else:
print_debug(f'Skipping existing file {f}') Logger.debug(f'Skipping existing file {f}')
def get_changed_items(repo: Repository) -> Dict: def get_changed_items(repo: Repository) -> Dict:
@@ -850,7 +871,7 @@ def push_with_method(auth_method:str,token:str,remote: Remote,reference):
remote.push(reference, callbacks=RemoteCallbacks(pygit2.UserPass(auth_method, token))) remote.push(reference, callbacks=RemoteCallbacks(pygit2.UserPass(auth_method, token)))
success=True success=True
except Exception as ex: except Exception as ex:
print_error(f'Error pushing with auth method {auth_method}: {ex}.') Logger.error(f'Error pushing with auth method {auth_method}: {ex}.')
return success return success
def push_if_change(repo: Repository, token: str, source_path: str, manif_json): def push_if_change(repo: Repository, token: str, source_path: str, manif_json):
@@ -872,11 +893,11 @@ def push_if_change(repo: Repository, token: str, source_path: str, manif_json):
remote: Remote = repo.remotes['origin'] remote: Remote = repo.remotes['origin']
auth_methods = ['x-access-token','x-oauth-basic'] auth_methods = ['x-access-token','x-oauth-basic']
for method in auth_methods: for method in auth_methods:
if push_with_method('x-access-token', token, remote, [reference]): if push_with_method(method, token, remote, [reference]):
print(f'::notice Web installer updated for {format_artifact_from_manifest(manif_json)}') print(f'::notice Web installer updated for {format_artifact_from_manifest(manif_json)}')
return return
raise Exception('Unable to push web installer.')
raise Exception('Unable to push web installer changes to installer repo')
else: else:
print(f'WARNING: No change found. Skipping update') print(f'WARNING: No change found. Skipping update')
@@ -921,8 +942,8 @@ def handle_show(args):
def extract_files_from_archive(url): def extract_files_from_archive(url):
tempfolder = tempfile.mkdtemp() tempfolder = tempfile.mkdtemp()
platform:Response = requests.get(url) platform:Response = requests.get(url)
print_debug(f'Downloading {url} to {tempfolder}') Logger.debug(f'Downloading {url} to {tempfolder}')
print_debug(f'Transfer status code: {platform.status_code}. Expanding content') Logger.debug(f'Transfer status code: {platform.status_code}. Expanding content')
z = zipfile.ZipFile(io.BytesIO(platform.content)) z = zipfile.ZipFile(io.BytesIO(platform.content))
z.extractall(tempfolder) z.extractall(tempfolder)
return tempfolder return tempfolder
@@ -930,7 +951,11 @@ def extract_files_from_archive(url):
def handle_list_files(args): def handle_list_files(args):
print(f'Content of {args.cwd}:') print(f'Content of {args.cwd}:')
print(NEWLINE_CHAR.join(get_file_list(args.cwd))) print(Logger.NEWLINE_CHAR.join(get_file_list(args.cwd)))
def handle_commits(args):
set_workdir(args)
print(Releases.get_commit_list_descriptions())
parser_environment.set_defaults(func=handle_environment, cmd='environment') parser_environment.set_defaults(func=handle_environment, cmd='environment')
@@ -939,11 +964,13 @@ parser_pushinstaller.set_defaults(func=handle_pushinstaller, cmd='installer')
parser_show.set_defaults(func=handle_show, cmd='show') parser_show.set_defaults(func=handle_show, cmd='show')
parser_build_flags.set_defaults(func=handle_build_flags, cmd='build_flags') parser_build_flags.set_defaults(func=handle_build_flags, cmd='build_flags')
parser_dir.set_defaults(func=handle_list_files, cmd='list_files') parser_dir.set_defaults(func=handle_list_files, cmd='list_files')
parser_commits.set_defaults(func=handle_commits,cmd='list_commits')
def main(): def main():
exit_result_code = 0 exit_result_code = 0
args = parser.parse_args() args = parser.parse_args()
Logger.with_crlf = args.with_crlf
print(f'::group::{args.command}') print(f'::group::{args.command}')
print(f'build_tools version : {tool_version}') print(f'build_tools version : {tool_version}')
print(f'Processing command {args.command}') print(f'Processing command {args.command}')
@@ -955,7 +982,7 @@ def main():
try: try:
func(args) func(args)
except Exception as e: except Exception as e:
print_error(f'Critical error while running {args.command}\n{" ".join(traceback.format_exception(etype=type(e), value=e, tb=e.__traceback__))}') Logger.error(f'Critical error while running {args.command}\n{" ".join(traceback.format_exception(etype=type(e), value=e, tb=e.__traceback__))}')
exit_result_code = 1 exit_result_code = 1
else: else:
# No subcommand was provided, so call help # No subcommand was provided, so call help

View File

@@ -117,7 +117,7 @@ menu "Squeezelite-ESP32"
string 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 "mosi=15,miso=2,clk=14" if MUSE
default "" default ""
config DISPLAY_CONFIG config DISPLAY_CONFIG
string string
default "SPI,driver=ST7789,width=240,height=240,cs=5,back=12,speed=16000000,HFlip,VFlip" if TWATCH2020 default "SPI,driver=ST7789,width=240,height=240,cs=5,back=12,speed=16000000,HFlip,VFlip" if TWATCH2020
@@ -125,7 +125,7 @@ menu "Squeezelite-ESP32"
config ETH_CONFIG config ETH_CONFIG
string string
default "" default ""
# AGGREGATES - end # AGGREGATES - end
config DAC_CONTROLSET config DAC_CONTROLSET
string 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
@@ -168,6 +168,9 @@ menu "Squeezelite-ESP32"
int int
default 13 if SQUEEZEAMP default 13 if SQUEEZEAMP
default -1 default -1
config SET_GPIO
string
default "0=ir" if SQUEEZEAMP
endmenu endmenu
menu "Audio settings" menu "Audio settings"
@@ -342,14 +345,15 @@ menu "Squeezelite-ESP32"
data=<gpio>,clk=<gpio>[,d/c=<num>][,host=<0|1|2>] data=<gpio>,clk=<gpio>[,d/c=<num>][,host=<0|1|2>]
config SET_GPIO config SET_GPIO
string "Special GPIO configuration" string "Special GPIO configuration"
default ""
help help
Set parameters of shared GPIO with special values. Set parameters of shared GPIO with special values.
<gpio_1>=Vcc|GND|amp[:0|1]|jack[:0|1][,<gpio_n>=Vcc|GND|amp[:0|1]|jack[:0|1]] <gpio_1>=Vcc|GND|amp[:0|1]|jack[:0|1][ir][spkfault[:0|1][,<gpio_n>=Vcc|GND|amp[:0|1]|jack[:0|1]]
'amp' => GPIO that is set when playback starts 'amp' => GPIO that is set when playback starts
'jack' => GPIO used for audio jack detection 'jack' => GPIO used for audio jack detection
'green', 'red' => GPIO for status LED 'green', 'red' => GPIO for status LED
'[:0|1] means set the active value for that GPIO can be low or high 'spkfault' => GPIO used for speaker fault detection
'ir' => GPIO used for Infrared Receiver
[:0|1] means set the active value for that GPIO can be low or high
config ROTARY_ENCODER config ROTARY_ENCODER
string "Rotary Encoder configuration" string "Rotary Encoder configuration"
default "" default ""

View File

@@ -312,8 +312,22 @@ void register_default_with_mac(const char* key, char* defval) {
void register_default_nvs(){ void register_default_nvs(){
#ifdef CONFIG_CSPOT_SINK #ifdef CONFIG_CSPOT_SINK
register_default_string_val("enable_cspot", STR(CONFIG_CSPOT_SINK)); register_default_string_val("enable_cspot", STR(CONFIG_CSPOT_SINK));
#else cJSON * cspot_config=config_alloc_get_cjson("cspot_config");
register_default_string_val("enable_cspot", "0"); if(!cspot_config){
char * name = alloc_get_string_with_mac(DEFAULT_HOST_NAME);
if(name){
cjson_update_string(&cspot_config,"deviceName",name);
cjson_update_number(&cspot_config,"bitrate",160);
// the call below saves the config and frees the json pointer
config_set_cjson_str_and_free("cspot_config",cspot_config);
FREE_AND_NULL(name);
}
else {
register_default_string_val("cspot_config", "");
}
}
#endif #endif
#ifdef CONFIG_AIRPLAY_SINK #ifdef CONFIG_AIRPLAY_SINK
@@ -379,23 +393,6 @@ void register_default_nvs(){
register_default_string_val("ethtmout","8"); register_default_string_val("ethtmout","8");
register_default_string_val("dhcp_tmout","8"); register_default_string_val("dhcp_tmout","8");
register_default_string_val("target", CONFIG_TARGET); register_default_string_val("target", CONFIG_TARGET);
cJSON * cspot_config=config_alloc_get_cjson("cspot_config");
if(!cspot_config){
char * name = alloc_get_string_with_mac(DEFAULT_HOST_NAME);
if(name){
cjson_update_string(&cspot_config,"deviceName",name);
cjson_update_number(&cspot_config,"bitrate",160);
// the call below saves the config and frees the json pointer
config_set_cjson_str_and_free("cspot_config",cspot_config);
FREE_AND_NULL(name);
}
else {
register_default_string_val("cspot_config", "");
}
}
wait_for_commit(); wait_for_commit();
ESP_LOGD(TAG,"Done setting default values in nvs."); ESP_LOGD(TAG,"Done setting default values in nvs.");
} }

View File

@@ -262,7 +262,7 @@ CONFIG_AIRPLAY_PORT="5000"
# Various I/O # Various I/O
# #
CONFIG_I2C_CONFIG="" CONFIG_I2C_CONFIG=""
CONFIG_SET_GPIO="" # CONFIG_SET_GPIO= is not set
CONFIG_ROTARY_ENCODER="" CONFIG_ROTARY_ENCODER=""
# end of Various I/O # end of Various I/O

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
server_certs/rootca1.cer.20 Normal file

Binary file not shown.

BIN
server_certs/rootca1.cer.21 Normal file

Binary file not shown.

BIN
server_certs/rootca1.cer.22 Normal file

Binary file not shown.

BIN
server_certs/rootca1.cer.23 Normal file

Binary file not shown.