application: show additional detection on OLED
This commit is contained in:
parent
e1a3ebb5ef
commit
5434633fb3
|
@ -1424,8 +1424,6 @@ void main(void)
|
|||
// setup OLED display
|
||||
oled_text_setup();
|
||||
oled_text_clear();
|
||||
oled_text_line(lcd_default_line1, 0);
|
||||
oled_text_line(lcd_default_line2, 1);
|
||||
oled_text_update();
|
||||
|
||||
// setup USB connectors
|
||||
|
@ -1478,9 +1476,7 @@ void main(void)
|
|||
lcd_hd44780_clear_display();
|
||||
lcd_hd44780_write_line(false, lcd_interactive_line1, strlen(lcd_interactive_line1));
|
||||
lcd_hd44780_write_line(true, lcd_interactive_line2, strlen(lcd_interactive_line2));
|
||||
oled_text_clear();
|
||||
oled_text_line(lcd_interactive_line1, 0);
|
||||
oled_text_line(lcd_interactive_line2, 1);
|
||||
oled_text_clear(); // nothing to show on additional display
|
||||
oled_text_update();
|
||||
}
|
||||
char c = user_input_get(); // store receive character
|
||||
|
@ -1497,9 +1493,7 @@ void main(void)
|
|||
lcd_hd44780_clear_display(); // be sure the display is cleared
|
||||
lcd_hd44780_write_line(false, lcd_default_line1, strlen(lcd_default_line1));
|
||||
lcd_hd44780_write_line(true, lcd_default_line2, strlen(lcd_default_line2));
|
||||
oled_text_clear();
|
||||
oled_text_line(lcd_default_line1, 0);
|
||||
oled_text_line(lcd_default_line2, 1);
|
||||
oled_text_clear(); // nothing to show on additional display
|
||||
oled_text_update();
|
||||
cable_clear(cable_current); // clear definition
|
||||
}
|
||||
|
@ -1536,46 +1530,46 @@ void main(void)
|
|||
lcd_hd44780_clear_display(); // be sure the display is cleared
|
||||
lcd_hd44780_write_line(false, lcd_default_line1, strlen(lcd_default_line1));
|
||||
lcd_hd44780_write_line(true, lcd_default_line2, strlen(lcd_default_line2));
|
||||
oled_text_clear();
|
||||
oled_text_line(lcd_default_line1, 0);
|
||||
oled_text_line(lcd_default_line2, 1);
|
||||
oled_text_clear(); // nothing to show on additional display
|
||||
oled_text_update();
|
||||
} else { // there is a new confirmed cable
|
||||
cable_load(cable_current); // check if there is a load
|
||||
cable_issues(cable_current); // get the exact issues
|
||||
lcd_hd44780_clear_display(); // clear display
|
||||
oled_text_clear();
|
||||
oled_text_clear(); // clear additional dispaly
|
||||
if (cable_current->cable_best < LENGTH(usb_cables) && cable_current->cable_best < LENGTH(cable_current->unconnected_nb) && cable_current->cable_best < LENGTH(cable_current->unspecified_nb)) {
|
||||
const struct usb_cable_t* usb_cable = &usb_cables[cable_current->cable_best];
|
||||
lcd_hd44780_write_line(false, usb_cable->name, strlen(usb_cable->name));
|
||||
oled_text_line(usb_cable->name, 0);
|
||||
char line[17] = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\0'}; // line to display
|
||||
if (cable_current->load) {
|
||||
snprintf(line, LENGTH(line), "with load");
|
||||
} else {
|
||||
snprintf(line, LENGTH(line), "without load");
|
||||
}
|
||||
oled_text_line(line, 2);
|
||||
uint16_t issues = cable_current->unconnected_nb[cable_current->cable_best] + cable_current->unspecified_nb[cable_current->cable_best];
|
||||
if (0 == issues) {
|
||||
const char* line2 = "perfect match";
|
||||
lcd_hd44780_write_line(true, line2, strlen(line2));
|
||||
oled_text_line(line2, 1);
|
||||
} else {
|
||||
const char* line2 = "closest match";
|
||||
lcd_hd44780_write_line(true, line2, strlen(line2));
|
||||
snprintf(line, LENGTH(line), "issues: %u", issues);
|
||||
oled_text_line(line, 3);
|
||||
}
|
||||
snprintf(line, LENGTH(line), "w/%c load", cable_current->load ? 'i' : 'o');
|
||||
oled_text_line(line, 0);
|
||||
snprintf(line, LENGTH(line), "uncon.: %u", cable_current->unconnected_nb[cable_current->cable_best]);
|
||||
oled_text_line(line, 1);
|
||||
snprintf(line, LENGTH(line), "unspe.: %u", cable_current->unspecified_nb[cable_current->cable_best]);
|
||||
oled_text_line(line, 2);
|
||||
snprintf(line, LENGTH(line), "option: %u", cable_current->optional_nb[cable_current->cable_best]);
|
||||
oled_text_line(line, 3);
|
||||
} else {
|
||||
const char* line1 = "no matching";
|
||||
const char* line2 = "cable found";
|
||||
lcd_hd44780_write_line(false, line1, strlen(line1));
|
||||
lcd_hd44780_write_line(true, line2, strlen(line2));
|
||||
oled_text_line(line1, 0);
|
||||
oled_text_line(line2, 1);
|
||||
}
|
||||
oled_text_update();
|
||||
oled_text_update(); // update additional display
|
||||
}
|
||||
} else if (cable_current->cable_best < LENGTH(usb_cables) && cable_current->cable_best < LENGTH(cable_current->unconnected_nb) && cable_current->cable_best < LENGTH(cable_current->unspecified_nb)) { // the cable did not change, and there is a valid cable plugged in
|
||||
// fix time (RTC integer overflow is possible, but only happens after 13 years without reset)
|
||||
|
|
Loading…
Reference in New Issue