Skip to content

Commit

Permalink
Merge pull request #130 from mcrossley/master
Browse files Browse the repository at this point in the history
build 3153
  • Loading branch information
mcrossley authored Nov 9, 2021
2 parents 86c7a91 + a4f2ed5 commit 9297480
Show file tree
Hide file tree
Showing 12 changed files with 1,138 additions and 1,499 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,5 @@ UpgradeLog*.htm
FakesAssemblies/

ToDo.txt
/CumulusMX/DataEditor-byDay.cs
/CumulusMX/WeatherStation-byDay.cs
8 changes: 4 additions & 4 deletions CumulusMX/Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ public async Task<bool> PostTags()
case "ecowitt":
if (stationEcowitt != null)
{
return await this.StringResponseAsync(stationEcowitt.ProcessData(this));
return await this.StringResponseAsync(stationEcowitt.ProcessData(this, true));
}
else
{
Expand All @@ -1078,7 +1078,7 @@ public async Task<bool> PostTags()
case "ecowittextra":
if (stationEcowittExtra != null)
{
return await this.StringResponseAsync(stationEcowittExtra.ProcessExtraData(this));
return await this.StringResponseAsync(stationEcowittExtra.ProcessData(this, false));
}
else
{
Expand Down Expand Up @@ -1119,7 +1119,7 @@ public async Task<bool> GetStation()
case "ambient":
if (stationAmbient != null)
{
return await this.StringResponseAsync(stationAmbient.ProcessData(this));
return await this.StringResponseAsync(stationAmbient.ProcessData(this, true));
}
else
{
Expand All @@ -1130,7 +1130,7 @@ public async Task<bool> GetStation()
case "ambientextra":
if (stationAmbientExtra != null)
{
return await this.StringResponseAsync(stationAmbient.ProcessExtraData(this));
return await this.StringResponseAsync(stationAmbient.ProcessData(this, false));
}
else
{
Expand Down
516 changes: 273 additions & 243 deletions CumulusMX/Cumulus.cs

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions CumulusMX/DavisWllStation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1708,16 +1708,6 @@ private void GetWlHistoricData()
}


if (cumulus.StationOptions.LogExtraSensors)
{
cumulus.DoExtraLogFile(timestamp);
}

if (cumulus.airLinkOut != null || cumulus.airLinkIn != null)
{
cumulus.DoAirLinkLogFile(timestamp);
}

// Now we have the primary data, calculate the derived data
if (cumulus.StationOptions.CalculatedWC)
{
Expand All @@ -1734,6 +1724,16 @@ private void GetWlHistoricData()
cumulus.LogMessage("GetWlHistoricData: Log file entry written");
cumulus.MySqlRealtimeFile(999, false, timestamp);

if (cumulus.StationOptions.LogExtraSensors)
{
cumulus.DoExtraLogFile(timestamp);
}

if (cumulus.airLinkOut != null || cumulus.airLinkIn != null)
{
cumulus.DoAirLinkLogFile(timestamp);
}

AddRecentDataWithAq(timestamp, WindAverage, RecentMaxGust, WindLatest, Bearing, AvgBearing, OutdoorTemperature, WindChill, OutdoorDewpoint, HeatIndex,
OutdoorHumidity, Pressure, RainToday, SolarRad, UV, Raincounter, FeelsLike, Humidex, ApparentTemperature, IndoorTemperature, IndoorHumidity, CurrentSolarMax, RainRate);
DoTrendValues(timestamp);
Expand Down
22 changes: 15 additions & 7 deletions CumulusMX/GW1000Station.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ private enum Commands : byte {
CMD_READ_SENSOR_ID_NEW = 0x3C,
CMD_WRITE_REBOOT = 0x40,// system reset
CMD_WRITE_RESET = 0x41,// system default setting reset
CMD_READ_CUSTOMIZED_PATH = 0x51,
CMD_WRITE_CUSTOMIZED_PATH = 0x52,
CMD_GET_CO2_OFFSET = 0x53,
CMD_SET_CO2_OFFSET = 0x54
CMD_SET_CO2_OFFSET = 0x54,
CMD_READ_RSTRAIN_TIME = 0x55,// read rain reset time
CMD_WRITE_RSTRAIN_TIME = 0x56// write back rain reset time
}

private enum CommandRespSize : int
Expand Down Expand Up @@ -115,7 +119,9 @@ private enum CommandRespSize : int
CMD_WRITE_SENSOR_ID = 1,
CMD_WRITE_REBOOT = 1,
CMD_WRITE_RESET = 1,
CMD_READ_SENSOR_ID_NEW = 2
CMD_READ_SENSOR_ID_NEW = 2,
CMD_READ_RSTRAIN_TIME = 1,
CMD_WRITE_RSTRAIN_TIME = 1
}

[Flags] private enum SigSen : byte
Expand Down Expand Up @@ -226,7 +232,8 @@ private enum SensorIds
Wh35Ch5, // 44
Wh35Ch6, // 45
Wh35Ch7, // 46
Wh35Ch8 // 47
Wh35Ch8, // 47
Wh90 // 48
};

public GW1000Station(Cumulus cumulus) : base(cumulus)
Expand Down Expand Up @@ -486,8 +493,6 @@ private Discovery DiscoverGW1000()
client.EnableBroadcast = true;
client.Send(sendBytes, sendBytes.Length, sendEp);

string[] namesToCheck = { "GW1000", "WH2650", "EasyWeather", "AMBWeather", "WS1900", "WN1900" };

do
{
try
Expand All @@ -505,7 +510,7 @@ private Discovery DiscoverGW1000()
Array.Copy(receivedBytes, 5, macArr, 0, 6);
var macHex = BitConverter.ToString(macArr).Replace('-', ':');

if (namesToCheck.Any((name.Split('-')[0]).StartsWith) && ipAddr.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries).Length == 4)
if (ipAddr.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries).Length == 4)
{
IPAddress ipAddr2;
if (IPAddress.TryParse(ipAddr, out ipAddr2))
Expand Down Expand Up @@ -824,6 +829,7 @@ private bool PrintSensorInfoNew(byte[] data, int idx)

case string wh34 when wh34.StartsWith("WH34"): // ch 1-8
case string wh35 when wh35.StartsWith("WH35"): // ch 1-8
case "WH90":
battV = data[battPos] * 0.02;
batt = $"{battV:f1}V ({TestBattery10(data[battPos])})"; // volts/10, low = 1.2V
break;
Expand Down Expand Up @@ -987,7 +993,7 @@ private void GetLiveData()
idx += 2;
break;
case 0x0D: //Rain Event (mm)
//TODO: add rain event total
StormRain = ConvertRainMMToUser(ConvertBigEndianUInt32(data, idx) / 10.0);
idx += 2;
break;
case 0x0E: //Rain Rate (mm/h)
Expand Down Expand Up @@ -1667,6 +1673,8 @@ private static string TestBattery2(UInt16 value, UInt16 mask)

private static string TestBattery3(byte value)
{
if (value == 6)
return "DC";
return value > 1 ? "OK" : "Low";
}

Expand Down
Loading

0 comments on commit 9297480

Please sign in to comment.