Skip to content
Permalink
Browse files

Better flow control for programming

  • Loading branch information...
rmc47 committed Mar 28, 2019
1 parent f72a69a commit c95f925526324b5dcb7240ab765ed5bcba40caf0
Showing with 25 additions and 6 deletions.
  1. +7 −4 WordClock.ino
  2. +18 −2 WordClockConfig/WordClockConfig/WordClockConfigForm.cs
@@ -230,9 +230,9 @@ void scrollEverything() {
dispWord(timeToWords(localNow()), getWordsColour()); // random colour
}

void readSerial() {
uint8_t readSerial() {
if (Serial.available() == 0)
return;
return 0;

switch (Serial.read()) {
case 'D': setDate(); break;
@@ -244,8 +244,9 @@ void readSerial() {
case 'H': setHalfIntervals(); break;
case 'V': printVersion(); break;
case '#': scrollTextFromSerial(); break;
case '\n': scrollEverything(); break;
case '=': scrollEverything(); break;
}
return 1;
}

void printVersion() {
@@ -381,7 +382,9 @@ void scrollString(char * stringarr, uint16_t colour)
run_loop = 0;
}
matrix.show();
readSerial();
if (readSerial()) {
return;
}
delay(SCROLL_DELAY);
}
}
@@ -93,9 +93,25 @@ private void SaveConfiguration(string portName, DateTime time)
Thread.Sleep(100);
port.DtrEnable = false;
port.ReadLine();
port.WriteTimeout = 1000;
port.WriteTimeout = 1000;
port.WriteLine("S10");
Thread.Sleep(2000);
string timeString = time.ToString("Dyyyy,MM,dd,HH,mm,ss");
port.WriteLine(timeString);
port.WriteLine(timeString);
Thread.Sleep(3000);
port.WriteLine("B128");
//Thread.Sleep(250);
port.WriteLine("U1");
//Thread.Sleep(250);
port.WriteLine("L1");
//Thread.Sleep(250);
port.WriteLine("H1");
//Thread.Sleep(250);
port.WriteLine("P31");
//Thread.Sleep(250);
port.WriteLine("S75");
port.WriteLine("#ProgDone");

port.Close();
}
Invoke(new MethodInvoker(() =>

0 comments on commit c95f925

Please sign in to comment.
You can’t perform that action at this time.