Skip to content

Commit 9ab298c

Browse files
committed
Fix wrong initialization of 'pinPowerPresent' pin that would prevent the touchpanel from working correctly when the device boots while connected to the charger.
1 parent 9342d62 commit 9ab298c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/systemtask/SystemTask.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,19 @@ void SystemTask::Work() {
149149

150150
nrfx_gpiote_in_init(pinTouchIrq, &pinConfig, nrfx_gpiote_evt_handler);
151151

152-
nrf_gpio_cfg_sense_input(pinPowerPresentIrq, (nrf_gpio_pin_pull_t) NRF_GPIO_PIN_NOPULL, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_Low);
153-
154152
pinConfig.sense = NRF_GPIOTE_POLARITY_TOGGLE;
155153
pinConfig.pull = NRF_GPIO_PIN_NOPULL;
156154
pinConfig.is_watcher = false;
157155
pinConfig.hi_accuracy = false;
158156
pinConfig.skip_gpio_setup = true;
159-
160157
nrfx_gpiote_in_init(pinPowerPresentIrq, &pinConfig, nrfx_gpiote_evt_handler);
161158

159+
if (nrf_gpio_pin_read(pinPowerPresentIrq)) {
160+
nrf_gpio_cfg_sense_input(pinPowerPresentIrq, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW);
161+
} else {
162+
nrf_gpio_cfg_sense_input(pinPowerPresentIrq, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH);
163+
}
164+
162165
idleTimer = xTimerCreate("idleTimer", pdMS_TO_TICKS(settingsController.GetScreenTimeOut()), pdFALSE, this, IdleTimerCallback);
163166
xTimerStart(idleTimer, 0);
164167

0 commit comments

Comments
 (0)