@@ -79,9 +79,9 @@ int get_audio_volume() {
79
79
80
80
static esp_err_t i2s_driver_init (void )
81
81
{
82
- printf (" initializing i2s driver...\n " );
82
+ fmt::print (" initializing i2s driver...\n " );
83
83
auto ret_val = ESP_OK;
84
- printf (" Using newer I2S standard\n " );
84
+ fmt::print (" Using newer I2S standard\n " );
85
85
i2s_chan_config_t chan_cfg = I2S_CHANNEL_DEFAULT_CONFIG (i2s_port, I2S_ROLE_MASTER);
86
86
chan_cfg.auto_clear = true ; // Auto clear the legacy data in the DMA buffer
87
87
ESP_ERROR_CHECK (i2s_new_channel (&chan_cfg, &tx_handle, &rx_handle));
@@ -114,7 +114,7 @@ static esp_err_t i2s_driver_init(void)
114
114
// es7210 is for audio input codec
115
115
static esp_err_t es7210_init_default (void )
116
116
{
117
- printf (" initializing es7210 codec...\n " );
117
+ fmt::print (" initializing es7210 codec...\n " );
118
118
esp_err_t ret_val = ESP_OK;
119
119
audio_hal_codec_config_t cfg;
120
120
memset (&cfg, 0 , sizeof (cfg));
@@ -131,7 +131,7 @@ static esp_err_t es7210_init_default(void)
131
131
ret_val |= es7210_adc_ctrl_state (cfg.codec_mode , AUDIO_HAL_CTRL_START);
132
132
133
133
if (ESP_OK != ret_val) {
134
- printf (" Failed initialize codec\n " );
134
+ fmt::print (" Failed initialize codec\n " );
135
135
}
136
136
137
137
return ret_val;
@@ -140,7 +140,7 @@ static esp_err_t es7210_init_default(void)
140
140
// es8311 is for audio output codec
141
141
static esp_err_t es8311_init_default (void )
142
142
{
143
- printf (" initializing es8311 codec...\n " );
143
+ fmt::print (" initializing es8311 codec...\n " );
144
144
esp_err_t ret_val = ESP_OK;
145
145
audio_hal_codec_config_t cfg;
146
146
memset (&cfg, 0 , sizeof (cfg));
@@ -158,7 +158,7 @@ static esp_err_t es8311_init_default(void)
158
158
ret_val |= es8311_codec_ctrl_state (cfg.codec_mode , AUDIO_HAL_CTRL_START);
159
159
160
160
if (ESP_OK != ret_val) {
161
- printf (" Failed initialize codec\n " );
161
+ fmt::print (" Failed initialize codec\n " );
162
162
}
163
163
164
164
return ret_val;
@@ -212,10 +212,10 @@ static void init_mute_button(void) {
212
212
.callback = [](auto &m, auto &cv) -> bool {
213
213
static gpio_num_t io_num;
214
214
if (xQueueReceive (gpio_evt_queue, &io_num, portMAX_DELAY)) {
215
- // invert the state since these are active low switches
216
- bool pressed = !gpio_get_level (io_num);
217
215
// see if it's the mute button
218
216
if (io_num == mute_pin) {
217
+ // invert the state since these are active low switches
218
+ bool pressed = !gpio_get_level (io_num);
219
219
// NOTE: the MUTE is actually connected to a flip-flop which holds
220
220
// state, so pressing it actually toggles the state that we see on
221
221
// the ESP pin. Therefore, when we get an edge trigger, we should
@@ -251,7 +251,7 @@ void audio_init() {
251
251
252
252
/* Checko IO config result */
253
253
if (ESP_OK != bsp_io_config_state) {
254
- printf (" Failed initialize power control IO\n " );
254
+ fmt::print (" Failed initialize power control IO\n " );
255
255
}
256
256
257
257
gpio_set_level (sound_power_pin, 1 );
@@ -282,9 +282,9 @@ void audio_play_frame(uint8_t *data, uint32_t num_bytes) {
282
282
auto err = ESP_OK;
283
283
err = i2s_channel_write (tx_handle, data, num_bytes, &bytes_written, 1000 );
284
284
if (num_bytes != bytes_written) {
285
- printf (" ERROR to write %ld != written %d \n " , num_bytes, bytes_written);
285
+ fmt::print (" ERROR to write {} != written {} \n " , num_bytes, bytes_written);
286
286
}
287
287
if (err != ESP_OK) {
288
- printf (" ERROR writing i2s channel: %d , '%s '\n " , err, esp_err_to_name (err));
288
+ fmt::print (" ERROR writing i2s channel: {} , '{} '\n " , err, esp_err_to_name (err));
289
289
}
290
290
}
0 commit comments