Firmware Updates for RTC

Also minor edits to `setVoltage()`
This commit is contained in:
Ancyker 2023-07-16 01:01:58 -04:00
parent 95f4f44786
commit ff62f494eb
2 changed files with 24 additions and 5 deletions

View File

@ -2939,6 +2939,22 @@ void checkUpdater() {
ClockedSerial.println(F("V")); ClockedSerial.println(F("V"));
#else #else
ClockedSerial.println(F("Automatic voltage selection (VSELECT) is not enabled.")); ClockedSerial.println(F("Automatic voltage selection (VSELECT) is not enabled."));
#endif
} else if (cmd == "GETTIME") {
#if defined(RTC_installed)
ClockedSerial.print(F("Current Time: "));
ClockedSerial.println(RTCStamp());
#else
ClockedSerial.println(F("RTC not installed"));
#endif
} else if (cmd.substring(0,7) == "SETTIME") {
#if defined(RTC_installed)
ClockedSerial.println(F("Setting Time..."));
rtc.adjust(DateTime(cmd.substring(8).toInt()));
ClockedSerial.print(F("Current Time: "));
ClockedSerial.println(RTCStamp());
#else
ClockedSerial.println(F("RTC not installed"));
#endif #endif
} else { } else {
ClockedSerial.println(F("OSCR: Unknown Command")); ClockedSerial.println(F("OSCR: Unknown Command"));

View File

@ -81,6 +81,9 @@ void printVersionToSerial() {
#if defined (ENABLE_VSELECT) #if defined (ENABLE_VSELECT)
ClockedSerial.print(F("|VSELECT")); ClockedSerial.print(F("|VSELECT"));
#endif #endif
#if defined (RTC_installed)
ClockedSerial.print(F("|RTC"));
#endif
#if defined (clockgen_installed) #if defined (clockgen_installed)
ClockedSerial.print(F("|CLOCKGEN")); ClockedSerial.print(F("|CLOCKGEN"));
#endif #endif
@ -169,8 +172,8 @@ void setClockScale(VOLTS __x)
* *
*F*/ *F*/
#if defined(ENABLE_VSELECT) || defined(ENABLE_3V3FIX) #if defined(ENABLE_VSELECT) || defined(ENABLE_3V3FIX)
VOLTS setVoltage(VOLTS volts) { VOLTS setVoltage(VOLTS newVoltage) {
switch(volts) { switch(newVoltage) {
/* 5V */ /* 5V */
case VOLTS_SET_5V: case VOLTS_SET_5V:
if ( if (
@ -199,7 +202,7 @@ VOLTS setVoltage(VOLTS volts) {
#endif #endif
// Set clock speed // Set clock speed
clock = CS_16MHZ; clock = CS_16MHZ;
setClockScale(volts); /*[2]*/ setClockScale(newVoltage); /*[2]*/
// Restart serial // Restart serial
#if !defined(enable_serial) && defined(ENABLE_UPDATER) #if !defined(enable_serial) && defined(ENABLE_UPDATER)
ClockedSerial.begin(UPD_BAUD); ClockedSerial.begin(UPD_BAUD);
@ -232,7 +235,7 @@ VOLTS setVoltage(VOLTS volts) {
#endif #endif
// Set clock speed // Set clock speed
clock = CS_8MHZ; clock = CS_8MHZ;
setClockScale(volts); /*[2]*/ setClockScale(newVoltage); /*[2]*/
#if !defined(enable_serial) && defined(ENABLE_UPDATER) #if !defined(enable_serial) && defined(ENABLE_UPDATER)
ClockedSerial.begin(UPD_BAUD); ClockedSerial.begin(UPD_BAUD);
#endif #endif
@ -256,7 +259,7 @@ VOLTS setVoltage(VOLTS volts) {
// The compiler will optimize this out when this condition is met. // The compiler will optimize this out when this condition is met.
// Yes, even though it has a return value it will only be compiled // Yes, even though it has a return value it will only be compiled
// if something reads that value. Currently nothing does. // if something reads that value. Currently nothing does.
VOLTS setVoltage(VOLTS volts __attribute__((unused))) { VOLTS setVoltage(VOLTS newVoltage __attribute__((unused))) {
return VOLTS_NOTENABLED; return VOLTS_NOTENABLED;
} }
#endif #endif