Fix M5Core2 power LED on/off (was reversed) #236
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.








Description
Reversed the logic for setting the PowerLed as it seems incorrect.
Motivation and Context
Testing the PowerLed property, so I found that M5Core2.PowerLed = true turns off the PowerLed and a value of false turns it on. I expected this would be the opposite way around, i.e. true PowerLed on and false PowerLed off.
I'm fairly new to electronics and the M5Core2 in particular, so I'm not sure where the original code came from for this, i.e. M5Core2 spec or datasheet. So whilst this change works the original code did look like it makes perfect sense, and it would be good if somebody has the spec sheet for this to double check the logic.
How Has This Been Tested?
On the M5Core2 I originally set used the code M5Core2.PowerLed = true expecting the PowerLed to turn on. It didn't. So I switched to M5Core2.PowerLed = false and the PowerLed turned on.
I then looked at the code and tested again but this time by calling M5Core2.Power.Pwm1DutyCycleSetting1 and M5Core2.Power.Pwm1DutyCycleSetting2 directly to see that the logic that this worked correctly. I then made the changes to switch the logic in the nanoFramework.M5Stack assembly. I rebuilt the project and dropped the binary and support files into the package location of the original downloaded NuGet Package and run in my little test app. The PowerLed now seems to turn on/off correctly, i.e. PowerLed = true, led is on and false its off.
Screenshots
Types of changes
Checklist: