Skip to content

Commit

Permalink
Add convertion to Battery and Solar voltages
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgedevs committed Feb 21, 2024
1 parent 096a17a commit f5cd72d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 8 additions & 0 deletions Source/GnssTracker_Demo/Controllers/DisplayController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public DisplayController(IPixelDisplay display)
{
displayScreen = new DisplayScreen(display, RotationType._90Degrees);

displayScreen.BeginUpdate();

dataLayout = new AbsoluteLayout(displayScreen, 0, 0, displayScreen.Width, displayScreen.Height)
{
BackgroundColor = Color.White
Expand Down Expand Up @@ -169,6 +171,8 @@ public DisplayController(IPixelDisplay display)
dataLayout.Controls.Add(longitudeLabel);

displayScreen.Controls.Add(dataLayout);

displayScreen.EndUpdate();
}

public void UpdateDisplay(
Expand All @@ -180,6 +184,8 @@ public void UpdateDisplay(
Concentration? Concentration,
GnssPositionInfo locationInfo)
{
displayScreen.BeginUpdate();

batteryVoltageLabel.Text = $"{BatteryVoltage?.Volts:N2} V";
solarVoltageLabel.Text = $"{SolarVoltage?.Volts:N2} V";
temperatureLabel.Text = $"{Temperature?.Celsius:N1} C";
Expand All @@ -202,6 +208,8 @@ public void UpdateDisplay(
$"{locationInfo?.Position?.Longitude?.Minutes:N2}'" +
$"{locationInfo?.Position?.Longitude?.Seconds:N2}\"";
longitudeLabel.Text = lon;

displayScreen.EndUpdate();
}
}
}
11 changes: 7 additions & 4 deletions Source/GnssTracker_Demo/MeadowApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,17 @@ private void AccelerometerUpdated(object sender, IChangeResult<Acceleration3D> e

private void BatteryVoltageUpdated(object sender, IChangeResult<Voltage> e)
{
Resolver.Log.Info($"BATTERY VOLTAGE: {e.New.Volts:N2} volts");
batteryVoltage = e.New;
// Note: Battery Voltage input has a voltage divider, check schematics to learn more
batteryVoltage = e.New * 1.60;
Resolver.Log.Info($"BATTERY VOLTAGE: {batteryVoltage:N2} volts");
}

private void SolarVoltageUpdated(object sender, IChangeResult<Voltage> e)
{
Resolver.Log.Info($"SOLAR VOLTAGE: {e.New.Volts:N2} volts");
solarVoltage = e.New;
// Note: Solar Voltage input has a voltage divider, check schematics to learn more
solarVoltage = e.New * 1.40;
Resolver.Log.Info($"SOLAR VOLTAGE: {solarVoltage:N2} volts");

}

private void GnssRmcReceived(object sender, GnssPositionInfo e)
Expand Down

0 comments on commit f5cd72d

Please sign in to comment.