1
0
mirror of https://github.com/whowechina/chu_pico.git synced 2024-11-24 02:50:11 +01:00

IR air tower support

This commit is contained in:
whowechina 2024-09-23 11:11:21 +08:00
parent d26872f8b0
commit 24f14fe8a5
5 changed files with 40 additions and 4 deletions

Binary file not shown.

View File

@ -6,6 +6,7 @@
Features:
* It's small, made for 15-17 inch screen.
* Air towers are replaced with built-in ToF sensors.
* Traditional IR Air mechanism is also provided for DIYers.
* HID lights, of course!
* 32 keys (upper and lower rows).
* Follows CrazyRedMachine's RedBoard I/O protocol.
@ -169,6 +170,20 @@ You need **4x M3*12mm screws and 4x M3 hex nuts** to fix all things.
7x silicone anti-slip pads can be applied to the bottom side of the base to provide stability when playing.
<img src="doc/silicone_pad.png" width="50%">
### IR Air Tower
This is not necessary for Chu Pico. But some people may prefer the traditional IR air tower, especially when they're using Chu Pico design for a full-sized controller.
So hereby I provide the IR air tower design, with a pair of air tower PCBs and the firmware support.
1. First, you need to order the PCBs, the gerber file is `Production\PCB\chu_air_v*.zip`. It's for both sides of the air tower.
2. Order the components, they're marked in the schematic. Then solder them to the PCB following the silkscreen.
3. For left side tower, use J1 to connect to the Raspberry Pi Pico, and for the right side tower, use J2. GPIO 3 -> A, GPIO 4 -> B, GPIO 5 -> C, ADC 0 (GPIO 26) -> Right S, ADC 1 (GPIO 27) -> Left S.
<img src="doc/air_tower_wiring.png" width="50%">
4. Steps for deployment.
I. Enable IR air tower in the firmware (command `ir enable`), this will disable ToF.
II. Enable diagnostics for IR (command `ir diagnostic`).
III. Place the air towers and watch the output of the diagnostics, higher value means beam is received.
IV. Set the baseline after the towers are properly placed (command `ir baseline`).
V. Optionally, set the sensitivity, it's a percentage of expected change (command `ir trigger <1..100>`).
### Firmware
* UF2 file is in `Production\Firmware` folder.
* For the new build, hold the BOOTSEL button while connect the USB to a PC, there will be a disk named "RPI-RP2" showed up. Drag the UF2 firmware binary file into it. That's it. There's a small hole at the bottom side of the Chu Pico, it is facing right to the BOOTSEL button.

View File

@ -6,6 +6,7 @@
**特性:**
* 它很小巧适合15-17寸屏幕。
* 空键被 ToF 距离传感器替代。
* 也提供了传统 IR Air 的机制供 DIY 玩家使用。
* HID 灯光,必须的!
* 32个按键上下两排
* 遵循 CrazyRedMachine 的 RedBoard I/O 协议。
@ -177,6 +178,20 @@ https://github.com/whowechina/
7x 个硅胶防滑垫可以贴在基座的底部,以提供游玩时候的稳定性。
<img src="doc/silicone_pad.png" width="50%">
### 红外空键
Chu Pico 本身不需要红外空键。但是有些人可能用 Chu Pico 来做一个全尺寸的控制器,它们更喜欢传统的 IR 空键。
所以我提供了 IR 空键的设计,包括一对空键 PCB 和对应的固件支持。
1. 首先,你需要下单 PCBGerber 文件在 `Production\PCB\chu_air_v*.zip`。空键的两侧都需要这个 PCB。
2. 根据原理图里的有标记,购买对应的元器件,然后按照丝印焊接到 PCB 上。
3. 左侧空键 PCB 使用 J1 连接到 Pi Pico 主控,右侧空键 PCB 使用 J2 连接。GPIO 3 -> A, GPIO 4 -> B, GPIO 5 -> C, ADC 0 (GPIO 26) -> Right S, ADC 1 (GPIO 27) -> Left S。
<img src="doc/air_tower_wiring.png" width="50%">
4. 调试上线的过程如下:
I. 在固件中启用 IR 空键(命令 `ir enable`),它会自动禁用 ToF。
II. 启用 IR 的诊断功能(命令 `ir diagnostic`)。
III. 摆放两侧的空键塔,观察诊断输出,数值高代表着对应的红外光线已经对准接收器。
IV. 在正确摆放好空键塔后,设置基线(命令 `ir baseline`)。
V. 可选,设置触发灵敏度,是一个变化率的百分比值(命令 `ir trigger <1..100>`)。
### 固件
* UF2 文件在 `Production\Firmware` 文件夹下。
* 全新烧录的话,按住 Pico Pi 的 BOOTSEL 按钮,然后连接 USB 到 PC会出现一个名为 "RPI-RP2" 的磁盘。将 UF2 固件二进制文件拖入即可。Chu Pico 的底部有一个小孔,它正对着 BOOTSEL 按钮。

BIN
doc/air_tower_wiring.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -260,7 +260,6 @@ static void air_baseline()
chu_cfg->ir.base[i] = air_ir_raw(i);
printf(" %4d", chu_cfg->ir.base[i]);
}
config_changed();
printf("\n");
}
@ -289,19 +288,26 @@ static void air_trigger(char *argv[])
static void handle_ir(int argc, char *argv[])
{
const char *usage = "Usage: ir <diagnostic|baseline>\n"
const char *usage = "Usage: ir <enable|disable|diagnostic|baseline>\n"
" ir trigger <percent>\n"
" percent: [1..100]\n";
if (argc == 1) {
const char *commands[] = { "diagnostic", "baseline" };
const char *commands[] = { "enable", "disable", "diagnostic", "baseline" };
int cmd = cli_match_prefix(commands, count_of(commands), argv[0]);
if (cmd == 0) {
air_diagnostic();
chu_cfg->ir.enabled = true;
air_init();
} else if (cmd == 1) {
chu_cfg->ir.enabled = false;
} else if (cmd == 2) {
air_diagnostic();
} else if (cmd == 3) {
air_baseline();
} else {
printf(usage);
return;
}
config_changed();
} else if (argc == 2) {
air_trigger(argv);
} else {