Correct USB power reporting for translated native controllers
This commit is contained in:
parent
dd69f3d487
commit
a407e84a39
7 changed files with 62 additions and 7 deletions
|
|
@ -290,9 +290,11 @@ uint32_t probe_native_gamepad_input_peek_native_report(uint8_t instance, uint32_
|
|||
if (g_report_token == UINT32_MAX) return 0; // Boot-unique, including across children/resets.
|
||||
memset(child.pending_report, 0, sizeof(child.pending_report));
|
||||
child.pending_report[0] = child.counter;
|
||||
// Bluepad32 zero denotes unknown; do not manufacture a full battery.
|
||||
// Battery telemetry belongs to the source; external power belongs to
|
||||
// these USB-powered virtual controllers. Unknown is not a full charge,
|
||||
// and the Pico does not charge the wireless source.
|
||||
const unsigned battery_level = (static_cast<unsigned>(g_source.battery) * 9u + 127u) / 255u;
|
||||
child.pending_report[1] = static_cast<uint8_t>(battery_level << 2);
|
||||
child.pending_report[1] = static_cast<uint8_t>((battery_level << 2) | 0x01u);
|
||||
memcpy(child.pending_report + 2, child.input.buttons, sizeof(child.input.buttons));
|
||||
child.pending_report[4] = 7;
|
||||
memcpy(child.pending_report + 5, child.input.stick, sizeof(child.input.stick));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue