JogCon: Implement command 0x44

This commit is contained in:
Stenzek 2024-12-19 12:42:01 +10:00
parent fa2442deaf
commit 7442ec2f19
No known key found for this signature in database
2 changed files with 28 additions and 0 deletions

View File

@ -376,6 +376,14 @@ bool JogCon::Transfer(const u8 data_in, u8* data_out)
m_tx_buffer = {GetIDByte(), m_status_byte, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; m_tx_buffer = {GetIDByte(), m_status_byte, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
Poll(); Poll();
} }
else if (m_configuration_mode && data_in == 0x44)
{
Assert(m_command_step == 0);
m_response_length = (GetResponseNumHalfwords() + 1) * 2;
m_command = Command::SetAnalogMode;
m_tx_buffer = {GetIDByte(), m_status_byte, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
ResetMotorConfig();
}
else if (m_configuration_mode && data_in == 0x45) else if (m_configuration_mode && data_in == 0x45)
{ {
m_response_length = (GetResponseNumHalfwords() + 1) * 2; m_response_length = (GetResponseNumHalfwords() + 1) * 2;
@ -429,6 +437,25 @@ bool JogCon::Transfer(const u8 data_in, u8* data_out)
} }
break; break;
case Command::SetAnalogMode:
{
if (m_command_step == 2)
{
DEV_LOG("analog mode val 0x{:02x}", data_in);
if (data_in == 0x00 || data_in == 0x01)
SetJogConMode(data_in == 0x01, true);
}
else if (m_command_step == 3)
{
DEV_LOG("analog mode lock 0x{:02x}", data_in);
if (data_in == 0x02 || data_in == 0x03)
WARNING_LOG("Unimplemented analog mode lock {}", (data_in == 0x03));
}
}
break;
case Command::SetMode: case Command::SetMode:
{ {
m_configuration_mode = (m_rx_buffer[2] == 1 && m_jogcon_mode); m_configuration_mode = (m_rx_buffer[2] == 1 && m_jogcon_mode);

View File

@ -71,6 +71,7 @@ private:
ReadPad, ReadPad,
SetMode, SetMode,
GetAnalogMode, GetAnalogMode,
SetAnalogMode,
GetSetRumble, GetSetRumble,
Command46, Command46,
Command47, Command47,