Skip to content

Commit 67b474f

Browse files
committed
Only suspend I2C related polling, but not the whole per10ms()
1 parent ac63171 commit 67b474f

File tree

6 files changed

+21
-9
lines changed

6 files changed

+21
-9
lines changed

radio/src/boards/rm-h750/bsp_io.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include "debug.h"
3939

4040
extern const stm32_switch_t* boardGetSwitchDef(uint8_t idx);
41-
extern bool suspendTimerTask;
41+
extern bool suspendI2CTasks;
4242

4343
struct bsp_io_expander {
4444
pca95xx_t exp;
@@ -110,7 +110,7 @@ static void _poll_switches(void *param1, uint32_t trigger_source)
110110
}
111111

112112
// Suspend hardware reads when required
113-
if (suspendTimerTask) return;
113+
if (suspendI2CTasks) return;
114114

115115
_read_io_expander(&_io_switches);
116116
_read_io_expander(&_io_fs_switches);

radio/src/edgetx.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void checkValidMCU(void)
169169
static bool evalFSok = false;
170170
#endif
171171

172-
bool suspendTimerTask = false;
172+
bool suspendI2CTasks = false;
173173

174174
void per10ms()
175175
{
@@ -178,8 +178,6 @@ void per10ms()
178178

179179
g_tmr10ms++;
180180

181-
if (suspendTimerTask) return;
182-
183181
#if defined(GUI)
184182
if (lightOffCounter) lightOffCounter--;
185183
if (flashCounter) flashCounter--;
@@ -1093,7 +1091,7 @@ void edgeTxClose(uint8_t shutdown)
10931091
TRACE("edgeTxClose");
10941092

10951093
watchdogSuspend(2000/*20s*/);
1096-
suspendTimerTask = true;
1094+
suspendI2CTasks = true;
10971095

10981096
if (shutdown) {
10991097
pulsesStop();
@@ -1145,7 +1143,7 @@ void edgeTxResume()
11451143
{
11461144
TRACE("edgeTxResume");
11471145

1148-
suspendTimerTask = false;
1146+
suspendI2CTasks = false;
11491147
if (!sdMounted()) sdInit();
11501148

11511149
luaInitMainState();

radio/src/targets/common/arm/stm32/csd203_sensor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ typedef struct {
171171
} CSD_ALERT;
172172
/*CSD ALERT Configuration struct*/
173173

174+
extern bool suspendI2CTasks;
175+
174176
void CSD203_Init(CSD_CONFIG *CSD203_CFG); // Initialise CSD203 config
175177
uint16_t CSD203_ReadVbus(CSD_CONFIG *CSD203_CFG); // Read Vbus Voltage
176178
uint16_t CSD203_ReadRshunt(CSD_CONFIG *CSD203_CFG); // Read Rshunt
@@ -410,6 +412,8 @@ void readCSD203(void)
410412
{ // 5ms
411413
static uint16_t GetSenSorStep = 0;
412414

415+
if (suspendI2CTasks) return;
416+
413417
if (IICReadStatusFlag == true) return;
414418

415419
IICReadStatusFlag = true;

radio/src/targets/pa01/key_driver.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ enum PhysicalKeys
6868
ENT = 16
6969
};
7070

71+
extern bool suspendI2CTasks;
72+
7173
static bool fct_state[4] = {false, false, false, false};
7274
static uint32_t keyState = 0;
7375
#if !defined(BOOT)
@@ -86,6 +88,9 @@ void pollKeys()
8688
}
8789
nonReadCount = 0;
8890
#endif
91+
92+
if (suspendI2CTasks) return;
93+
8994
// This function avoids concurrent matrix agitation
9095

9196
uint32_t result = 0;

radio/src/targets/st16/key_driver.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ enum PhysicalTrims {
5858
TR4R
5959
};
6060

61+
extern bool suspendI2CTasks;
62+
6163
uint32_t readTrims()
6264
{
6365
uint32_t result = 0;
66+
67+
if (suspendI2CTasks) return result;
68+
6469
uint16_t keys = bsp_input_get();
6570

6671
#define _TRIM(t) \

radio/src/targets/taranis/gx12/bsp_io.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#define IO_RESET_GPIO GPIO_PIN(GPIOE, 15)
3737

3838
extern const stm32_switch_t* boardGetSwitchDef(uint8_t idx);
39-
extern bool suspendTimerTask;
39+
extern bool suspendI2CTasks;
4040

4141
struct bsp_io_expander {
4242
pca95xx_t exp;
@@ -86,7 +86,7 @@ static void _poll_switches(void *param1, uint32_t trigger_source)
8686
}
8787

8888
// Suspend hardware reads when required
89-
if (suspendTimerTask) return;
89+
if (suspendI2CTasks) return;
9090

9191
_read_io_expander(&_io_switches);
9292
_read_io_expander(&_io_fs_switches);

0 commit comments

Comments
 (0)