mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-24 13:58:09 +00:00
Next try, plus change cppcheck defines back.
This commit is contained in:
parent
7b378d36cc
commit
631db56a44
@ -59,8 +59,8 @@ lib_deps =
|
|||||||
check_tool = cppcheck
|
check_tool = cppcheck
|
||||||
check_skip_packages = yes
|
check_skip_packages = yes
|
||||||
check_flags =
|
check_flags =
|
||||||
--common-flag
|
-DAPP_VERSION=1.0.0
|
||||||
cppcheck: --enable=--inline-suppr
|
--suppressions-list=suppressions.txt
|
||||||
|
|
||||||
; Common settings for conventional (non Portduino) Arduino targets
|
; Common settings for conventional (non Portduino) Arduino targets
|
||||||
[arduino_base]
|
[arduino_base]
|
||||||
|
@ -42,11 +42,11 @@
|
|||||||
#define AUDIO_MODULE_MODE 7 // 700B
|
#define AUDIO_MODULE_MODE 7 // 700B
|
||||||
#define AUDIO_MODULE_ACK 1
|
#define AUDIO_MODULE_ACK 1
|
||||||
|
|
||||||
|
#if defined(ARCH_ESP32) && defined(USE_SX1280)
|
||||||
|
|
||||||
AudioModule *audioModule;
|
AudioModule *audioModule;
|
||||||
|
|
||||||
#if defined(ARCH_ESP32) && defined(USE_SX1280)
|
|
||||||
ButterworthFilter hp_filter(240, 8000, ButterworthFilter::ButterworthFilter::Highpass, 1);
|
ButterworthFilter hp_filter(240, 8000, ButterworthFilter::ButterworthFilter::Highpass, 1);
|
||||||
#endif
|
|
||||||
|
|
||||||
//int16_t 1KHz sine test tone
|
//int16_t 1KHz sine test tone
|
||||||
int16_t Sine1KHz[8] = { -21210 , -30000, -21210, 0 , 21210 , 30000 , 21210, 0 };
|
int16_t Sine1KHz[8] = { -21210 , -30000, -21210, 0 , 21210 , 30000 , 21210, 0 };
|
||||||
@ -54,11 +54,12 @@ int Sine1KHz_index = 0;
|
|||||||
|
|
||||||
uint8_t rx_raw_audio_value = 127;
|
uint8_t rx_raw_audio_value = 127;
|
||||||
|
|
||||||
AudioModule::AudioModule() : SinglePortModule("AudioModule", PortNum_AUDIO_APP), concurrency::OSThread("AudioModule") {}
|
AudioModule::AudioModule() : SinglePortModule("AudioModule", PortNum_AUDIO_APP), concurrency::OSThread("AudioModule") {
|
||||||
|
audio_fifo.init();
|
||||||
|
}
|
||||||
|
|
||||||
void AudioModule::run_codec2()
|
void AudioModule::run_codec2()
|
||||||
{
|
{
|
||||||
#if defined(ARCH_ESP32) && defined(USE_SX1280)
|
|
||||||
if (state == State::tx)
|
if (state == State::tx)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ADC_BUFFER_SIZE; i++)
|
for (int i = 0; i < ADC_BUFFER_SIZE; i++)
|
||||||
@ -91,7 +92,6 @@ void AudioModule::run_codec2()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
state = State::standby;
|
state = State::standby;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioModule::handleInterrupt()
|
void AudioModule::handleInterrupt()
|
||||||
@ -101,7 +101,6 @@ void AudioModule::handleInterrupt()
|
|||||||
|
|
||||||
void AudioModule::onTimer()
|
void AudioModule::onTimer()
|
||||||
{
|
{
|
||||||
#if defined(ARCH_ESP32) && defined(USE_SX1280)
|
|
||||||
if (state == State::tx) {
|
if (state == State::tx) {
|
||||||
adc_buffer[adc_buffer_index++] = (16 * adc1_get_raw(mic_chan)) - 32768;
|
adc_buffer[adc_buffer_index++] = (16 * adc1_get_raw(mic_chan)) - 32768;
|
||||||
|
|
||||||
@ -129,13 +128,10 @@ void AudioModule::onTimer()
|
|||||||
//Play
|
//Play
|
||||||
dacWrite(moduleConfig.audio.amp_pin ? moduleConfig.audio.amp_pin : AAMP, rx_raw_audio_value);
|
dacWrite(moduleConfig.audio.amp_pin ? moduleConfig.audio.amp_pin : AAMP, rx_raw_audio_value);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t AudioModule::runOnce()
|
int32_t AudioModule::runOnce()
|
||||||
{
|
{
|
||||||
#if defined(ARCH_ESP32) && defined(USE_SX1280)
|
|
||||||
|
|
||||||
if (moduleConfig.audio.codec2_enabled) {
|
if (moduleConfig.audio.codec2_enabled) {
|
||||||
|
|
||||||
if (firstTime) {
|
if (firstTime) {
|
||||||
@ -198,9 +194,6 @@ int32_t AudioModule::runOnce()
|
|||||||
|
|
||||||
return INT32_MAX;
|
return INT32_MAX;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
return INT32_MAX;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshPacket *AudioModule::allocReply()
|
MeshPacket *AudioModule::allocReply()
|
||||||
@ -227,8 +220,6 @@ void AudioModule::sendPayload(NodeNum dest, bool wantReplies)
|
|||||||
|
|
||||||
ProcessMessage AudioModule::handleReceived(const MeshPacket &mp)
|
ProcessMessage AudioModule::handleReceived(const MeshPacket &mp)
|
||||||
{
|
{
|
||||||
#if defined(ARCH_ESP32) && defined(USE_SX1280)
|
|
||||||
|
|
||||||
if (moduleConfig.audio.codec2_enabled) {
|
if (moduleConfig.audio.codec2_enabled) {
|
||||||
auto &p = mp.decoded;
|
auto &p = mp.decoded;
|
||||||
if (getFrom(&mp) != nodeDB.getNodeNum()) {
|
if (getFrom(&mp) != nodeDB.getNodeNum()) {
|
||||||
@ -243,7 +234,7 @@ ProcessMessage AudioModule::handleReceived(const MeshPacket &mp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ProcessMessage::CONTINUE;
|
return ProcessMessage::CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -21,16 +21,16 @@ class AudioModule : public SinglePortModule, private concurrency::OSThread
|
|||||||
#if defined(ARCH_ESP32) && defined(USE_SX1280)
|
#if defined(ARCH_ESP32) && defined(USE_SX1280)
|
||||||
bool firstTime = 1;
|
bool firstTime = 1;
|
||||||
hw_timer_t* adcTimer = NULL;
|
hw_timer_t* adcTimer = NULL;
|
||||||
uint16_t adc_buffer[ADC_BUFFER_SIZE];
|
uint16_t adc_buffer[ADC_BUFFER_SIZE] = {};
|
||||||
int16_t speech[ADC_BUFFER_SIZE];
|
int16_t speech[ADC_BUFFER_SIZE] = {};
|
||||||
int16_t output_buffer[ADC_BUFFER_SIZE];
|
int16_t output_buffer[ADC_BUFFER_SIZE] = {};
|
||||||
unsigned char rx_encode_frame[ENCODE_FRAME_SIZE];
|
unsigned char rx_encode_frame[ENCODE_FRAME_SIZE] = {};
|
||||||
unsigned char tx_encode_frame[ENCODE_FRAME_SIZE];
|
unsigned char tx_encode_frame[ENCODE_FRAME_SIZE] = {};
|
||||||
int tx_encode_frame_index = 0;
|
int tx_encode_frame_index = 0;
|
||||||
FastAudioFIFO audio_fifo;
|
FastAudioFIFO audio_fifo;
|
||||||
uint16_t adc_buffer_index = 0;
|
uint16_t adc_buffer_index = 0;
|
||||||
adc1_channel_t mic_chan = (adc1_channel_t)0;
|
adc1_channel_t mic_chan = (adc1_channel_t)0;
|
||||||
struct CODEC2* codec2_state;
|
struct CODEC2* codec2_state = NULL;
|
||||||
|
|
||||||
enum State
|
enum State
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user