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"));
#else
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
} else {
ClockedSerial.println(F("OSCR: Unknown Command"));

View File

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