-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhydroshelf.ino
49 lines (39 loc) · 1.45 KB
/
hydroshelf.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "M5Atom.h"
#include "WiFi.h"
#include "config.hpp"
#include "src/helper.hpp"
#include "src/light_controller.hpp"
#include "src/matrix_display.hpp"
#include "src/time_manager.hpp"
using namespace hydroshelf;
constexpr schedule_t lightSchedule{{{00.0F, offLightLevel, EScheduleTransition::STEP},
{07.5F, minLightLevel, EScheduleTransition::STEP},
{08.0F, maxLightLevel, EScheduleTransition::LINEAR},
{18.0F, maxLightLevel, EScheduleTransition::STEP},
{19.0F, minLightLevel, EScheduleTransition::LINEAR},
{23.0F, minLightLevel, EScheduleTransition::STEP},
{24.0F, offLightLevel, EScheduleTransition::STEP}}};
CMatrixDisplay disp{};
CTimedController lightCtrl{lightSchedule};
CTimeManager timeMgr{};
void setup()
{
M5.begin(true, true, true);
disp.fillColor(ColorYellow);
disp.show();
disp.fillBlack();
}
void loop()
{
M5.update();
const float hourOfDay = timeMgr.getTimeOfDayHour();
const float lightLevel = lightCtrl.update(hourOfDay);
disp.drawProgressBarTwoLines(ColorYellow, lightLevel, 0);
disp.showWaitBar(ColorGreen, timeMgr.getTimeOfDaySec(), 4);
disp.show();
Serial.print("time = ");
Serial.print(hourOfDay);
Serial.print(", light = ");
Serial.println(lightLevel);
delay(300);
}