/**
https://stackoverflow.com/questions/61972894/arduino-use-parent-class-method-at-child-class
https://github.com/Tomiinek/Star_Tracker/blob/master/src/core/rtc_ds3231.h
*/
#include <Arduino.h>
#include "config.h" // configuration
#include "utils.h" // utilities: convertions, macros etc.
#include "rtcds3231.h" // clock, dates and times, calendar
#include "location.h" // location on Earth
#include "init.h" // initialization
// Create observer location instance
Location observerLocation(LATITUDE, LONGITUDE, ALTITUDE, TIMEZONE, IS_DST, LOCATION_NAME);
// Create clock instance
RtcDS3231 ds3231(observerLocation.getLongitude(), observerLocation.getGMTOffset(), observerLocation.getDST());
Clock& persistentClock = ds3231;
void setup () {
Serial.begin(SERIAL_BAUD_RATE);
while (!Serial) {
delay(300);
}
Serial.flush();
persistentClock.obtainTime();
#ifdef DEBUG_LOCATION
Serial.println("----- Location Debug -----"); Serial.println();
Serial.print("Latitude : "); Serial.println(observerLocation.getLatitude(), 5);
Serial.print("Longitude : "); Serial.println(observerLocation.getLongitude(), 5);
Serial.print("Altitude : "); Serial.println(observerLocation.getAltitude()), 0;
Serial.print("GMT Offset : "); Serial.println(observerLocation.getGMTOffset(), 2);
Serial.print("DST : "); Serial.println(observerLocation.getDST());
Serial.print("Name : "); Serial.println(observerLocation.getLocationName().c_str());
Serial.println();
#endif
initTasks();
}
void loop () {
persistentClock.obtainTime();
// Get time-related values
/*
double julianDate = dtConverter.getJulianDate(currentTime);
double j2000 = dtConverter.getJ2000(julianDate);
double lst = dtConverter.getLST(currentTime);
*/
Serial.print("Get LST : "); Serial.println(persistentClock.get_LST().timestamp());
Serial.print("Get time : "); Serial.println(persistentClock.get_time().timestamp());
Serial.println();
delay(10000);
}