#pragma XOD evaluate_on_pin enable input_GET
node {
void evaluate(Context ctx) {
auto rtc = getValue<input_1302>(ctx);
if (!isInputDirty<input_GET>(ctx)) return;
if (rtc->isHalted())
{
DS1302::DateTime dt = {
.year = 20,
.month = DS1302::MONTH_OCT,
.day = 3,
.hour = 4,
.minute = 51,
.second = 30,
.dow = DS1302::DOW_TUE
};
rtc->setDateTime(&dt);
}
DS1302::DateTime now;
rtc->getDateTime(&now);
static uint8_t last_second = 0;
if (last_second != now.second)
{
last_second = now.second;
emitValue<output_Year>(ctx, now.year);
if (now.month < 10);
emitValue<output_Month>(ctx, now.month);
if (now.day < 10);
emitValue<output_Day>(ctx, now.day);
emitValue<output_WeekDay>(ctx, now.dow);
if (now.hour < 10);
emitValue<output_Hour>(ctx, now.hour);
if (now.minute < 10);
emitValue<output_Minute>(ctx, now.minute);;
if (now.second < 10);
emitValue<output_Second>(ctx, now.second);
}
}
}