forked from NaxdyOrg/NaxGCC-FW
feat(hid): distinguish "OG" from "PC" mode
This commit is contained in:
parent
818e0abf76
commit
2a01cd732a
2 changed files with 17 additions and 4 deletions
|
@ -558,6 +558,9 @@ pub enum InputConsistencyMode {
|
|||
/// to something your opponent does.
|
||||
/// The name is not meant to imply that this is a hack that is super, but rather that this is super hacky.
|
||||
SuperHack = 2,
|
||||
/// Transmit inputs every 1 ms, for use on PC or other devices that are not garbage.
|
||||
/// This is not recommended for use on the Switch!
|
||||
PC = 3,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Format, PackedStruct)]
|
||||
|
@ -1689,7 +1692,8 @@ async fn configuration_main_loop<
|
|||
// input consistency toggle
|
||||
37 => {
|
||||
final_config.input_consistency_mode = match final_config.input_consistency_mode {
|
||||
InputConsistencyMode::Original => InputConsistencyMode::ConsistencyHack,
|
||||
InputConsistencyMode::Original => InputConsistencyMode::PC,
|
||||
InputConsistencyMode::PC => InputConsistencyMode::ConsistencyHack,
|
||||
InputConsistencyMode::ConsistencyHack => InputConsistencyMode::SuperHack,
|
||||
InputConsistencyMode::SuperHack => InputConsistencyMode::Original,
|
||||
};
|
||||
|
@ -1713,6 +1717,7 @@ async fn configuration_main_loop<
|
|||
stick_y: (127_i8
|
||||
+ match final_config.input_consistency_mode {
|
||||
InputConsistencyMode::Original => -69,
|
||||
InputConsistencyMode::PC => -42,
|
||||
InputConsistencyMode::ConsistencyHack => 42,
|
||||
InputConsistencyMode::SuperHack => 69,
|
||||
}) as u8,
|
||||
|
|
|
@ -302,6 +302,7 @@ pub async fn usb_transfer_task(raw_serial: [u8; 8], driver: Driver<'static, USB>
|
|||
InputConsistencyMode::Original => "NaxGCC (OG Mode)",
|
||||
InputConsistencyMode::ConsistencyHack => "NaxGCC (Consistency Mode)",
|
||||
InputConsistencyMode::SuperHack => "NaxGCC (SuperHack Mode)",
|
||||
InputConsistencyMode::PC => "NaxGCC (PC Mode)",
|
||||
});
|
||||
usb_config.serial_number = Some(serial);
|
||||
usb_config.max_power = 200;
|
||||
|
@ -338,7 +339,12 @@ pub async fn usb_transfer_task(raw_serial: [u8; 8], driver: Driver<'static, USB>
|
|||
let hid_config = embassy_usb::class::hid::Config {
|
||||
report_descriptor: GCC_REPORT_DESCRIPTOR,
|
||||
request_handler: Some(&request_handler),
|
||||
poll_ms: 1,
|
||||
poll_ms: match input_consistency_mode {
|
||||
InputConsistencyMode::Original => 8,
|
||||
InputConsistencyMode::ConsistencyHack
|
||||
| InputConsistencyMode::SuperHack
|
||||
| InputConsistencyMode::PC => 1,
|
||||
},
|
||||
max_packet_size_in: 37,
|
||||
max_packet_size_out: 5,
|
||||
};
|
||||
|
@ -378,7 +384,7 @@ pub async fn usb_transfer_task(raw_serial: [u8; 8], driver: Driver<'static, USB>
|
|||
// "Ticker at home", so we can use this for both consistency and SuperHack mode
|
||||
Timer::at(rate_limit_end_time).await;
|
||||
}
|
||||
InputConsistencyMode::Original => {}
|
||||
InputConsistencyMode::Original | InputConsistencyMode::PC => {}
|
||||
}
|
||||
|
||||
match writer
|
||||
|
@ -395,7 +401,9 @@ pub async fn usb_transfer_task(raw_serial: [u8; 8], driver: Driver<'static, USB>
|
|||
let polltime = currtime.duration_since(last_report_time);
|
||||
let micros = polltime.as_micros();
|
||||
debug!("Report written in {}us", micros);
|
||||
if input_consistency_mode != InputConsistencyMode::Original {
|
||||
if input_consistency_mode != InputConsistencyMode::Original
|
||||
&& input_consistency_mode != InputConsistencyMode::PC
|
||||
{
|
||||
while rate_limit_end_time < currtime {
|
||||
rate_limit_end_time += Duration::from_micros(8333);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue