Fix air tower switch order

This commit is contained in:
whowechina
2024-03-09 18:46:21 +08:00
parent 0af0d10dd5
commit 51886eb39c
3 changed files with 6 additions and 7 deletions
+2 -3
View File
@@ -64,10 +64,9 @@ static inline uint8_t air_bits(int dist)
{
int offset= chu_cfg->tof.offset * 10;
int pitch = chu_cfg->tof.pitch * 10;
int bit1 = (dist - offset) / pitch;
int bit2 = (dist - offset + pitch / 2) / pitch;
int bit = (dist - offset) / pitch;
return ((1 << bit1) | (1 << bit2)) & 0x3f;
return (1 << bit) & 0x3f;
}
static inline bool dist_valid(int dist)
+1 -1
View File
@@ -8,7 +8,7 @@
#define I2C_PORT i2c1
#define I2C_SDA 26
#define I2C_SCL 27
#define I2C_FREQ 1333*1000
#define I2C_FREQ 1367*1000
#define TOF_MUX_LIST { 3, 4, 5, 2, 1, 0, 11, 12, 13, 10, 9, 8}
+3 -3
View File
@@ -83,12 +83,12 @@ static void gen_joy_report()
last_coin_pressed = coin_pressed;
uint16_t air[6][2] = {
{ 0, 1 << 13 },
{ 1 << 13, 0 },
{ 0, 1 << 12 },
{ 0, 1 << 13 },
{ 1 << 12, 0 },
{ 0, 1 << 11 },
{ 0, 1 << 12 },
{ 1 << 11, 0 },
{ 0, 1 << 11 },
};
uint8_t airkey = air_bitmap();