From 4485cb97bf9d62b5275f689fef488db13d0bf6e9 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 26 Jan 2024 02:48:59 -0800 Subject: [PATCH 1/3] fixes for vl receiver and old chromadeck temp changes --- VortexEngine/src/Buttons/Buttons.cpp | 6 +- VortexEngine/src/Leds/Leds.cpp | 5 +- VortexEngine/src/Menus/MainMenu.cpp | 5 ++ VortexEngine/src/Menus/MainMenu.h | 1 + .../src/Menus/MenuList/EditorConnection.cpp | 68 ++++++++++++++++++- .../src/Menus/MenuList/EditorConnection.h | 8 +++ VortexEngine/src/VortexConfig.h | 5 ++ VortexEngine/src/VortexEngine.cpp | 3 + VortexEngine/src/Wireless/VLReceiver.cpp | 43 ++++++------ VortexEngine/src/Wireless/VLReceiver.h | 2 +- 10 files changed, 116 insertions(+), 30 deletions(-) diff --git a/VortexEngine/src/Buttons/Buttons.cpp b/VortexEngine/src/Buttons/Buttons.cpp index ed9b3177cc..166b21a226 100644 --- a/VortexEngine/src/Buttons/Buttons.cpp +++ b/VortexEngine/src/Buttons/Buttons.cpp @@ -27,9 +27,9 @@ Button Buttons::m_buttons[NUM_BUTTONS]; bool Buttons::init() { // initialize the button on pins 9/10/11 - if (!m_buttons[0].init(5) || - !m_buttons[1].init(6) || - !m_buttons[2].init(7)) { + if (!m_buttons[0].init(9) || + !m_buttons[1].init(10) || + !m_buttons[2].init(11)) { return false; } g_pButtonL = &m_buttons[0]; diff --git a/VortexEngine/src/Leds/Leds.cpp b/VortexEngine/src/Leds/Leds.cpp index 7e1d1c6a2a..caae18f42d 100644 --- a/VortexEngine/src/Leds/Leds.cpp +++ b/VortexEngine/src/Leds/Leds.cpp @@ -15,7 +15,8 @@ #ifdef VORTEX_EMBEDDED #pragma GCC diagnostic ignored "-Wclass-memaccess" #include -#define LED_PIN 0 +#define LED_PIN 4 +#define MOSFET_PIN 18 #endif // global brightness @@ -28,6 +29,8 @@ bool Leds::init() #ifdef VORTEX_EMBEDDED FastLED.addLeds((CRGB *)m_ledColors, LED_COUNT); FastLED.setMaxRefreshRate(0); + pinMode(MOSFET_PIN, OUTPUT); + digitalWrite(MOSFET_PIN, HIGH); #endif #ifdef VORTEX_LIB Vortex::vcallbacks()->ledsInit(m_ledColors, LED_COUNT); diff --git a/VortexEngine/src/Menus/MainMenu.cpp b/VortexEngine/src/Menus/MainMenu.cpp index 30bc7dbd06..cf2246eef4 100644 --- a/VortexEngine/src/Menus/MainMenu.cpp +++ b/VortexEngine/src/Menus/MainMenu.cpp @@ -70,6 +70,11 @@ void MainMenu::open() m_isOpen = true; } +void MainMenu::close() +{ + m_isOpen = false; +} + bool MainMenu::isOpen() { return m_isOpen; diff --git a/VortexEngine/src/Menus/MainMenu.h b/VortexEngine/src/Menus/MainMenu.h index cb61340a02..5d819446b8 100644 --- a/VortexEngine/src/Menus/MainMenu.h +++ b/VortexEngine/src/Menus/MainMenu.h @@ -12,6 +12,7 @@ class MainMenu // open the main menu static void open(); + static void close(); static bool isOpen(); private: static void pressLeft(); diff --git a/VortexEngine/src/Menus/MenuList/EditorConnection.cpp b/VortexEngine/src/Menus/MenuList/EditorConnection.cpp index 5bc87c50a9..4afc4878bf 100644 --- a/VortexEngine/src/Menus/MenuList/EditorConnection.cpp +++ b/VortexEngine/src/Menus/MenuList/EditorConnection.cpp @@ -5,7 +5,9 @@ #include "../../Serial/Serial.h" #include "../../Storage/Storage.h" #include "../../Wireless/VLSender.h" +#include "../../Wireless/VLReceiver.h" #include "../../Time/TimeControl.h" +#include "../../Time/Timings.h" #include "../../Colors/Colorset.h" #include "../../Modes/Modes.h" #include "../../Modes/Mode.h" @@ -16,7 +18,8 @@ EditorConnection::EditorConnection(const RGBColor &col, bool advanced) : Menu(col, advanced), - m_state(STATE_DISCONNECTED) + m_state(STATE_DISCONNECTED), + m_timeOutStartTime(0) { } @@ -182,6 +185,16 @@ Menu::MenuAction EditorConnection::run() SerialComs::write(EDITOR_VERB_TRANSMIT_VL_ACK); m_state = STATE_IDLE; break; + case STATE_LISTEN_MODE_VL: + showReceiveModeVL(); + receiveModeVL(); + break; + case STATE_LISTEN_MODE_VL_DONE: + // done transmitting + m_receiveBuffer.clear(); + SerialComs::write(EDITOR_VERB_LISTEN_VL_ACK); + m_state = STATE_IDLE; + break; } return MENU_CONTINUE; } @@ -196,6 +209,57 @@ void EditorConnection::sendCurModeVL() m_state = STATE_TRANSMIT_MODE_VL; } +void EditorConnection::listenModeVL() +{ +#if VL_ENABLE_SENDER == 1 + // immediately load the mode and send it now + VLReceiver::beginReceiving(); +#endif + m_state = STATE_LISTEN_MODE_VL; +} + +void EditorConnection::receiveModeVL() +{ + // if reveiving new data set our last data time + if (VLReceiver::onNewData()) { + m_timeOutStartTime = Time::getCurtime(); + // if our last data was more than time out duration reset the recveiver + } else if (m_timeOutStartTime > 0 && (m_timeOutStartTime + MAX_TIMEOUT_DURATION) < Time::getCurtime()) { + VLReceiver::resetVLState(); + m_timeOutStartTime = 0; + return; + } + // check if the VLReceiver has a full packet available + if (!VLReceiver::dataReady()) { + // nothing available yet + return; + } + DEBUG_LOG("Mode ready to receive! Receiving..."); + // receive the VL mode into the current mode + if (!VLReceiver::receiveMode(&m_previewMode)) { + ERROR_LOG("Failed to receive mode"); + return; + } + DEBUG_LOGF("Success receiving mode: %u", m_previewMode.getPatternID()); + Modes::updateCurMode(&m_previewMode); + ByteStream modeBuffer; + m_previewMode.saveToBuffer(modeBuffer); + SerialComs::write(modeBuffer); + m_state = STATE_LISTEN_MODE_VL_DONE; +} + +void EditorConnection::showReceiveModeVL() +{ + if (VLReceiver::isReceiving()) { + // using uint32_t to avoid overflow, the result should be within 10 to 255 + //Leds::setAll(RGBColor(0, VLReceiver::percentReceived(), 0)); + Leds::setRange(LED_0, (LedPos)(VLReceiver::percentReceived() / 10), RGB_GREEN6); + Leds::setRange(LED_10, (LedPos)(LED_10 + (VLReceiver::percentReceived() / 10)), RGB_GREEN6); + } else { + Leds::setAll(RGB_WHITE0); + } +} + // handlers for clicks void EditorConnection::onShortClick() { @@ -321,5 +385,7 @@ void EditorConnection::handleCommand() m_state = STATE_CLEAR_DEMO; } else if (receiveMessage(EDITOR_VERB_TRANSMIT_VL)) { sendCurModeVL(); + } else if (receiveMessage(EDITOR_VERB_LISTEN_VL)) { + listenModeVL(); } } diff --git a/VortexEngine/src/Menus/MenuList/EditorConnection.h b/VortexEngine/src/Menus/MenuList/EditorConnection.h index 56235ee432..0be3555145 100644 --- a/VortexEngine/src/Menus/MenuList/EditorConnection.h +++ b/VortexEngine/src/Menus/MenuList/EditorConnection.h @@ -17,6 +17,7 @@ class EditorConnection : public Menu // broadcast the current preview mode over VL void sendCurModeVL(); + void listenModeVL(); // handlers for clicks void onShortClick() override; @@ -34,6 +35,8 @@ class EditorConnection : public Menu void handleCommand(); bool receiveMessage(const char *message); void clearDemo(); + void receiveModeVL(); + void showReceiveModeVL(); enum EditorConnectionState { // the editor is not connec @@ -66,12 +69,17 @@ class EditorConnection : public Menu // transmit the mode over visible light STATE_TRANSMIT_MODE_VL, STATE_TRANSMIT_MODE_VL_DONE, + + STATE_LISTEN_MODE_VL, + STATE_LISTEN_MODE_VL_DONE, }; // state of the editor EditorConnectionState m_state; // the data that is received ByteStream m_receiveBuffer; + // receiver timeout + uint32_t m_timeOutStartTime; }; #endif diff --git a/VortexEngine/src/VortexConfig.h b/VortexEngine/src/VortexConfig.h index 47aba8cd1e..e8c6a5960d 100644 --- a/VortexEngine/src/VortexConfig.h +++ b/VortexEngine/src/VortexConfig.h @@ -501,6 +501,11 @@ // the response from the device when it's done transmitting the mode #define EDITOR_VERB_TRANSMIT_VL_ACK "n" +// when the pc wants the chromadeck to listen for a mode from the duos +#define EDITOR_VERB_LISTEN_VL "o" +// and the response for when it's done fetching a duo mode +#define EDITOR_VERB_LISTEN_VL_ACK "p" + // =================================================================== // Manually Configured Sizes // diff --git a/VortexEngine/src/VortexEngine.cpp b/VortexEngine/src/VortexEngine.cpp index 1c9b9847f3..8abc4a56e2 100644 --- a/VortexEngine/src/VortexEngine.cpp +++ b/VortexEngine/src/VortexEngine.cpp @@ -88,6 +88,9 @@ bool VortexEngine::init() return false; } + MainMenu::close(); + Menus::openMenu(MENU_MODE_SHARING); + #if COMPRESSION_TEST == 1 compressionTest(); #endif diff --git a/VortexEngine/src/Wireless/VLReceiver.cpp b/VortexEngine/src/Wireless/VLReceiver.cpp index c163b1580f..0d9cff2624 100644 --- a/VortexEngine/src/Wireless/VLReceiver.cpp +++ b/VortexEngine/src/Wireless/VLReceiver.cpp @@ -20,36 +20,31 @@ uint32_t VLReceiver::m_previousBytes = 0; #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "driver/adc.h" +#include "esp_adc_cal.h" #include "esp_log.h" #include "esp_timer.h" #include "../Serial/Serial.h" // ADC and timer configuration -#define ADC_CHANNEL ADC1_CHANNEL_1 // Update this based on the actual ADC channel used -#define TIMER_INTERVAL_MICRO_SEC 10000 // Check every 10ms, adjust as needed for your application +#define ADC_CHANNEL ADC1_CHANNEL_4 // Update this based on the actual ADC channel used +#define TIMER_INTERVAL_MICRO_SEC 100 // Check every 10ms, adjust as needed for your application // Timer handle as a global variable for control in beginReceiving and endReceiving esp_timer_handle_t periodic_timer = nullptr; +esp_adc_cal_characteristics_t adc_chars; #define MIN_THRESHOLD 200 #define BASE_OFFSET 100 #define THRESHOLD_BEGIN (MIN_THRESHOLD + BASE_OFFSET) -// the sample count exponent, so 5 means 2^5 = 32 samples -// 0 NONE No accumulation > doesn't work -// 1 ACC2 2 results accumulated > doesn't work -// 2 ACC4 4 results accumulated > works okay -// 3 ACC8 8 results accumulated > works decent -// 4 ACC16 16 results accumulated > works very well -// 5 ACC32 32 results accumulated > works best -// 6 ACC64 64 results accumulated > doesn't work -#define SAMPLE_COUNT 5 // the threshold needs to start high then it will be automatically pulled down uint32_t threshold = THRESHOLD_BEGIN; void VLReceiver::adcCheckTimerCallback(void *arg) { static bool wasAboveThreshold = false; - uint32_t val = adc1_get_raw(ADC_CHANNEL); + uint32_t raw = adc1_get_raw(ADC_CHANNEL); + uint32_t val = esp_adc_cal_raw_to_voltage(raw, &adc_chars); + if (val > MIN_THRESHOLD && val < (threshold + BASE_OFFSET)) { threshold = val + BASE_OFFSET; } @@ -67,6 +62,7 @@ bool VLReceiver::init() // Initialize ADC for GPIO1 (or appropriate pin connected to your light sensor) adc1_config_width(ADC_WIDTH_BIT_12); adc1_config_channel_atten(ADC_CHANNEL, ADC_ATTEN_DB_0); + esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_0, ADC_WIDTH_BIT_12, 0, &adc_chars); #endif return m_vlData.init(VL_RECV_BUF_SIZE); } @@ -134,16 +130,15 @@ bool VLReceiver::receiveMode(Mode *pMode) bool VLReceiver::beginReceiving() { #ifdef VORTEX_EMBEDDED - if (periodic_timer != nullptr) { + if (periodic_timer) { DEBUG_LOG("VL Reception already running."); return false; // Timer is already running } // Initialize timer for periodic ADC checks const esp_timer_create_args_t periodic_timer_args = { - .callback = (void (*)(void*))&VLReceiver::adcCheckTimerCallback, - .name = "adc_check_timer" + .callback = &VLReceiver::adcCheckTimerCallback, + .name = "adc_check_timer", }; - esp_timer_handle_t periodic_timer; ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args, &periodic_timer)); ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, TIMER_INTERVAL_MICRO_SEC)); #endif @@ -213,17 +208,17 @@ void VLReceiver::recvPCIHandler() // check previous time for validity if (!m_prevTime || m_prevTime > now) { m_prevTime = now; - DEBUG_LOG("Bad first time diff, resetting..."); + //DEBUG_LOG("Bad first time diff, resetting..."); resetVLState(); return; } - DEBUG_LOGF("Received: %u", m_pinState); + //DEBUG_LOGF("Received: %u", m_pinState); // calc time difference between previous change and now uint32_t diff = (uint32_t)(now - m_prevTime); // and update the previous changetime for next loop m_prevTime = now; // handle the bliank duration and process it - //handleVLTiming(diff); + handleVLTiming(diff); } // state machine that can be fed VL timings to parse them and interpret the intervals @@ -231,7 +226,7 @@ void VLReceiver::handleVLTiming(uint32_t diff) { // if the diff is too long or too short then it's not useful if ((diff > VL_HEADER_MARK_MAX && m_recvState < READING_DATA_MARK) || diff < VL_TIMING_MIN) { - DEBUG_LOGF("bad delay: %u, resetting...", diff); + //DEBUG_LOGF("bad delay: %u, resetting...", diff); resetVLState(); return; } @@ -240,7 +235,7 @@ void VLReceiver::handleVLTiming(uint32_t diff) if (diff >= VL_HEADER_SPACE_MIN && diff <= VL_HEADER_MARK_MAX) { m_recvState = WAITING_HEADER_SPACE; } else { - DEBUG_LOGF("Bad header mark %u, resetting...", diff); + //DEBUG_LOGF("Bad header mark %u, resetting...", diff); resetVLState(); } break; @@ -248,7 +243,7 @@ void VLReceiver::handleVLTiming(uint32_t diff) if (diff >= VL_HEADER_SPACE_MIN && diff <= VL_HEADER_MARK_MAX) { m_recvState = READING_DATA_MARK; } else { - DEBUG_LOGF("Bad header space %u, resetting...", diff); + //DEBUG_LOGF("Bad header space %u, resetting...", diff); resetVLState(); } break; @@ -262,7 +257,7 @@ void VLReceiver::handleVLTiming(uint32_t diff) m_recvState = READING_DATA_MARK; break; default: // ?? - DEBUG_LOGF("Bad receive state: %u", m_recvState); + //DEBUG_LOGF("Bad receive state: %u", m_recvState); break; } } @@ -273,7 +268,7 @@ void VLReceiver::resetVLState() m_recvState = WAITING_HEADER_MARK; // zero out the receive buffer and reset bit receiver position m_vlData.reset(); - DEBUG_LOG("VL State Reset"); + //DEBUG_LOG("VL State Reset"); } #endif diff --git a/VortexEngine/src/Wireless/VLReceiver.h b/VortexEngine/src/Wireless/VLReceiver.h index f9e0e39463..1d7d35628b 100644 --- a/VortexEngine/src/Wireless/VLReceiver.h +++ b/VortexEngine/src/Wireless/VLReceiver.h @@ -78,7 +78,7 @@ class VLReceiver static uint32_t m_previousBytes; #ifdef VORTEX_EMBEDDED - void adcCheckTimerCallback(void *arg); + static void adcCheckTimerCallback(void *arg); #endif #ifdef VORTEX_LIB From 4d14cb2a87d43e3181d9874422e11e209e22bf7e Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 26 Jan 2024 14:32:59 -0800 Subject: [PATCH 2/3] added a line to clear the adc chars --- VortexEngine/src/Wireless/VLReceiver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/VortexEngine/src/Wireless/VLReceiver.cpp b/VortexEngine/src/Wireless/VLReceiver.cpp index 0d9cff2624..3b4eb13f94 100644 --- a/VortexEngine/src/Wireless/VLReceiver.cpp +++ b/VortexEngine/src/Wireless/VLReceiver.cpp @@ -62,6 +62,7 @@ bool VLReceiver::init() // Initialize ADC for GPIO1 (or appropriate pin connected to your light sensor) adc1_config_width(ADC_WIDTH_BIT_12); adc1_config_channel_atten(ADC_CHANNEL, ADC_ATTEN_DB_0); + memset(&adc_chars, 0, sizeof(adc_chars)); esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_0, ADC_WIDTH_BIT_12, 0, &adc_chars); #endif return m_vlData.init(VL_RECV_BUF_SIZE); From 326cd0841923ec421ddbc3c1bac640611a29c4c3 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 2 Feb 2024 00:56:23 -0800 Subject: [PATCH 3/3] fixes for latest chromadeck --- VortexEngine/src/Buttons/Buttons.cpp | 8 ++++---- VortexEngine/src/Leds/Leds.cpp | 5 +---- VortexEngine/src/Modes/Modes.cpp | 6 +++--- VortexEngine/src/VortexEngine.cpp | 3 --- VortexEngine/src/Wireless/IRConfig.h | 4 ++-- VortexEngine/src/Wireless/VLReceiver.cpp | 12 +++++++----- 6 files changed, 17 insertions(+), 21 deletions(-) diff --git a/VortexEngine/src/Buttons/Buttons.cpp b/VortexEngine/src/Buttons/Buttons.cpp index 166b21a226..d1d4b9f1f6 100644 --- a/VortexEngine/src/Buttons/Buttons.cpp +++ b/VortexEngine/src/Buttons/Buttons.cpp @@ -26,10 +26,10 @@ Button Buttons::m_buttons[NUM_BUTTONS]; bool Buttons::init() { - // initialize the button on pins 9/10/11 - if (!m_buttons[0].init(9) || - !m_buttons[1].init(10) || - !m_buttons[2].init(11)) { + // initialize the button on pins 5/6/7 + if (!m_buttons[0].init(5) || + !m_buttons[1].init(6) || + !m_buttons[2].init(7)) { return false; } g_pButtonL = &m_buttons[0]; diff --git a/VortexEngine/src/Leds/Leds.cpp b/VortexEngine/src/Leds/Leds.cpp index caae18f42d..7e1d1c6a2a 100644 --- a/VortexEngine/src/Leds/Leds.cpp +++ b/VortexEngine/src/Leds/Leds.cpp @@ -15,8 +15,7 @@ #ifdef VORTEX_EMBEDDED #pragma GCC diagnostic ignored "-Wclass-memaccess" #include -#define LED_PIN 4 -#define MOSFET_PIN 18 +#define LED_PIN 0 #endif // global brightness @@ -29,8 +28,6 @@ bool Leds::init() #ifdef VORTEX_EMBEDDED FastLED.addLeds((CRGB *)m_ledColors, LED_COUNT); FastLED.setMaxRefreshRate(0); - pinMode(MOSFET_PIN, OUTPUT); - digitalWrite(MOSFET_PIN, HIGH); #endif #ifdef VORTEX_LIB Vortex::vcallbacks()->ledsInit(m_ledColors, LED_COUNT); diff --git a/VortexEngine/src/Modes/Modes.cpp b/VortexEngine/src/Modes/Modes.cpp index d425254ad7..97553d2d2d 100644 --- a/VortexEngine/src/Modes/Modes.cpp +++ b/VortexEngine/src/Modes/Modes.cpp @@ -73,9 +73,9 @@ void Modes::play() nextModeSkipEmpty(); } // shortclick cycles to the next mode - if (g_pButtonM->onShortClick()) { - Menus::openMenuSelection(); - } + //if (g_pButtonM->onShortClick()) { + // Menus::openMenuSelection(); + //} // shortclick cycles to the next mode if (g_pButtonL->onShortClick()) { previousMode(); diff --git a/VortexEngine/src/VortexEngine.cpp b/VortexEngine/src/VortexEngine.cpp index 8abc4a56e2..1c9b9847f3 100644 --- a/VortexEngine/src/VortexEngine.cpp +++ b/VortexEngine/src/VortexEngine.cpp @@ -88,9 +88,6 @@ bool VortexEngine::init() return false; } - MainMenu::close(); - Menus::openMenu(MENU_MODE_SHARING); - #if COMPRESSION_TEST == 1 compressionTest(); #endif diff --git a/VortexEngine/src/Wireless/IRConfig.h b/VortexEngine/src/Wireless/IRConfig.h index a7639d325e..e763b6b17d 100644 --- a/VortexEngine/src/Wireless/IRConfig.h +++ b/VortexEngine/src/Wireless/IRConfig.h @@ -5,8 +5,8 @@ // // Whether to enable the Infrared system as a whole // -#define IR_ENABLE_SENDER 0 -#define IR_ENABLE_RECEIVER 0 +#define IR_ENABLE_SENDER 1 +#define IR_ENABLE_RECEIVER 1 // the size of IR blocks in bits #define IR_DEFAULT_BLOCK_SIZE 32 diff --git a/VortexEngine/src/Wireless/VLReceiver.cpp b/VortexEngine/src/Wireless/VLReceiver.cpp index 3b4eb13f94..aa6c9cab2d 100644 --- a/VortexEngine/src/Wireless/VLReceiver.cpp +++ b/VortexEngine/src/Wireless/VLReceiver.cpp @@ -27,8 +27,10 @@ uint32_t VLReceiver::m_previousBytes = 0; #include "../Serial/Serial.h" // ADC and timer configuration -#define ADC_CHANNEL ADC1_CHANNEL_4 // Update this based on the actual ADC channel used -#define TIMER_INTERVAL_MICRO_SEC 100 // Check every 10ms, adjust as needed for your application +#define ADC_CHANNEL ADC1_CHANNEL_1 // Update this based on the actual ADC channel used +#define ADC_ATTEN ADC_ATTEN_DB_0 +#define ADC_WIDTH ADC_WIDTH_BIT_12 +#define TIMER_INTERVAL_MICRO_SEC 1000 // Check every 10ms, adjust as needed for your application // Timer handle as a global variable for control in beginReceiving and endReceiving esp_timer_handle_t periodic_timer = nullptr; @@ -60,10 +62,10 @@ bool VLReceiver::init() { #ifdef VORTEX_EMBEDDED // Initialize ADC for GPIO1 (or appropriate pin connected to your light sensor) - adc1_config_width(ADC_WIDTH_BIT_12); - adc1_config_channel_atten(ADC_CHANNEL, ADC_ATTEN_DB_0); + adc1_config_width(ADC_WIDTH); + adc1_config_channel_atten(ADC_CHANNEL, ADC_ATTEN); memset(&adc_chars, 0, sizeof(adc_chars)); - esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_0, ADC_WIDTH_BIT_12, 0, &adc_chars); + esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN, ADC_WIDTH, 0, &adc_chars); #endif return m_vlData.init(VL_RECV_BUF_SIZE); }