Skip to content

Commit

Permalink
Begin tweaking XasCode for ESP IDF v4.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Xasin committed Oct 12, 2021
1 parent a3d6011 commit 592939c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 8 deletions.
7 changes: 4 additions & 3 deletions ESP32/AudioHandler/AudioTX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,11 @@ void TX::audio_dma_fill_task() {
while(true) {
// As long as we haven't been idling for a while, continue playback.
if(audio_idle_count < 0) {
uint32_t total_written_data = 0;
size_t total_written_data = 0;

while(total_written_data < audio_buffer.size()) {
uint32_t local_written_bytes = 0;
size_t local_written_bytes = 0;

i2s_write(i2s_port, audio_buffer.data()+total_written_data, (audio_buffer.size()-total_written_data)*2, &local_written_bytes, portMAX_DELAY);

total_written_data += local_written_bytes/2;
Expand Down Expand Up @@ -233,7 +234,7 @@ void TX::init(TaskHandle_t processing_task, const i2s_pin_config_t &pin_config)
cfg.sample_rate = CONFIG_XASAUDIO_TX_SAMPLERATE;
cfg.bits_per_sample = i2s_bits_per_sample_t(16);
cfg.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT;
cfg.communication_format = I2S_COMM_FORMAT_I2S_MSB;
cfg.communication_format = I2S_COMM_FORMAT_STAND_I2S;
cfg.intr_alloc_flags = 0;

//uint32_t num_buffer_bytes = XASAUDIO_TX_FRAME_SAMPLE_NO * 2 * CONFIG_XASAUDIO_TX_DMA_COUNT;
Expand Down
8 changes: 7 additions & 1 deletion ESP32/AudioHandler/include/xasin/audio/RX.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

#define XASAUDIO_RX_FRAME_SAMPLE_NO ((CONFIG_XASAUDIO_RX_SAMPLERATE * CONFIG_XASAUDIO_RX_FRAMELENGTH)/1000)

#ifdef I2S_NUM_1
#define XNM_DEFAULT_RX_I2S I2S_NUM_1
#else
#define XNM_DEFAULT_RX_I2S I2S_NUM_0
#endif

namespace Xasin {
namespace Audio {

Expand Down Expand Up @@ -49,7 +55,7 @@ class RX {

void audio_dma_read_task();

RX(uint8_t data_offset = 0, i2s_port_t rx_port = I2S_NUM_1);
RX(uint8_t data_offset = 0, i2s_port_t rx_port = XNM_DEFAULT_RX_I2S);
RX(const RX&) = delete;

// virtual ~RX();
Expand Down
2 changes: 1 addition & 1 deletion ESP32/AudioHandlerV1/AudioHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void AudioHandler::start_thread(const i2s_pin_config_t &pinCFG) {
cfg.sample_rate = samplerate;
cfg.bits_per_sample = i2s_bits_per_sample_t(16);
cfg.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT;
cfg.communication_format = I2S_COMM_FORMAT_I2S_MSB;
cfg.communication_format = I2S_COMM_FORMAT_STAND_I2S;
cfg.intr_alloc_flags = 0;
cfg.dma_buf_count = 2;
cfg.dma_buf_len = 1024;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion ESP32/NeoController/Color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Color Color::HSV(int16_t H, uint8_t S, uint8_t V) {
Color oC = Color();

switch(h) {
default:oC.r = V; oC.g = t; oC.b = p; break;
default:oC.r = V*255; oC.g = t; oC.b = p; break;
case 1: oC.r = q; oC.g = V*255; oC.b = p; break;
case 2: oC.r = p; oC.g = V*255; oC.b = t; break;
case 3: oC.r = p; oC.g = q; oC.b = V*255; break;
Expand Down
3 changes: 2 additions & 1 deletion ESP32/NetHelper/net_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <esp_ota_ops.h>

#include <lwip/apps/sntp.h>
#include <esp_sntp.h>

#include <cstring>

Expand Down Expand Up @@ -341,4 +342,4 @@ void init() {
}

}
}
}
2 changes: 1 addition & 1 deletion ESP32/NetHelper/wifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void config_sta() {
if(CONFIG_XNM_WIFI_PSMODE >= 2)
sta_cfg->listen_interval = 10;

esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_cfg);
esp_wifi_set_config(WIFI_IF_STA, &wifi_cfg);
}

/*void config_ap() {
Expand Down

0 comments on commit 592939c

Please sign in to comment.