mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2024-11-28 08:20:51 +01:00
iidxio-bio2: Properly fix flushing on shutdown
Moved this hardware/iidxio impl specific logic from vigem-iidxio to iidxio-bio2. Other hardware impls should follow this if necessary to ensure a transparent and deterministic interface (as good as possible)
This commit is contained in:
parent
ce5b1b2eac
commit
a1a67697c4
@ -166,6 +166,15 @@ bool iidx_io_init(
|
||||
|
||||
void iidx_io_fini(void)
|
||||
{
|
||||
// Pushing some final state before closing the IO to the actual outputs, e.g. lights on/off
|
||||
// can be a bit finicky. Do a few polls to "enforce"/flush this final state
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
iidx_io_ep1_send();
|
||||
iidx_io_ep2_recv();
|
||||
|
||||
Sleep(10);
|
||||
}
|
||||
|
||||
running = false;
|
||||
|
||||
while (processing_io) {
|
||||
|
@ -251,23 +251,7 @@ static void _all_lights_off()
|
||||
iidx_io_ep1_set_panel_lights(0);
|
||||
iidx_io_ep1_set_top_lamps(0);
|
||||
iidx_io_ep1_set_top_neons(false);
|
||||
}
|
||||
|
||||
static void _all_lights_off_shutdown()
|
||||
{
|
||||
// Cleanup, turn all lights off
|
||||
_all_lights_off();
|
||||
|
||||
// Depending on the IO, pushing the state to the actual outputs, e.g. lights on/off
|
||||
// can be a bit finicky. Do a few times to "enforce" the state
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
iidx_io_ep1_send();
|
||||
// Required to handle iidxio-ezusb specific quirks with flushing 16seg text
|
||||
iidx_io_ep2_recv();
|
||||
iidx_io_ep3_write_16seg(" ");
|
||||
|
||||
Sleep(10);
|
||||
}
|
||||
iidx_io_ep3_write_16seg(" ");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@ -418,8 +402,6 @@ int main(int argc, char **argv)
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
_all_lights_off_shutdown();
|
||||
|
||||
for (uint8_t i = 0; i < JOYSTICKS_NUM; i++) {
|
||||
vigem_target_remove(client, pad[i]);
|
||||
vigem_target_free(pad[i]);
|
||||
@ -429,6 +411,8 @@ int main(int argc, char **argv)
|
||||
|
||||
Sleep(1000);
|
||||
|
||||
_all_lights_off();
|
||||
|
||||
iidx_io_fini();
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user