|
@@ -6326,85 +6326,6 @@ void unload_filament(bool automatic)
|
|
|
|
|
|
}
|
|
|
|
|
|
-unsigned char lcd_choose_color() {
|
|
|
- //function returns index of currently chosen item
|
|
|
- //following part can be modified from 2 to 255 items:
|
|
|
- //-----------------------------------------------------
|
|
|
- unsigned char items_no = 2;
|
|
|
- const char *item[items_no];
|
|
|
- item[0] = "Orange";
|
|
|
- item[1] = "Black";
|
|
|
- //-----------------------------------------------------
|
|
|
- uint_least8_t active_rows;
|
|
|
- static int first = 0;
|
|
|
- int enc_dif = 0;
|
|
|
- unsigned char cursor_pos = 1;
|
|
|
- enc_dif = lcd_encoder_diff;
|
|
|
- lcd_clear();
|
|
|
- lcd_putc_at(0, 1, '>');
|
|
|
-
|
|
|
- active_rows = items_no < 3 ? items_no : 3;
|
|
|
- lcd_consume_click();
|
|
|
- while (1) {
|
|
|
- lcd_puts_at_P(0, 0, PSTR("Choose color:"));
|
|
|
- for (uint_least8_t i = 0; i < active_rows; i++) {
|
|
|
- lcd_set_cursor(1, i+1);
|
|
|
- lcd_print(item[first + i]);
|
|
|
- }
|
|
|
-
|
|
|
- manage_heater();
|
|
|
- manage_inactivity(true);
|
|
|
- proc_commands();
|
|
|
- if (abs((enc_dif - lcd_encoder_diff)) > 12) {
|
|
|
-
|
|
|
- if (enc_dif > lcd_encoder_diff) {
|
|
|
- cursor_pos--;
|
|
|
- }
|
|
|
-
|
|
|
- if (enc_dif < lcd_encoder_diff) {
|
|
|
- cursor_pos++;
|
|
|
- }
|
|
|
-
|
|
|
- if (cursor_pos > active_rows) {
|
|
|
- cursor_pos = active_rows;
|
|
|
- Sound_MakeSound(e_SOUND_TYPE_BlindAlert);
|
|
|
- if (first < items_no - active_rows) {
|
|
|
- first++;
|
|
|
- lcd_clear();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (cursor_pos < 1) {
|
|
|
- cursor_pos = 1;
|
|
|
- Sound_MakeSound(e_SOUND_TYPE_BlindAlert);
|
|
|
- if (first > 0) {
|
|
|
- first--;
|
|
|
- lcd_clear();
|
|
|
- }
|
|
|
- }
|
|
|
- lcd_putc_at(0, 1, ' ');
|
|
|
- lcd_putc_at(0, 2, ' ');
|
|
|
- lcd_putc_at(0, 3, ' ');
|
|
|
- lcd_putc_at(0, cursor_pos, '>');
|
|
|
- Sound_MakeSound(e_SOUND_TYPE_EncoderMove);
|
|
|
- enc_dif = lcd_encoder_diff;
|
|
|
- _delay(100);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if (lcd_clicked()) {
|
|
|
- Sound_MakeSound(e_SOUND_TYPE_ButtonEcho);
|
|
|
- switch(cursor_pos + first - 1) {
|
|
|
- case 0: return 1; break;
|
|
|
- case 1: return 0; break;
|
|
|
- default: return 99; break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
#include "xflash.h"
|
|
|
|
|
|
#ifdef LCD_TEST
|