yangsong8-a1 opened a new pull request, #22189:
URL: https://github.com/apache/nuttx/pull/22189

   ## Summary
     
     Use a fixed temperature value (250, i.e. 25.0 °C) in the fake battery
     gauge driver instead of a random value generated by rand().
     
     The random temperature makes the fake gauge readings unpredictable
     across polling cycles, which is unhelpful for testing.  The other
     fields (capacity, voltage, current) are still randomized within their
     configured ranges.
     
     ## Impact
     
     Only affects the fake gauge driver 
(drivers/power/battery/battery_fakegauge.c).
     No board in the community tree enables CONFIG_BATTERY_FAKE_GAUGE.
     
     ## Testing
     
     Ubuntu 22.04, host gcc.  sim:nsh with BATTERY_GAUGE and BATTERY_FAKE_GAUGE,
     CMake, no new warnings.  A temporary test program (not part of this PR)
     calls battery_fake_gauge_register() and reads BATIOC_TEMPERATURE every
     5 s, after each run of the driver's 5 s poll work.
     
     master:
     
     battery_fake_gauge_register: 0
     open: 3
     t=5s BATIOC_TEMPERATURE: ret 0 temp 369
     t=10s BATIOC_TEMPERATURE: ret 0 temp 289
     t=15s BATIOC_TEMPERATURE: ret 0 temp 324
     t=20s BATIOC_TEMPERATURE: ret 0 temp 252
     
     With this change:
     
     battery_fake_gauge_register: 0
     open: 3
     t=5s BATIOC_TEMPERATURE: ret 0 temp 250
     t=10s BATIOC_TEMPERATURE: ret 0 temp 250
     t=15s BATIOC_TEMPERATURE: ret 0 temp 250
     t=20s BATIOC_TEMPERATURE: ret 0 temp 250
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to