WIP
This commit is contained in:
@@ -22,13 +22,15 @@ LiquidCrystal_I2C lcd(0x27, 16, 2);
|
||||
char TempBuf[5] = "99.9"; // demo value
|
||||
char HumiBuf[3] = "99"; // demo value
|
||||
|
||||
unsigned long TMR_FPS;
|
||||
|
||||
bool LCD_Simple_clock;
|
||||
|
||||
void RTCtoLCD(bool ClockType = LCD_Simple_clock) {
|
||||
if (millis() < 2000) ClockType = true;
|
||||
else if (!NewSec && !NewMin && !NewHour) return;
|
||||
if (!NewSec && !NewMin && !NewHour) return;
|
||||
char Clock[9];
|
||||
char segment[3];
|
||||
char message[50];
|
||||
|
||||
if (ClockType) {
|
||||
snprintf(Clock, sizeof(Clock), "%.2u:%.2u:%.2u", hour(Loc_t), minute(Loc_t), second(Loc_t));
|
||||
@@ -40,16 +42,22 @@ void RTCtoLCD(bool ClockType = LCD_Simple_clock) {
|
||||
lcd.setCursor(6, 0);
|
||||
lcd.print(segment);
|
||||
}
|
||||
|
||||
if (NewMin) {
|
||||
snprintf(segment, sizeof(segment),"%.2u", minute(Loc_t));
|
||||
lcd.setCursor(3, 0);
|
||||
lcd.print(segment);
|
||||
}
|
||||
if (NewHour) {
|
||||
snprintf(segment, sizeof(segment),"%.2u", hour(Loc_t));
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print(segment);
|
||||
}
|
||||
//Serial.print("DEBUG[RTCtoLCD] millis(): "); Serial.println(micros());
|
||||
// long drift = tmr_PPS - tmr_SQW;
|
||||
//Serial.println("DEBUG[RTCtoLCD] Difference PPS - SQW: " + String(drift) + "[" + String(tmr_PPS) + "]" + "[" + String(tmr_SQW) + "]");
|
||||
// lcd.setCursor(15, 1);
|
||||
// lcd.print((micros() - tmr_PPS < 2000000) ? "P" : "p"); // Выводим "P" или "p" на 16 позиции в зависимости от условия
|
||||
// snprintf(message, sizeof(message), "micros: %d, tmr_PPS: %d", millis(), tmr_PPS);
|
||||
// Serial.println(message);
|
||||
}
|
||||
|
||||
void setup() { // the setup function runs once when you press reset or power the board
|
||||
@@ -85,8 +93,27 @@ void loop() { // the loop function runs over and over again forever
|
||||
RTCtoLCD();
|
||||
PrintSec();
|
||||
PrintHour();
|
||||
chkFPS();
|
||||
}
|
||||
|
||||
/////////////////////
|
||||
|
||||
void chkFPS() {
|
||||
int FPS;
|
||||
if (millis() - TMR_FPS > 1000) {
|
||||
Serial.println(TMR_FPS);
|
||||
Serial.println(millis());
|
||||
TMR_FPS = millis();
|
||||
Serial.print("DEBUG[chkFPS] "); Serial.println(FPS);
|
||||
FPS = 0;
|
||||
return;
|
||||
}
|
||||
FPS++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void PrintSec() { // print time if new second
|
||||
if (NewSec) { //
|
||||
NewSec = false; // remove flag, do only once every sec
|
||||
|
||||
Reference in New Issue
Block a user