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

Optimization on stability

This commit is contained in:
whowechina 2023-09-16 11:37:57 +08:00
parent 2f31842136
commit 0482e01fbe
5 changed files with 13 additions and 17 deletions

Binary file not shown.

View File

@ -21,9 +21,9 @@
static const uint8_t TOF_LIST[] = TOF_MUX_LIST;
static uint16_t distances[sizeof(TOF_LIST)];
const int offset_a = 800;
const int offset_b = 1000;
const int pitch = 200;
const int offset_a = 600;
const int offset_b = 800;
const int pitch = 160;
void air_init()
{
@ -34,10 +34,8 @@ void air_init()
gpio_pull_up(TOF_SCL);
i2c_hub_init();
sleep_us(10);
for (int i = 0; i < sizeof(TOF_LIST); i++) {
sleep_us(10);
i2c_select(TOF_I2C, 1 << TOF_LIST[i]);
gp2y0e_write(TOF_I2C, 0xa8, 0); // Accumulation 0:1, 1:5, 2:30, 3:10
gp2y0e_write(TOF_I2C, 0x3f, 0x30); // Filter 0x00:7, 0x10:5, 0x20:9, 0x30:1

View File

@ -21,9 +21,7 @@ static inline void i2c_hub_init()
static inline void i2c_select(i2c_inst_t *i2c_port, uint8_t chn)
{
sleep_us(10);
i2c_write_blocking_until(i2c_port, I2C_HUB_ADDR, &chn, 1, false, time_us_64() + 1000);
sleep_us(10);
}
#endif

View File

@ -186,19 +186,19 @@ static void core1_loop()
static void core0_loop()
{
while(1) {
tud_task();
run_lights();
fps_count(0);
print_fps();
slider_update_baseline();
slider_update();
air_update();
gen_joy_report();
gen_nkro_report();
report_usb_hid();
run_lights();
slider_update_baseline();
fps_count(0);
print_fps();
tud_task();
}
}

View File

@ -18,7 +18,7 @@
#include "mpr121.h"
#define TOUCH_THRESHOLD 16
#define TOUCH_THRESHOLD 17
#define RELEASE_THRESHOLD 8
#define MPR121_ADDR 0x5A