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:
parent
2f31842136
commit
0482e01fbe
Binary file not shown.
@ -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
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "mpr121.h"
|
||||
|
||||
#define TOUCH_THRESHOLD 16
|
||||
#define TOUCH_THRESHOLD 17
|
||||
#define RELEASE_THRESHOLD 8
|
||||
|
||||
#define MPR121_ADDR 0x5A
|
||||
|
Loading…
Reference in New Issue
Block a user