Skip to content

Commit

Permalink
Merge pull request #28 from mcrossley/master
Browse files Browse the repository at this point in the history
b3052
  • Loading branch information
mcrossley authored Sep 13, 2019
2 parents 19bfd69 + b9ba880 commit e307e3f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
7 changes: 4 additions & 3 deletions CumulusMX/Cumulus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ namespace CumulusMX
public class Cumulus
{
/////////////////////////////////
public string Version = "3.0.1";
public string Build = "3051";
public string Version = "3.0.2";
public string Build = "3052";
/////////////////////////////////

private static string appGuid = "57190d2e-7e45-4efb-8c09-06a176cef3f3";
Expand Down Expand Up @@ -3022,10 +3022,11 @@ private void ReadIniFile()
solar_logging = ini.GetValue("Station", "SolarLog", false);
#if DEBUG
logging = true;
DataLogging = true;
#else
logging = ini.GetValue("Station", "Logging", false);
#endif
DataLogging = ini.GetValue("Station", "DataLogging", false);
#endif

VP2ConnectionType = ini.GetValue("Station", "VP2ConnectionType", VP2SERIALCONNECTION);
VP2TCPPort = ini.GetValue("Station", "VP2TCPPort", 22222);
Expand Down
26 changes: 21 additions & 5 deletions CumulusMX/DavisStation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ internal class DavisStation : WeatherStation
private const string newline = "\n";
private DateTime lastRecepStatsTime;
private int commWaitTimeMs = 1000;
private int MaxArchiveRuns = 2;

private TcpClient socket;

Expand Down Expand Up @@ -554,6 +555,7 @@ private void bw_DoStart(object sender, DoWorkEventArgs e)

private void bw_DoWork(object sender, DoWorkEventArgs e)
{
int archiveRun = 0;
cumulus.LogDebugMessage("Lock: Station waiting for the lock");
Cumulus.syncInit.Wait();
cumulus.LogDebugMessage("Lock: Station has the lock");
Expand All @@ -562,9 +564,11 @@ private void bw_DoWork(object sender, DoWorkEventArgs e)
// set this temporarily, so speed is done from average and not peak gust from logger
savedUseSpeedForAvgCalc = cumulus.UseSpeedForAvgCalc;
cumulus.UseSpeedForAvgCalc = true;
GetArchiveData();
// and again, in case it took a long time and there are new entries
GetArchiveData();
do
{
GetArchiveData();
archiveRun++;
} while (archiveRun < MaxArchiveRuns);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -1824,7 +1828,8 @@ private void GetArchiveData()

if (tmrComm.timedout)
{
cumulus.LogMessage("The station has stopped sending archive data");
cumulus.LogMessage("The station has stopped sending archive data, ending attempts");
Console.WriteLine(""); // flush the progress line
return;
}
// Read the response
Expand Down Expand Up @@ -1858,6 +1863,7 @@ private void GetArchiveData()
if (responsePasses == 20)
{
cumulus.LogMessage("The station has stopped sending archive data");
Console.WriteLine(""); // flush the progress line
return;
}

Expand Down Expand Up @@ -2186,8 +2192,18 @@ private void GetArchiveData()
{
// do rollover
cumulus.LogMessage("Day rollover " + timestamp.ToShortTimeString());
// If the rollover processing takes more that ~10 seconds the station times out sending the archive data
// If this happens, add aonther run to the archive processing, so we start it again to pick up records for the next day
var watch = new System.Diagnostics.Stopwatch();
watch.Start();
DayReset(timestamp);

watch.Stop();
if (watch.ElapsedMilliseconds > 10000)
{
// EOD processing took longer than 10 seconds, add another run
cumulus.LogDebugMessage("End of day processing took more than 10 seconds, adding another archive data run");
MaxArchiveRuns++;
}
rolloverdone = true;
}

Expand Down
6 changes: 3 additions & 3 deletions CumulusMX/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CumulusMX")]
[assembly: AssemblyDescription("Build 3051")]
[assembly: AssemblyDescription("Build 3052")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CumulusMX")]
Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.1.3051")]
[assembly: AssemblyFileVersion("3.0.1.3051")]
[assembly: AssemblyVersion("3.0.2.3052")]
[assembly: AssemblyFileVersion("3.0.2.3052")]
11 changes: 11 additions & 0 deletions Updates.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
3.0.2 - b3052
=============
- Fixes Davis archive downloads from the the logger when the day rollover processing takes longer than 10 seconds.
This can happen on slow processors - Pi Zero for example - or if lengthy procedures are included
An extra archive processing run is scheduled for each day rollover that takes longer than 10 seconds

- Updated files
\CumulusMX.exe
\CumulusMX.exe.config
\CumulusMX.pdb


3.0.1 - b3051
=============
Expand Down

0 comments on commit e307e3f

Please sign in to comment.