mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-17 01:52:02 +00:00
fix bug when long press of buttons breaks usb communication in bootloader, bump bl version to 1.3.1
This commit is contained in:
parent
5f203d0a0c
commit
ee3a7cbcfa
@ -22,14 +22,14 @@
|
|||||||
|
|
||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 3
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 1
|
||||||
|
|
||||||
#define STR(X) #X
|
#define STR(X) #X
|
||||||
#define VERSTR(X) STR(X)
|
#define VERSTR(X) STR(X)
|
||||||
|
|
||||||
#define VERSION_MAJOR_CHAR "\x01"
|
#define VERSION_MAJOR_CHAR "\x01"
|
||||||
#define VERSION_MINOR_CHAR "\x03"
|
#define VERSION_MINOR_CHAR "\x03"
|
||||||
#define VERSION_PATCH_CHAR "\x00"
|
#define VERSION_PATCH_CHAR "\x01"
|
||||||
|
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
|
@ -485,23 +485,38 @@ void usbInit(void)
|
|||||||
|
|
||||||
void checkButtons(void)
|
void checkButtons(void)
|
||||||
{
|
{
|
||||||
|
static bool btn_left = false, btn_right = false, btn_final = false;
|
||||||
|
if (btn_final) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint16_t state = gpio_port_read(BTN_PORT);
|
uint16_t state = gpio_port_read(BTN_PORT);
|
||||||
if ((state & (BTN_PIN_YES | BTN_PIN_NO)) != (BTN_PIN_YES | BTN_PIN_NO)) {
|
if ((state & (BTN_PIN_YES | BTN_PIN_NO)) != (BTN_PIN_YES | BTN_PIN_NO)) {
|
||||||
if ((state & BTN_PIN_NO) != BTN_PIN_NO) {
|
if ((state & BTN_PIN_NO) != BTN_PIN_NO) {
|
||||||
oledInvert(0, 0, 3, 3);
|
btn_left = true;
|
||||||
}
|
}
|
||||||
if ((state & BTN_PIN_YES) != BTN_PIN_YES) {
|
if ((state & BTN_PIN_YES) != BTN_PIN_YES) {
|
||||||
oledInvert(OLED_WIDTH - 4, 0, OLED_WIDTH - 1, 3);
|
btn_right = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (btn_left) {
|
||||||
|
oledBox(0, 0, 3, 3, true);
|
||||||
|
}
|
||||||
|
if (btn_right) {
|
||||||
|
oledBox(OLED_WIDTH - 4, 0, OLED_WIDTH - 1, 3, true);
|
||||||
|
}
|
||||||
|
if (btn_left || btn_right) {
|
||||||
oledRefresh();
|
oledRefresh();
|
||||||
}
|
}
|
||||||
|
if (btn_left && btn_right) {
|
||||||
|
btn_final = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void usbLoop(void)
|
void usbLoop(void)
|
||||||
{
|
{
|
||||||
for (;;) {
|
for (;;) {
|
||||||
usbd_poll(usbd_dev);
|
usbd_poll(usbd_dev);
|
||||||
if (flash_state == STATE_READY || flash_state == STATE_OPEN) {
|
if (!firmware_present && (flash_state == STATE_READY || flash_state == STATE_OPEN)) {
|
||||||
checkButtons();
|
checkButtons();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user