public static void Main() { _lcdshield = new DfRobotLcdShield(20, 4); // Create a custom degrees symbol (°), store it on the LCD for later use with the lat/long display _lcdshield.CreateChar(7, new byte[] { 0x0, 0x4, 0xa, 0x4, 0x0, 0x0, 0x0, 0x0 }); _thunderbolt = new ThunderBolt("COM1", AngleUnits.Degrees, AltitudeUnits.Meters, new OutputPort(Pins.GPIO_PIN_D13, false)); _ntpServer = new NtpServer(); _lcdshield.OnButtonPressed += LcdshieldOnOnButtonPressed; DisplaySplash(); TestLeds(); _thunderbolt.Open(); _thunderbolt.TimingMode = TimingModes.UTC; Thread.Sleep(1500); _ntpServer.Start(); //_thunderbolt.TimeChanged += ThunderboltOnTimeChanged; while (true) { if (_thunderbolt.IsSerialDataBeingReceived) { if (!_isSurveyInProgress && _thunderbolt.IsSurveyInProgress()) { // Survey has just started. Jump to the page displaying survey progress. _previousPageNumber = _pageNumber; // Take note of the page we were on so we can switch back later. _isSurveyInProgress = true; _pageNumber = 2; // Set the new page to jump to. } else if (_isSurveyInProgress && !_thunderbolt.IsSurveyInProgress()) { // Survey has just finished. Jump to the previous page we were displaying. _pageNumber = _previousPageNumber; _isSurveyInProgress = false; } switch (_pageNumber) { case 1: DisplayScreenOne(); break; case 2: DisplayScreenTwo(); break; case 3: DisplayScreenThree(); break; case 4: DisplayScreenFour(); break; case 5: DisplayScreenFive(); break; default: DisplayScreenOne(); break; } UpdateAlarmIndicators(); } else { DisplayNoSerialDataScreen(); } Thread.Sleep(100); } }