This commit is contained in:
reaw55 2024-04-01 22:20:26 +07:00
parent 7e0e06f335
commit 978cf36e1e
2 changed files with 22 additions and 2 deletions

View file

@ -346,6 +346,27 @@ void loop()
iseDisplay.updateDateTimeText(time);
last_time_updated = millis();
}
// Send out analog Data every 6 seconds
static uint32_t last_analog_sent = 0;
if (millis() - last_analog_sent > 6000)
{
espmega.iot->publish("/debug/up", "1");
if (analogCardAvailable || CT_FORCE_ENABLE)
{
espmega.iot->publish("/debug/log", "Sending Analog Card Data");
char topic_buffer[50];
char payload_buffer[50];
// Publish ADC Pin 0-7
for (uint8_t i = 0; i < 8; i++)
{
sprintf(topic_buffer, "/debug/analog/%d", i);
sprintf(payload_buffer, "%d", analogCard.analogRead(i));
espmega.iot->publish(topic_buffer, payload_buffer);
}
}
last_analog_sent = millis();
}
}
void on_pin_change(uint8_t pin, uint8_t value)

View file

@ -25,9 +25,8 @@ SET_LOOP_TASK_STACK_SIZE(32*1024);
#define AIR_CONDITIONER_YORK_IR_PIN 15
#define AIR_CONDITIONER_RMT_CHANNEL0 RMT_CHANNEL_0
#define AIR_CONDITIONER_RMT_CHANNEL1 RMT_CHANNEL_1
// CT Configuration
#define CT_FORCE_ENABLE false
#define CT_FORCE_ENABLE true
#define CT_RMS_VOLTAGE 1.0
#define CT_PIN_LIGHT_PHASE1 0
#define CT_PIN_LIGHT_PHASE2 1