Skip to content

Commit

Permalink
Merge pull request #161 from mcrossley/master
Browse files Browse the repository at this point in the history
v3.22.1 - b3212
  • Loading branch information
mcrossley authored Oct 15, 2022
2 parents 89736d5 + 6b807c0 commit 96eed42
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 19 deletions.
12 changes: 11 additions & 1 deletion CumulusMX/Cumulus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4151,7 +4151,16 @@ private void ReadIniFile()

RecordsBeganDate = ini.GetValue("Station", "StartDate", DateTime.Now.ToLongDateString());

LogMessage("Cumulus start date: " + RecordsBeganDate);
try
{
RecordsBeganDateTime = DateTime.Parse(RecordsBeganDate);
}
catch (Exception ex)
{
LogErrorMessage($"Error parsing the RecordsBegan date: {ex.Message}");
}

LogMessage($"Cumulus start date: {RecordsBeganDate} Parsed: {RecordsBeganDateTime:yyyy-MM-dd}" );

ImetOptions.WaitTime = ini.GetValue("Station", "ImetWaitTime", 500);
ImetOptions.ReadDelay = ini.GetValue("Station", "ImetReadDelay", 500);
Expand Down Expand Up @@ -6778,6 +6787,7 @@ private void ReadStringsFile()
//public bool EWduplicatecheck { get; set; }

public string RecordsBeganDate { get; set; }
public DateTime RecordsBeganDateTime { get; set; }

//public bool EWdisablecheckinit { get; set; }

Expand Down
6 changes: 3 additions & 3 deletions CumulusMX/DataEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ internal string GetRecordsLogFile(string recordType)
switch (recordType)
{
case "alltime":
datefrom = DateTime.Parse(cumulus.RecordsBeganDate);
datefrom = cumulus.RecordsBeganDateTime;
break;
case "thisyear":
var now = DateTime.Now;
Expand All @@ -675,7 +675,7 @@ internal string GetRecordsLogFile(string recordType)
datefrom = new DateTime(now.Year, now.Month, 1).Date;
break;
default:
datefrom = DateTime.Parse(cumulus.RecordsBeganDate);
datefrom = cumulus.RecordsBeganDateTime;
break;
}
var dateto = DateTime.Now.Date;
Expand Down Expand Up @@ -2158,7 +2158,7 @@ internal string GetMonthlyRecLogFile()
const string monthFormat = "MMM yyyy";

var json = new StringBuilder("{", 25500);
var datefrom = DateTime.Parse(cumulus.RecordsBeganDate);
var datefrom = cumulus.RecordsBeganDateTime;
datefrom = new DateTime(datefrom.Year, datefrom.Month, 1, 0, 0, 0);
var dateto = DateTime.Now;
dateto = new DateTime(dateto.Year, dateto.Month, 1, 0, 0, 0);
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("Cumulus MX")]
[assembly: AssemblyDescription("Version 3.22.0 - Build 3211")]
[assembly: AssemblyDescription("Version 3.22.1 - Build 3212")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Cumulus MX")]
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.22.0.3211")]
[assembly: AssemblyFileVersion("3.22.0.3211")]
[assembly: AssemblyVersion("3.22.1.3212")]
[assembly: AssemblyFileVersion("3.22.1.3212")]
1 change: 1 addition & 0 deletions CumulusMX/StationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,7 @@ internal string UpdateConfig(IHttpContext context)
try
{
cumulus.RecordsBeganDate = settings.general.advanced.recsbegandate;
cumulus.RecordsBeganDateTime = DateTime.Parse(cumulus.RecordsBeganDate);
}
catch (Exception ex)
{
Expand Down
18 changes: 9 additions & 9 deletions CumulusMX/WeatherStation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6275,6 +6275,7 @@ public void DoTrendValues(DateTime ts, bool rollover = false)
{
double trendval, retVal;
List<RecentData> retVals;
List<Double> retDbl;
var recTs = ts;

// if this is the special case of rollover processing, we want the High today record to on the previous day at 23:59 or 08:59
Expand Down Expand Up @@ -6405,16 +6406,15 @@ public void DoTrendValues(DateTime ts, bool rollover = false)

try
{
retVal = RecentDataDb.ExecuteScalar<double>("select raincounter from RecentData where Timestamp >= ? order by Timestamp limit 1", ts.AddMinutes(-5.5));
retDbl = RecentDataDb.Query<Double>("select raincounter from RecentData where Timestamp >= ? order by Timestamp limit 1", ts.AddMinutes(-5.5));

if (Raincounter < retVal)
if (retDbl.Count != 1 || Raincounter < retDbl[0])
{
RainRate = 0;
}
else
{

var raindiff = Math.Round(Raincounter - retVal, cumulus.RainDPlaces);
var raindiff = Math.Round(Raincounter - retDbl[0], cumulus.RainDPlaces);
//cumulus.LogMessage("raindiff = " + raindiff);

var timediffhours = 1.0 / 12.0;
Expand All @@ -6431,6 +6431,7 @@ public void DoTrendValues(DateTime ts, bool rollover = false)
{
// ignore
cumulus.LogSpikeRemoval("Max rainfall rate spike value exceed");
cumulus.LogSpikeRemoval($"Rate value = {ConvertUserRainToMM(tempRainRate):F2} SpikeMaxRainRate = {cumulus.Spike.MaxRainRate:F2}");
lastSpikeRemoval = DateTime.Now;
cumulus.SpikeAlarm.LastError = $"Max rainfall rate greater than spike value - Value={tempRainRate:F1}";
cumulus.SpikeAlarm.Triggered = true;
Expand Down Expand Up @@ -6479,17 +6480,16 @@ public void DoTrendValues(DateTime ts, bool rollover = false)

// calculate and display rainfall in last 24 hour
try
{
retVal = RecentDataDb.ExecuteScalar<double>("select raincounter from RecentData where Timestamp >= ? order by Timestamp limit 1", ts.AddDays(-1));
{
retDbl = RecentDataDb.Query<Double>("select raincounter from RecentData where Timestamp >= ? order by Timestamp limit 1", ts.AddDays(-1));

if (Raincounter < retVal)
if (retDbl.Count != 1 || Raincounter < retDbl[0])
{
RainLast24Hour = 0;
}
else
{

trendval = Math.Round(Raincounter - retVal, cumulus.RainDPlaces);
trendval = Math.Round(Raincounter - retDbl[0], cumulus.RainDPlaces);

if (trendval < 0)
{
Expand Down
4 changes: 2 additions & 2 deletions CumulusMX/webtags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2486,13 +2486,13 @@ private string TagThumL(Dictionary<string,string> tagParams)

private string Tagrecordsbegandate(Dictionary<string,string> tagParams)
{
var begandate = DateTime.Parse(cumulus.RecordsBeganDate);
var begandate = cumulus.RecordsBeganDateTime;
return GetFormattedDateTime(begandate, "dd MMMM yyyy", tagParams);
}

private string TagDaysSinceRecordsBegan(Dictionary<string,string> tagParams)
{
var begandate = DateTime.Parse(cumulus.RecordsBeganDate);
var begandate = cumulus.RecordsBeganDateTime;
return (DateTime.Now - begandate).Days.ToString();
}

Expand Down
9 changes: 8 additions & 1 deletion Updates.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
3.22.1 - b3212
——————————————
Fixed
- NOAA Reports pages not working in all locales
- RainRate sometimes giving wild values on start-up when CMX calculates rate
- Amusing typo in default web site today/yesterday page


3.22.0 - b3211
——————————————
New
Expand All @@ -9,7 +17,6 @@ Changed
- The web tag <#TimeJavaScript> now provides a value truncated to the current second



3.21.2 - b3206
——————————————
Fixed
Expand Down

0 comments on commit 96eed42

Please sign in to comment.