mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
use system gpio adc
This commit is contained in:
@@ -510,10 +510,10 @@ void System::measure_analog() {
|
|||||||
|
|
||||||
if (!measure_last_ || (uint32_t)(uuid::get_uptime() - measure_last_) >= SYSTEM_MEASURE_ANALOG_INTERVAL) {
|
if (!measure_last_ || (uint32_t)(uuid::get_uptime() - measure_last_) >= SYSTEM_MEASURE_ANALOG_INTERVAL) {
|
||||||
measure_last_ = uuid::get_uptime();
|
measure_last_ = uuid::get_uptime();
|
||||||
#if defined(ESP32)
|
#if defined(EMSESP_STANDALONE)
|
||||||
uint16_t a = analogRead(ADC_CH0_GPIO);
|
uint16_t a = 0;
|
||||||
#else
|
#else
|
||||||
uint16_t a = 0; // standalone
|
uint16_t a = analogReadMilliVolts(ADC1_CHANNEL_0_GPIO_NUM);
|
||||||
#endif
|
#endif
|
||||||
static uint32_t sum_ = 0;
|
static uint32_t sum_ = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,6 @@ class System {
|
|||||||
static constexpr uint32_t SYSTEM_HEARTBEAT_INTERVAL = 60000; // in milliseconds, how often the MQTT heartbeat is sent (1 min)
|
static constexpr uint32_t SYSTEM_HEARTBEAT_INTERVAL = 60000; // in milliseconds, how often the MQTT heartbeat is sent (1 min)
|
||||||
static constexpr uint32_t SYSTEM_MEASURE_ANALOG_INTERVAL = 500;
|
static constexpr uint32_t SYSTEM_MEASURE_ANALOG_INTERVAL = 500;
|
||||||
static constexpr uint8_t LED_ON = HIGH; // LED
|
static constexpr uint8_t LED_ON = HIGH; // LED
|
||||||
static constexpr uint8_t ADC_CH0_GPIO = 36;
|
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
static uuid::syslog::SyslogService syslog_;
|
static uuid::syslog::SyslogService syslog_;
|
||||||
|
|||||||
Reference in New Issue
Block a user