Skip to content

Commit

Permalink
Merge pull request #151 from mcrossley/master
Browse files Browse the repository at this point in the history
v3.19.1 - b3194
  • Loading branch information
mcrossley authored Jul 14, 2022
2 parents c1579aa + cad6784 commit afd5261
Show file tree
Hide file tree
Showing 14 changed files with 721 additions and 481 deletions.
21 changes: 21 additions & 0 deletions CumulusMX/AlarmSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ public string GetAlarmSettings()
Latches = cumulus.HighRainRateAlarm.Latch,
LatchHrs = cumulus.HighRainRateAlarm.LatchHours
},
isRaining = new JsonAlarmValues()
{
Enabled = cumulus.IsRainingAlarm.Enabled,
SoundEnabled = cumulus.IsRainingAlarm.Sound,
Sound = cumulus.IsRainingAlarm.SoundFile,
Notify = cumulus.IsRainingAlarm.Notify,
Email = cumulus.IsRainingAlarm.Email,
Latches = cumulus.IsRainingAlarm.Latch,
LatchHrs = cumulus.IsRainingAlarm.LatchHours,
Threshold = cumulus.IsRainingAlarm.TriggerThreshold
},
gustAbove = new JsonAlarmValues()
{
Enabled = cumulus.HighGustAlarm.Enabled,
Expand Down Expand Up @@ -350,6 +361,15 @@ public string UpdateAlarmSettings(IHttpContext context)
cumulus.HighRainRateAlarm.LatchHours = settings.rainRateAbove.LatchHrs;
emailRequired = emailRequired || (cumulus.HighRainRateAlarm.Email && cumulus.HighRainRateAlarm.Enabled);

cumulus.IsRainingAlarm.Enabled = settings.isRaining.Enabled;
cumulus.IsRainingAlarm.Sound = settings.isRaining.SoundEnabled;
cumulus.IsRainingAlarm.SoundFile = settings.isRaining.Sound;
cumulus.IsRainingAlarm.Notify = settings.isRaining.Notify;
cumulus.IsRainingAlarm.Email = settings.isRaining.Email;
cumulus.IsRainingAlarm.Latch = settings.isRaining.Latches;
cumulus.IsRainingAlarm.LatchHours = settings.isRaining.LatchHrs;
emailRequired = emailRequired || (cumulus.IsRainingAlarm.Email && cumulus.IsRainingAlarm.Enabled);

cumulus.HighGustAlarm.Enabled = settings.gustAbove.Enabled;
cumulus.HighGustAlarm.Value = settings.gustAbove.Val;
cumulus.HighGustAlarm.Sound = settings.gustAbove.SoundEnabled;
Expand Down Expand Up @@ -563,6 +583,7 @@ public class JsonAlarmSettingsData
public JsonAlarmValues upgrade { get; set; }
public JsonAlarmValues httpUpload { get; set; }
public JsonAlarmValues mySqlUpload { get; set; }
public JsonAlarmValues isRaining { get; set; }
}

public class JsonAlarmValues
Expand Down
6 changes: 1 addition & 5 deletions CumulusMX/Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ public async Task GetData(string req)

try
{
// read the last segment of the URL to determine what data the caller wants
var lastSegment = Request.Url.Segments.Last();

var query = HttpUtility.ParseQueryString(Request.Url.Query);
var date = query["date"];
var from = query["from"];
Expand All @@ -224,7 +221,7 @@ public async Task GetData(string req)

using (var writer = HttpContext.OpenResponseText())
{
switch (lastSegment)
switch (req)
{
case "dayfile":
await writer.WriteAsync(Station.GetDayfile(draw, start, length));
Expand Down Expand Up @@ -1112,7 +1109,6 @@ public async Task GenReports(string req)
default:
Response.StatusCode = 404;
throw new Exception();
break;
}
}
}
Expand Down
Loading

0 comments on commit afd5261

Please sign in to comment.