@@ -14,14 +14,30 @@ Force::Force(String ver) {
1414 library_version = ver;
1515}
1616
17+ // ///////////////////////////////////////////////////////////////////////
18+ // RTC Functions
19+ // ///////////////////////////////////////////////////////////////////////
20+ RTC_PCF8523 rtc;
21+
22+ void dateTime (uint16_t * date, uint16_t * time) {
23+ DateTime now = rtc.now ();
24+ // return date using FAT_DATE macro to format fields
25+ *date = FAT_DATE (now.year (), now.month (), now.day ());
26+
27+ // return time using FAT_TIME macro to format fields
28+ *time = FAT_TIME (now.hour (), now.minute (), now.second ());
29+ }
30+
1731// ///////////////////////////////////////////////////////////////////////
1832//
1933// ///////////////////////////////////////////////////////////////////////
2034void Force::run () {
2135 Sense ();
2236 UpdateDisplay ();
2337 WriteToSD ();
24- SerialOutput ();
38+ DateTime now = rtc.now ();
39+ unixtime = now.unixtime ();
40+ // SerialOutput();
2541}
2642
2743// ///////////////////////////////////////////////////////////////////////
@@ -49,6 +65,8 @@ void Force::Dispense() {
4965 digitalWrite (13 , HIGH); // RED LED
5066 delay (dispense_amount); // how long to open solenoid?
5167 digitalWrite (SOLENOID, LOW);
68+ DateTime now = rtc.now ();
69+ dispenseTime = now.unixtime ();
5270 digitalWrite (A2, LOW);
5371 digitalWrite (13 , LOW); // RED LED
5472 pressTime = millis ();
@@ -85,19 +103,7 @@ void Force::Click() {
85103 tone (A5, 800 , 8 );
86104}
87105
88- // ///////////////////////////////////////////////////////////////////////
89- // RTC Functions
90- // ///////////////////////////////////////////////////////////////////////
91- RTC_PCF8523 rtc;
92-
93- void dateTime (uint16_t * date, uint16_t * time) {
94- DateTime now = rtc.now ();
95- // return date using FAT_DATE macro to format fields
96- *date = FAT_DATE (now.year (), now.month (), now.day ());
97106
98- // return time using FAT_TIME macro to format fields
99- *time = FAT_TIME (now.hour (), now.minute (), now.second ());
100- }
101107
102108// ///////////////////////////////////////////////////////////////////////
103109// Begin
@@ -469,6 +475,8 @@ void Force::graphLegend() {
469475 tft.setTextColor (ST7735_WHITE);
470476 tft.setCursor (0 , 28 );
471477 tft.print (" Lick" );
478+ DateTime now = rtc.now ();
479+ lickTime = now.unixtime ();
472480 }
473481
474482 if (calibrated == false ){
0 commit comments