Skip to content

Commit

Permalink
fixed buttons report data processing
Browse files Browse the repository at this point in the history
  • Loading branch information
Yury Vostrenkov committed Feb 25, 2020
1 parent 0d95cad commit ec645a7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Inc/common_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

//#define DEBUG

#define FIRMWARE_VERSION 0x1342 // v1.3.4b2
#define FIRMWARE_VERSION 0x1343 // v1.3.4b3
#define USED_PINS_NUM 30 // constant for BluePill and BlackPill boards
#define MAX_AXIS_NUM 8 // max 8
#define MAX_BUTTONS_NUM 128 // power of 2, max 128
Expand Down
2 changes: 1 addition & 1 deletion Inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

static const dev_config_t init_config =
{
.firmware_version = 0x1342, // do not change
.firmware_version = 0x1343, // do not change

/*
Name of device in devices dispatcher
Expand Down
Binary file modified MDK-ARM/FreeJoy.bin
Binary file not shown.
6 changes: 3 additions & 3 deletions Src/analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,9 @@ void AxesProcess (dev_config_t * p_dev_config)

axes_buttons[i][0].current_state = buttons_state[p_dev_config->axis_config[i].decrement_button].current_state;
axes_buttons[i][1].current_state = buttons_state[p_dev_config->axis_config[i].increment_button].current_state;
axes_buttons[i][2].current_state = buttons_state[p_dev_config->axis_config[i].center_button].current_state;
axes_buttons[i][2].current_state = buttons_state[p_dev_config->axis_config[i].center_button].current_state;

// decrement
// decrement
if (axes_buttons[i][0].current_state && !axes_buttons[i][0].prev_state)
{
tmp32 -= AXIS_FULLSCALE * p_dev_config->axis_config[i].step / 255;
Expand All @@ -500,7 +500,7 @@ void AxesProcess (dev_config_t * p_dev_config)
}

// center
if (axes_buttons[i][2].current_state && !axes_buttons[i][2].prev_state)
if (axes_buttons[i][2].current_state)
{
tmp32 = AXIS_CENTER_VALUE;
}
Expand Down
2 changes: 1 addition & 1 deletion Src/buttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ void ButtonsReadLogical (dev_config_t * p_dev_config)
// prevent not atomic read
NVIC_DisableIRQ(TIM1_UP_IRQn);

buttons_data[(i & 0xF8)>>3] &= ~(1 << (i & 0x07));
buttons_data[(k & 0xF8)>>3] &= ~(1 << (k & 0x07));
buttons_data[(k & 0xF8)>>3] |= (buttons_state[i].current_state << (k & 0x07));
k++;

Expand Down

0 comments on commit ec645a7

Please sign in to comment.