mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-14 23:47:02 +03:00
Compare commits
11 Commits
developmen
...
developmen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c33acfd35 | ||
|
|
0222a34286 | ||
|
|
a90c9802ab | ||
|
|
94da8ca950 | ||
|
|
9a9a4fef65 | ||
|
|
3a7b1f48c7 | ||
|
|
a46bbb409f | ||
|
|
08d16c2ca2 | ||
|
|
b501352ddc | ||
|
|
1c51598366 | ||
|
|
db839a9ccd |
@@ -35,7 +35,7 @@ static bool I2CDefaultWriteData( struct GDS_Device* Device, const uint8_t* Data,
|
|||||||
bool GDS_I2CInit( int PortNumber, int SDA, int SCL, int Speed ) {
|
bool GDS_I2CInit( int PortNumber, int SDA, int SCL, int Speed ) {
|
||||||
I2CPortNumber = PortNumber;
|
I2CPortNumber = PortNumber;
|
||||||
|
|
||||||
I2CWait = pdMS_TO_TICKS( Speed ? Speed / 4000 : 100 );
|
I2CWait = pdMS_TO_TICKS( Speed ? (250 * 250000) / Speed : 250 );
|
||||||
|
|
||||||
if (SDA != -1 && SCL != -1) {
|
if (SDA != -1 && SCL != -1) {
|
||||||
i2c_config_t Config = { 0 };
|
i2c_config_t Config = { 0 };
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ static void vCallbackFunction( TimerHandle_t xTimer ) {
|
|||||||
bool led_blink_core(int idx, int ontime, int offtime, bool pushed) {
|
bool led_blink_core(int idx, int ontime, int offtime, bool pushed) {
|
||||||
if (!leds[idx].gpio || leds[idx].gpio < 0 ) return false;
|
if (!leds[idx].gpio || leds[idx].gpio < 0 ) return false;
|
||||||
|
|
||||||
ESP_LOGD(TAG,"led_blink_core");
|
ESP_LOGD(TAG,"led_blink_core %d on:%d off:%d, pushed:%u", idx, ontime, offtime, pushed);
|
||||||
if (leds[idx].timer) {
|
if (leds[idx].timer) {
|
||||||
// normal requests waits if a pop is pending
|
// normal requests waits if a pop is pending
|
||||||
if (!pushed && leds[idx].pushed) {
|
if (!pushed && leds[idx].pushed) {
|
||||||
@@ -231,8 +231,7 @@ void led_svc_init(void) {
|
|||||||
#ifndef CONFIG_LED_LOCKED
|
#ifndef CONFIG_LED_LOCKED
|
||||||
parse_set_GPIO(set_led_gpio);
|
parse_set_GPIO(set_led_gpio);
|
||||||
#endif
|
#endif
|
||||||
ESP_LOGI(TAG,"Configuring LEDs green:%d (active:%d %d%%), red:%d (active:%d %d%%)", green.gpio, green.active, green.pwm, green.gpio, green.active, green.pwm );
|
|
||||||
|
|
||||||
char *nvs_item = config_alloc_get(NVS_TYPE_STR, "led_brightness"), *p;
|
char *nvs_item = config_alloc_get(NVS_TYPE_STR, "led_brightness"), *p;
|
||||||
if (nvs_item) {
|
if (nvs_item) {
|
||||||
if ((p = strcasestr(nvs_item, "green")) != NULL) green.pwm = atoi(strchr(p, '=') + 1);
|
if ((p = strcasestr(nvs_item, "green")) != NULL) green.pwm = atoi(strchr(p, '=') + 1);
|
||||||
@@ -242,4 +241,6 @@ void led_svc_init(void) {
|
|||||||
|
|
||||||
led_config(LED_GREEN, green.gpio, green.active, green.pwm);
|
led_config(LED_GREEN, green.gpio, green.active, green.pwm);
|
||||||
led_config(LED_RED, red.gpio, red.active, red.pwm);
|
led_config(LED_RED, red.gpio, red.active, red.pwm);
|
||||||
|
|
||||||
|
ESP_LOGI(TAG,"Configuring LEDs green:%d (active:%d %d%%), red:%d (active:%d %d%%)", green.gpio, green.active, green.pwm, red.gpio, red.active, red.pwm );
|
||||||
}
|
}
|
||||||
|
|||||||
10
components/squeezelite/external/dac_external.c
vendored
10
components/squeezelite/external/dac_external.c
vendored
@@ -128,12 +128,12 @@ static esp_err_t i2c_write_reg(uint8_t reg, uint8_t val) {
|
|||||||
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
|
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
|
||||||
i2c_master_start(cmd);
|
i2c_master_start(cmd);
|
||||||
|
|
||||||
i2c_master_write_byte(cmd, i2c_addr | I2C_MASTER_WRITE, I2C_MASTER_NACK);
|
i2c_master_write_byte(cmd, (i2c_addr << 1) | I2C_MASTER_WRITE, I2C_MASTER_NACK);
|
||||||
i2c_master_write_byte(cmd, reg, I2C_MASTER_NACK);
|
i2c_master_write_byte(cmd, reg, I2C_MASTER_NACK);
|
||||||
i2c_master_write_byte(cmd, val, I2C_MASTER_NACK);
|
i2c_master_write_byte(cmd, val, I2C_MASTER_NACK);
|
||||||
|
|
||||||
i2c_master_stop(cmd);
|
i2c_master_stop(cmd);
|
||||||
ret = i2c_master_cmd_begin(i2c_port, cmd, 1000 / portTICK_RATE_MS);
|
ret = i2c_master_cmd_begin(i2c_port, cmd, 100 / portTICK_RATE_MS);
|
||||||
i2c_cmd_link_delete(cmd);
|
i2c_cmd_link_delete(cmd);
|
||||||
|
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
@@ -153,15 +153,15 @@ static uint8_t i2c_read_reg(uint8_t reg) {
|
|||||||
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
|
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
|
||||||
i2c_master_start(cmd);
|
i2c_master_start(cmd);
|
||||||
|
|
||||||
i2c_master_write_byte(cmd, i2c_addr | I2C_MASTER_WRITE, I2C_MASTER_NACK);
|
i2c_master_write_byte(cmd, (i2c_addr << 1) | I2C_MASTER_WRITE, I2C_MASTER_NACK);
|
||||||
i2c_master_write_byte(cmd, reg, I2C_MASTER_NACK);
|
i2c_master_write_byte(cmd, reg, I2C_MASTER_NACK);
|
||||||
|
|
||||||
i2c_master_start(cmd);
|
i2c_master_start(cmd);
|
||||||
i2c_master_write_byte(cmd, i2c_addr | I2C_MASTER_READ, I2C_MASTER_NACK);
|
i2c_master_write_byte(cmd, (i2c_addr << 1) | I2C_MASTER_READ, I2C_MASTER_NACK);
|
||||||
i2c_master_read_byte(cmd, &data, I2C_MASTER_NACK);
|
i2c_master_read_byte(cmd, &data, I2C_MASTER_NACK);
|
||||||
|
|
||||||
i2c_master_stop(cmd);
|
i2c_master_stop(cmd);
|
||||||
ret = i2c_master_cmd_begin(i2c_port, cmd, 1000 / portTICK_RATE_MS);
|
ret = i2c_master_cmd_begin(i2c_port, cmd, 100 / portTICK_RATE_MS);
|
||||||
i2c_cmd_link_delete(cmd);
|
i2c_cmd_link_delete(cmd);
|
||||||
|
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
|
|||||||
@@ -253,6 +253,10 @@ void process_received_data(const char * buffer, size_t size){
|
|||||||
if(bMirrorToUART){
|
if(bMirrorToUART){
|
||||||
write(uart_fd, command, size);
|
write(uart_fd, command, size);
|
||||||
}
|
}
|
||||||
|
for(int i=strlen(command);i>=0;i--){
|
||||||
|
// strip any cr/lf
|
||||||
|
if(command[i]== '\n' || command[i]== '\r') command[i]= '\0';
|
||||||
|
}
|
||||||
run_command((char *)command);
|
run_command((char *)command);
|
||||||
}
|
}
|
||||||
free(command);
|
free(command);
|
||||||
|
|||||||
@@ -462,7 +462,11 @@ cJSON * wifi_manager_get_basic_info(cJSON **old){
|
|||||||
cJSON_AddNumberToObject(root,"Voltage", battery_value_svc());
|
cJSON_AddNumberToObject(root,"Voltage", battery_value_svc());
|
||||||
cJSON_AddNumberToObject(root,"disconnect_count", num_disconnect );
|
cJSON_AddNumberToObject(root,"disconnect_count", num_disconnect );
|
||||||
cJSON_AddNumberToObject(root,"avg_conn_time", num_disconnect>0?(total_connected_time/num_disconnect):0 );
|
cJSON_AddNumberToObject(root,"avg_conn_time", num_disconnect>0?(total_connected_time/num_disconnect):0 );
|
||||||
|
#if CONFIG_I2C_LOCKED
|
||||||
|
cJSON_AddTrueToObject(root, "is_i2c_locked");
|
||||||
|
#else
|
||||||
|
cJSON_AddFalseToObject(root, "is_i2c_locked");
|
||||||
|
#endif
|
||||||
ESP_LOGV(TAG, "wifi_manager_get_basic_info done");
|
ESP_LOGV(TAG, "wifi_manager_get_basic_info done");
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ menu "Squeezelite-ESP32"
|
|||||||
string
|
string
|
||||||
default "model=TAS57xx,bck=33,ws=25,do=32,sda=27,scl=26,mute=14:0" if SQUEEZEAMP
|
default "model=TAS57xx,bck=33,ws=25,do=32,sda=27,scl=26,mute=14:0" if SQUEEZEAMP
|
||||||
default "model=AC101,bck=27,ws=26,do=25,di=35,sda=33,scl=32" if A1S
|
default "model=AC101,bck=27,ws=26,do=25,di=35,sda=33,scl=32" if A1S
|
||||||
default "model=I2S,bck=26,ws=25,do=33,i2c=106,sda=21,scl=22" if TWATCH2020
|
default "model=I2S,bck=26,ws=25,do=33,i2c=53,sda=21,scl=22" if TWATCH2020
|
||||||
default ""
|
default ""
|
||||||
config SPDIF_CONFIG
|
config SPDIF_CONFIG
|
||||||
string
|
string
|
||||||
|
|||||||
@@ -447,7 +447,7 @@ void app_main()
|
|||||||
|
|
||||||
/* start the wifi manager */
|
/* start the wifi manager */
|
||||||
ESP_LOGD(TAG,"Blinking led");
|
ESP_LOGD(TAG,"Blinking led");
|
||||||
led_blink(LED_GREEN, 250, 250);
|
led_blink_pushed(LED_GREEN, 250, 250);
|
||||||
|
|
||||||
if(bypass_wifi_manager){
|
if(bypass_wifi_manager){
|
||||||
ESP_LOGW(TAG,"*******************************************************************************************");
|
ESP_LOGW(TAG,"*******************************************************************************************");
|
||||||
|
|||||||
Reference in New Issue
Block a user