Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src-slider_io/src/device/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use serde_json::Value;
pub enum HardwareSpec {
TasollerOne,
TasollerTwo,
TasollerPlus,
Yuancon,
YuanconThree,
Yubideck,
Expand Down Expand Up @@ -47,6 +48,10 @@ impl DeviceMode {
spec: HardwareSpec::TasollerTwo,
disable_air: v["disableAirStrings"].as_bool()?,
},
"tasoller-plus" => DeviceMode::Hardware {
spec: HardwareSpec::TasollerPlus,
disable_air: v["disableAirStrings"].as_bool()?,
},
"yuancon" => DeviceMode::Hardware {
spec: HardwareSpec::Yuancon,
disable_air: v["disableAirStrings"].as_bool()?,
Expand Down
60 changes: 56 additions & 4 deletions src-slider_io/src/device/hid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,58 @@ impl HidJob {
}
},
),
HardwareSpec::TasollerPlus => Self::new(
state.clone(),
0x0E8F,
0x1231,
0x84,
0x03,
*disable_air,
|buf, input| {
if buf.len != 36 {
return;
}

input.ground.copy_from_slice(&buf.data[4..36]);
input.flip_all();

let bits: Vec<u8> = (0..8).map(|x| (buf.data[3] >> x) & 1).collect();
input.air.copy_from_slice(&bits[0..6]);
input.air.reverse();

input.extra[0] = bits[7];
input.extra[1] = bits[6];
},
WriteType::Bulk,
|buf, _, lights| {
buf.len = 114;
buf.data[0] = 'D' as u8;
buf.data[1] = 'L' as u8;
buf.data[2] = 0x02;

for (buf_chunk, state_chunk) in buf.data[3..96]
.chunks_mut(3)
.take(31)
.zip(lights.ground.chunks(3).rev())
{
buf_chunk.copy_from_slice(state_chunk);
}

for (buf_chunk, state_chunk) in buf.data[96..105]
.chunks_mut(3)
.zip(lights.air_left.chunks(3))
{
buf_chunk.copy_from_slice(state_chunk);
}

for (buf_chunk, state_chunk) in buf.data[105..114]
.chunks_mut(3)
.zip(lights.air_right.chunks(3))
{
buf_chunk.copy_from_slice(state_chunk);
}
},
),
HardwareSpec::Yuancon => Self::new(
state.clone(),
0x1973,
Expand Down Expand Up @@ -234,17 +286,17 @@ impl HidJob {
buf_two.data[0] = 1;

for (buf_chunk, state_chunk) in buf.data[1..61]
.chunks_mut(3)
.zip(lights.ground.chunks(3).skip(11).take(20).rev())
.chunks_mut(3)
.zip(lights.ground.chunks(3).skip(11).take(20).rev())
{
buf_chunk[0] = state_chunk[0];
buf_chunk[1] = state_chunk[1];
buf_chunk[2] = state_chunk[2];
}

for (buf_chunk, state_chunk) in buf_two.data[1..34]
.chunks_mut(3)
.zip(lights.ground.chunks(3).take(11).rev())
.chunks_mut(3)
.zip(lights.ground.chunks(3).take(11).rev())
{
buf_chunk[0] = state_chunk[0];
buf_chunk[1] = state_chunk[1];
Expand Down
1 change: 1 addition & 0 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
<option value="none">None</option>
<option value="tasoller-one">GAMO2 Tasoller, 1.0 HID Firmware</option>
<option value="tasoller-two">GAMO2 Tasoller, 2.0 HID Firmware</option>
<option value="tasoller-plus">GAMO2 Tasoller+ WinUSB</option>
<option value="yuancon">Yuancon Laverita, HID Firmware</option>
<option value="yuancon-three">Yuancon Laverita v3, HID Firmware</option>
<option value="yubideck">大四 / Yubideck, HID Firmware 1.0</option>
Expand Down