Added firmware update indication to display
This commit is contained in:
parent
b36e5dd057
commit
819b9a9af5
2
Config.h
2
Config.h
@ -303,6 +303,8 @@
|
||||
uint8_t battery_state = 0x00;
|
||||
uint8_t display_intensity = 0xFF;
|
||||
bool device_init_done = false;
|
||||
bool eeprom_ok = false;
|
||||
bool firmware_update_mode = false;
|
||||
|
||||
// Boot flags
|
||||
#define START_FROM_BOOTLOADER 0x01
|
||||
|
23
Display.h
23
Display.h
@ -273,12 +273,18 @@ void draw_stat_area() {
|
||||
}
|
||||
|
||||
void update_stat_area() {
|
||||
draw_stat_area();
|
||||
if (disp_mode == DISP_MODE_PORTRAIT) {
|
||||
display.drawBitmap(p_as_x, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), SSD1306_WHITE, SSD1306_BLACK);
|
||||
} else if (disp_mode == DISP_MODE_LANDSCAPE) {
|
||||
display.drawBitmap(p_as_x+2, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), SSD1306_WHITE, SSD1306_BLACK);
|
||||
display.drawLine(p_as_x, 0, p_as_x, 64, SSD1306_WHITE);
|
||||
if (eeprom_ok && !firmware_update_mode) {
|
||||
draw_stat_area();
|
||||
if (disp_mode == DISP_MODE_PORTRAIT) {
|
||||
display.drawBitmap(p_as_x, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), SSD1306_WHITE, SSD1306_BLACK);
|
||||
} else if (disp_mode == DISP_MODE_LANDSCAPE) {
|
||||
display.drawBitmap(p_as_x+2, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), SSD1306_WHITE, SSD1306_BLACK);
|
||||
if (device_init_done) display.drawLine(p_as_x, 0, p_as_x, 64, SSD1306_WHITE);
|
||||
}
|
||||
} else {
|
||||
if (firmware_update_mode) {
|
||||
// Indicate firmware update spinner
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,8 +292,9 @@ void update_stat_area() {
|
||||
const uint8_t pages = 3;
|
||||
uint8_t disp_page = START_PAGE;
|
||||
void draw_disp_area() {
|
||||
if (!device_init_done) {
|
||||
disp_area.drawBitmap(0, 37, bm_boot, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
|
||||
if (!device_init_done || firmware_update_mode) {
|
||||
if (!device_init_done) disp_area.drawBitmap(0, 37, bm_boot, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
|
||||
if (firmware_update_mode) disp_area.drawBitmap(0, 37, bm_fw_update, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
|
||||
} else {
|
||||
if (!disp_ext_fb or bt_ssp_pin != 0) {
|
||||
if (device_signatures_ok()) {
|
||||
|
@ -47,6 +47,7 @@
|
||||
#define CMD_DEV_SIG 0x57
|
||||
#define CMD_FW_HASH 0x58
|
||||
#define CMD_HASHES 0x60
|
||||
#define CMD_FW_UPD 0x61
|
||||
#define CMD_UNLOCK_ROM 0x59
|
||||
#define ROM_UNLOCK_BYTE 0xF8
|
||||
#define CMD_RESET 0x55
|
||||
|
17
Graphics.h
17
Graphics.h
@ -44,6 +44,23 @@ const unsigned char bm_boot [] PROGMEM = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||
};
|
||||
|
||||
const unsigned char bm_fw_update [] PROGMEM = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xfc, 0x98, 0x70, 0xf1, 0xc3, 0x33, 0x38, 0x7f, 0xfc, 0x99, 0x32, 0x64, 0xe7, 0x31, 0x33, 0xff,
|
||||
0xfc, 0x98, 0x72, 0x60, 0xe7, 0x30, 0x32, 0x7f, 0xfc, 0x99, 0xf2, 0x64, 0xe7, 0x32, 0x32, 0x7f,
|
||||
0xfe, 0x39, 0xf0, 0xe4, 0xe7, 0x33, 0x38, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xf8, 0x66, 0x1c, 0xe6, 0x73, 0x8e, 0x1c, 0x3f, 0xf9, 0xe6, 0x4c, 0x46, 0x53, 0x26, 0x4c, 0xff,
|
||||
0xf8, 0x66, 0x1c, 0x06, 0x53, 0x06, 0x1c, 0x3f, 0xf9, 0xe6, 0x1c, 0xa6, 0x03, 0x26, 0x1c, 0xff,
|
||||
0xf9, 0xe6, 0x4c, 0xe7, 0x27, 0x26, 0x4c, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||
};
|
||||
|
||||
const unsigned char bm_version [] PROGMEM = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
|
@ -702,6 +702,12 @@ void serialCallback(uint8_t sbyte) {
|
||||
device_save_signature();
|
||||
}
|
||||
#endif
|
||||
} else if (command == CMD_FW_UPD) {
|
||||
if (sbyte == 0x01) {
|
||||
firmware_update_mode = true;
|
||||
} else {
|
||||
firmware_update_mode = false;
|
||||
}
|
||||
} else if (command == CMD_HASHES) {
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
if (sbyte == 0x01) {
|
||||
@ -866,6 +872,7 @@ void validate_status() {
|
||||
if (eeprom_lock_set()) {
|
||||
if (eeprom_product_valid() && eeprom_model_valid() && eeprom_hwrev_valid()) {
|
||||
if (eeprom_checksum_valid()) {
|
||||
eeprom_ok = true;
|
||||
#if PLATFORM == PLATFORM_ESP32
|
||||
if (device_init()) {
|
||||
hw_ready = true;
|
||||
@ -881,12 +888,32 @@ void validate_status() {
|
||||
op_mode = MODE_TNC;
|
||||
startRadio();
|
||||
}
|
||||
} else {
|
||||
hw_ready = false;
|
||||
#if HAS_DISPLAY
|
||||
if (disp_ready) {
|
||||
device_init_done = true;
|
||||
update_display();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
hw_ready = false;
|
||||
#if HAS_DISPLAY
|
||||
if (disp_ready) {
|
||||
device_init_done = true;
|
||||
update_display();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
hw_ready = false;
|
||||
#if HAS_DISPLAY
|
||||
if (disp_ready) {
|
||||
device_init_done = true;
|
||||
update_display();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
hw_ready = false;
|
||||
@ -940,6 +967,7 @@ void loop() {
|
||||
if (hw_ready) {
|
||||
led_indicate_standby();
|
||||
} else {
|
||||
|
||||
led_indicate_not_ready();
|
||||
stopRadio();
|
||||
}
|
||||
|
12
Utilities.h
12
Utilities.h
@ -652,7 +652,8 @@ void kiss_indicate_fbstate() {
|
||||
|
||||
void kiss_indicate_target_fw_hash() {
|
||||
serial_write(FEND);
|
||||
serial_write(CMD_DEV_HASH);
|
||||
serial_write(CMD_HASHES);
|
||||
serial_write(0x01);
|
||||
for (int i = 0; i < DEV_HASH_LEN; i++) {
|
||||
uint8_t byte = dev_firmware_hash_target[i];
|
||||
escaped_serial_write(byte);
|
||||
@ -662,7 +663,8 @@ void kiss_indicate_fbstate() {
|
||||
|
||||
void kiss_indicate_fw_hash() {
|
||||
serial_write(FEND);
|
||||
serial_write(CMD_DEV_HASH);
|
||||
serial_write(CMD_HASHES);
|
||||
serial_write(0x02);
|
||||
for (int i = 0; i < DEV_HASH_LEN; i++) {
|
||||
uint8_t byte = dev_firmware_hash[i];
|
||||
escaped_serial_write(byte);
|
||||
@ -672,7 +674,8 @@ void kiss_indicate_fbstate() {
|
||||
|
||||
void kiss_indicate_bootloader_hash() {
|
||||
serial_write(FEND);
|
||||
serial_write(CMD_DEV_HASH);
|
||||
serial_write(CMD_HASHES);
|
||||
serial_write(0x03);
|
||||
for (int i = 0; i < DEV_HASH_LEN; i++) {
|
||||
uint8_t byte = dev_bootloader_hash[i];
|
||||
escaped_serial_write(byte);
|
||||
@ -682,7 +685,8 @@ void kiss_indicate_fbstate() {
|
||||
|
||||
void kiss_indicate_partition_table_hash() {
|
||||
serial_write(FEND);
|
||||
serial_write(CMD_DEV_HASH);
|
||||
serial_write(CMD_HASHES);
|
||||
serial_write(0x04);
|
||||
for (int i = 0; i < DEV_HASH_LEN; i++) {
|
||||
uint8_t byte = dev_partition_table_hash[i];
|
||||
escaped_serial_write(byte);
|
||||
|
Loading…
Reference in New Issue
Block a user