Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions SCTVcode/SCTVcode.ino
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ USBDriver *drivers[] = {&hub1, &hub2, &hid1, &hid2, &hid3, &userial};
const char * driver_names[CNT_DEVICES] = {"Hub1", "Hub2", "HID1", "HID2", "HID3", "USERIAL1" };
bool driver_active[CNT_DEVICES] = {false, false, false, false, false, false};

// --------------------------------- Serial2 port -----------------------------

uint32_t serial2BaudRate = 9600;

// ----------------------- DS3232 time keeping code ----------------------------------

// Make day of week from date variables
Expand Down Expand Up @@ -420,12 +424,6 @@ static void readGPStime(TinyGPS &gps)
byte mon, days, hr, mins, sec, hund;
int yrs;

// bail if we don't have valid serial...
if (!userial) {
GPSage = TinyGPS::GPS_INVALID_AGE;
return;
}

gps.crack_datetime(&yrs, &mon, &days, &hr, &mins, &sec, &hund, &GPSage);

GPSHun = hund;
Expand Down Expand Up @@ -504,7 +502,7 @@ void getTheTime(void)
readGPStime(myGps); // get current time into time variables

// See if the GPS time is good, use either it or the RTC accordingly
if ((GPSage == TinyGPS::GPS_INVALID_AGE) || (GPSage > 1000)) // not conencted or stale time
if ((GPSage == TinyGPS::GPS_INVALID_AGE) || (GPSage > 1500)) // not conencted or stale time
{
readRTCtime(); // get current time into time variables
}
Expand Down
4 changes: 4 additions & 0 deletions SCTVcode/z_main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ void setup()
rn1 = rn2 = rn3 = rn4 = 0x45; // random number generator seed? Why not use random()?
Wire.begin(); // RTC uses I2C
Serial.begin(115200); // debug port
Serial2.begin(serial2BaudRate); // Serial GPS port
delay(100);
EncDir = 0; // no buttons being pushed or knobs being turned, we hope
pushed = false;
Expand Down Expand Up @@ -123,6 +124,9 @@ void loop()
if (userial) {
while (userial.available())
myGps.encode(userial.read());
} else {
while (Serial2.available())
myGps.encode(Serial2.read());
}

if ((theClock != 1) && (theClock != 2)) // Pong and Tetris use position controls as paddles
Expand Down