diff --git a/Inc/common_defines.h b/Inc/common_defines.h
index 49f982c..1c62a6c 100644
--- a/Inc/common_defines.h
+++ b/Inc/common_defines.h
@@ -11,7 +11,7 @@
//#define DEBUG
-#define FIRMWARE_VERSION 0x1334 // v1.3.3b4
+#define FIRMWARE_VERSION 0x1335 // v1.3.3b5
#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
diff --git a/Inc/main.h b/Inc/main.h
index 6166318..0b4cab7 100644
--- a/Inc/main.h
+++ b/Inc/main.h
@@ -18,7 +18,7 @@
static const app_config_t init_config =
{
- .firmware_version = 0x1334, // do not change
+ .firmware_version = 0x1335, // do not change
/*
Name of device in devices dispatcher
diff --git a/MDK-ARM/FreeJoy.bin b/MDK-ARM/FreeJoy.bin
index 4651268..689a863 100644
Binary files a/MDK-ARM/FreeJoy.bin and b/MDK-ARM/FreeJoy.bin differ
diff --git a/MDK-ARM/FreeJoy.uvoptx b/MDK-ARM/FreeJoy.uvoptx
index 20c01e6..87c6327 100644
--- a/MDK-ARM/FreeJoy.uvoptx
+++ b/MDK-ARM/FreeJoy.uvoptx
@@ -154,8 +154,8 @@
2
0
1
-
536875064
- 1
+ 536874876
+ 0
0
1
1
@@ -163,7 +163,7 @@
1
- &buttons_data[0]
+ buttons_data[4]==0
diff --git a/Src/analog.c b/Src/analog.c
index 33ddb3e..0419ebd 100644
--- a/Src/analog.c
+++ b/Src/analog.c
@@ -516,8 +516,7 @@ void AxesProcess (app_config_t * p_config)
}
}
- // disable data updating from IRQ
- NVIC_DisableIRQ(TIM1_UP_IRQn);
+
for (uint8_t i=0; iaxis_config[i].out_enabled) out_axis_data[i] = tmp[i];
else out_axis_data[i] = 0;
+ // restore IRQ
+ NVIC_EnableIRQ(TIM1_UP_IRQn);
}
- // restore IRQ
- NVIC_EnableIRQ(TIM1_UP_IRQn);
+
}
diff --git a/Src/buttons.c b/Src/buttons.c
index 4ae4c99..db75d9c 100644
--- a/Src/buttons.c
+++ b/Src/buttons.c
@@ -654,14 +654,11 @@ void ButtonsReadLogical (app_config_t * p_config)
}
}
- // disable data updating from IRQ
- NVIC_DisableIRQ(TIM1_UP_IRQn);
// convert data to report format
for (int i=0;i>3] &= ~(1 << (i & 0x07));
-
+
// buttons is mapped to shift
if (i == p_config->shift_config[0].button ||
i == p_config->shift_config[1].button ||
@@ -682,7 +679,14 @@ void ButtonsReadLogical (app_config_t * p_config)
if (!is_button_to_axis)
{
+ // disable data updating from IRQ
+ NVIC_DisableIRQ(TIM1_UP_IRQn);
+
+ buttons_data[(i & 0xF8)>>3] &= ~(1 << (i & 0x07));
buttons_data[(i & 0xF8)>>3] |= (buttons_state[i].current_state << (i & 0x07));
+
+ // restore IRQ
+ NVIC_EnableIRQ(TIM1_UP_IRQn);
}
}
@@ -720,8 +724,6 @@ void ButtonsReadLogical (app_config_t * p_config)
break;
}
}
- // restore IRQ
- NVIC_EnableIRQ(TIM1_UP_IRQn);
}
/**
diff --git a/Src/stm32f10x_it.c b/Src/stm32f10x_it.c
index d370f32..d5b581e 100644
--- a/Src/stm32f10x_it.c
+++ b/Src/stm32f10x_it.c
@@ -40,9 +40,6 @@
/* Private variables ---------------------------------------------------------*/
volatile int32_t millis =0, joy_millis=0;
extern app_config_t config;
-joy_report_t joy_report;
-uint8_t btn_num = 0;
-uint8_t physical_buttons_data[MAX_BUTTONS_NUM];
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
@@ -201,6 +198,9 @@ void TIM3_IRQHandler(void)
void TIM1_UP_IRQHandler(void)
{
+ uint8_t btn_num = 0;
+ uint8_t physical_buttons_data[MAX_BUTTONS_NUM];
+ joy_report_t joy_report;
if (TIM_GetITStatus(TIM1, TIM_IT_Update))
{