feat: update PowerManagement voltage calculation logic#74
Conversation
include/PowerManagement.h
Outdated
There was a problem hiding this comment.
We can't include Arduino.h or pins.h within Avionics because it breaks Native compatibility and assumes the fight computer has a pins.h . We don't need pins.h because the pin is passed in.
You should always use ArduinoHAL.h instead of Arduino.h within Avionics
If you add a test in Native, you'll see that analogReadResolution doesn't exists in ArduinoHAL.h yet, so it'll needed to be added. Basically, you just need to put a mock version of the function analogReadResolution in HAL. The same problem will be there for analogRead(pin) and you can have that just return a hard coded value in HAL.
There was a problem hiding this comment.
I have made changes to ArduinoHAL and tested powermanagement in native. Im not sure if i understand this right, but the functions in arduinoHAL are just to simulate arduino for testing, right? Does the normal version of Arduino.h get used when running avionics on martha?
There was a problem hiding this comment.
also ive pushed some tests for powermanagement to native, if you want to check them. not sure what else to test
There was a problem hiding this comment.
You're correct, ArduinoHAL checks if you are actually on an Arduino or not. If you are on a real Arduino, it uses the real functions, otherwise it redirects to the mocks.
Description
Summary of Changes
Motivation
Testing
Check all that apply:
Building
Checklist