Skip to content

Commit a6de17e

Browse files
demichielMichiel Ryvers
andauthored
Change type of LuminosityPercentage to int from byte (#36)
The LuminosityPercentage stayed at 0 when initializing the screen. Co-authored-by: Michiel Ryvers <michiel.ryvers@sbb.be>
1 parent 70e56ef commit a6de17e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

nanoFramework.M5StickCommon/Screen.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class Screen : ScreenBase
1919
private const int DataCommand = 23;
2020
private const int Reset = 18;
2121
private static Axp192 _power;
22-
private static byte _lumi;
22+
private static int _lumi;
2323
private static bool _isInitialized = false;
2424

2525
/// <summary>
@@ -53,7 +53,7 @@ public Screen()
5353
/// <summary>
5454
/// Enables or disables the screen.
5555
/// </summary>
56-
public static new bool Enabled
56+
public new static bool Enabled
5757
{
5858
get => IsEnabled;
5959

@@ -68,16 +68,16 @@ public Screen()
6868
/// Sets or gets the screen luminosity.
6969
/// </summary>
7070
/// <remarks> On M5Stick, anything less than 20% will be fully black</remarks>
71-
public static new byte LuminosityPercentage
71+
public new static int LuminosityPercentage
7272
{
7373
get => _lumi;
7474

7575
set
7676
{
7777
// For M5Stick, values from 8 to 12 are working fine
7878
// 2.5 V = dark, 3.0 V full luminosity
79-
_lumi = (byte)(value > 100 ? 100 : _lumi);
80-
_power.LDO3OutputVoltage = ElectricPotential.FromVolts((byte)(_lumi * 0.5 / 100.0 + 2.5));
79+
_lumi = value > 100 ? 100 : value;
80+
_power.LDO3OutputVoltage = ElectricPotential.FromVolts(_lumi * 0.5 / 100.0 + 2.5);
8181
}
8282
}
8383
}

0 commit comments

Comments
 (0)