NVS Refactor ** Factory+Squeezelite FLASH required for this branch!

This is a major refactoring of the nvs parameters storage. To support
this, a new partition was added. To start using this branch, one must
flash all binaries and possibly re-configure the system.
This commit is contained in:
Sebastien
2019-10-03 14:15:59 -04:00
parent 725636e0c4
commit b6f1ce9a7a
22 changed files with 168 additions and 196 deletions

View File

@@ -269,29 +269,27 @@ void raop_sink_cmd_handler(raop_event_t event, void *param)
* We provide the generic codec register option
*/
void register_external(void) {
#ifdef CONFIG_BT_SINK
if (!strcasestr(output.device, "BT ")) {
bt_sink_init(bt_sink_cmd_handler, sink_data_handler);
LOG_INFO("Initializing BT sink");
if (!strcasestr(output.device, "BT ") ) {
if(enable_bt_sink){
bt_sink_init(bt_sink_cmd_handler, sink_data_handler);
LOG_INFO("Initializing BT sink");
}
} else {
LOG_WARN("Cannot be a BT sink and source");
}
#endif
#ifdef CONFIG_AIRPLAY_SINK
raop_sink_init(raop_sink_cmd_handler, raop_sink_data_handler);
LOG_INFO("Initializing AirPlay sink");
#endif
if(enable_airplay){
raop_sink_init(raop_sink_cmd_handler, raop_sink_data_handler);
LOG_INFO("Initializing AirPlay sink");
}
}
void deregister_external(void) {
#ifdef CONFIG_BT_SINK
if (!strcasestr(output.device, "BT ")) {
if (!strcasestr(output.device, "BT ") && enable_bt_sink) {
bt_sink_deinit();
LOG_INFO("Stopping BT sink");
}
#endif
#ifdef CONFIG_AIRPLAY_SINK
raop_sink_deinit();
LOG_INFO("Stopping AirPlay sink");
#endif
if(enable_airplay){
raop_sink_deinit();
LOG_INFO("Stopping AirPlay sink");
}
}

View File

@@ -1,6 +1,6 @@
#ifndef EMBEDDED_H
#define EMBEDDED_H
#include "esp_system.h"
#include <inttypes.h>
/* must provide
@@ -41,7 +41,10 @@ uint32_t _gettime_ms_(void);
int pthread_create_name(pthread_t *thread, _CONST pthread_attr_t *attr,
void *(*start_routine)( void * ), void *arg, char *name);
// these are here as they can be #define to nothing
// these are here as they can be #define to nothing
extern bool enable_bt_sink;
extern bool enable_airplay;
void register_external(void);
void deregister_external(void);

View File

@@ -109,6 +109,7 @@ extern struct outputstate output;
extern struct buffer *streambuf;
extern struct buffer *outputbuf;
extern u8_t *silencebuf;
extern bool jack_mutes_amp;
static log_level loglevel;
static bool running, isI2SStarted;
@@ -433,7 +434,9 @@ static void *output_thread_i2s() {
TIME_MEASUREMENT_START(timer_start);
LOCK;
if(jack_mutes_amp){
// todo: implement some muting logic
}
// manage led display
if (state != output.state) {
LOG_INFO("Output state is %d", output.state);