1
0
mirror of https://github.com/whowechina/chu_pico.git synced 2025-02-17 18:49:18 +01:00
This commit is contained in:
whowechina 2023-10-14 19:18:23 +08:00
commit a2805ceffe
4 changed files with 8 additions and 8 deletions

Binary file not shown.

View File

@ -8,6 +8,7 @@ Features:
* HID lights, of course!
* 32 keys (upper and lower rows).
* Follows CrazyRedMachine's RedBoard I/O protocol.
* Command line of rich features.
* All source files open.
Thanks to many respectful guys/companies who made their tools or materials free or open source (KiCad, OnShape, InkScape, Raspberry things).
@ -30,7 +31,7 @@ This one is relatively easy to build compared with my other projects like IIDX P
<img src="https://raw.githubusercontent.com/whowechina/mai_pico/main/doc/main.jpg" width="250px">
This Chu Pico project:
* Heavily depends on 3D printing, you need a Bambu 3D printer.
* Heavily depends on 3D printing, you need a Bambu 3D printer (X1 or P1).
* Requires skills to solder tiny components.
## **Disclaimer** ##
@ -87,7 +88,7 @@ It's CC-NC. So DIY for yourself and for your friend, don't make money from it.
<img src="doc/lgp_5.png" width="50%">
### Panel Film
* A self-adhesive **textured**/**frosted** film sheet, it is applied on top surface of the light guide panel. It improves touch feel. You can use buy window sticker film. You **MUST** use self-adhesive ones, **NOT** static cling ones. They're usually very cheap.
* A self-adhesive **textured**/**frosted** film sheet, it is applied on top surface of the light guide panel. It improves touch feel. You can use window sticker film. It **MUST** be self-adhesive ones, **NOT** static cling ones. They're usually very cheap.
* Cut the film to roughly match the shape of the light guide panel, and stick to the panel.
<img src="doc/film_1.jpg" width="60%">
* Gentlely rub the film to remove any air bubbles and make it stick tightly.

View File

@ -111,8 +111,7 @@ void air_update()
if (tof_model[i] == 1) {
distances[i] = readRangeContinuousMillimeters() * 10;
} else if (tof_model[i] == 2) {
/* compensation based on observation, don't know why*/
distances[i] = gp2y0e_dist16(I2C_PORT) * 16 / 10;
distances[i] = gp2y0e_dist16_mm(I2C_PORT) * 10;
}
}
}

View File

@ -31,24 +31,24 @@ static inline bool gp2y0e_is_present(i2c_inst_t *port)
time_us_64() + 1000) == 1;
}
static inline uint8_t gp2y0e_dist(i2c_inst_t *port)
static inline uint8_t gp2y0e_dist_mm(i2c_inst_t *port)
{
uint8_t cmd[] = {0x5e};
i2c_write_blocking_until(port, GP2Y0E_DEF_ADDR, cmd, 1, true, time_us_64() + 1000);
uint8_t data;
i2c_read_blocking_until(port, GP2Y0E_DEF_ADDR, &data, 1, false, time_us_64() + 1000);
return data;
return data * 10 / 4;
}
static inline uint16_t gp2y0e_dist16(i2c_inst_t *port)
static inline uint16_t gp2y0e_dist16_mm(i2c_inst_t *port)
{
uint8_t cmd[] = {0x5e};
i2c_write_blocking_until(port, GP2Y0E_DEF_ADDR, cmd, 1, true, time_us_64() + 1000);
uint8_t data[2];
i2c_read_blocking_until(port, GP2Y0E_DEF_ADDR, data, 2, false, time_us_64() + 1000);
return (data[0] << 4) | data[1];
return ((data[0] << 4) | data[1]) * 10 / 64;
}
#endif