void screens::bandScanMode(uint8_t state) { reset(); // start from fresh screen. best_rssi = 0; if(state==STATE_SCAN) { drawTitleBox("BAND SCANNER"); } else { drawTitleBox("RSSI SETUP"); } TV.select_font(font8x8); if(state==STATE_SCAN) { TV.select_font(font4x6); TV.draw_line(50,1*TV_Y_GRID,50, 1*TV_Y_GRID+9,WHITE); TV.print(2, SCANNER_LIST_Y_POS, "BEST:"); } else { TV.select_font(font4x6); TV.print(10, SCANNER_LIST_Y_POS, "RSSI Min: RSSI Max: "); } TV.draw_rect(0,1*TV_Y_GRID,TV_X_MAX,9, WHITE); // list frame TV.draw_rect(0,TV_ROWS - TV_SCANNER_OFFSET,TV_X_MAX,13, WHITE); // lower frame TV.select_font(font4x6); TV.print(2, (TV_ROWS - TV_SCANNER_OFFSET + 2), "5645"); TV.print(57, (TV_ROWS - TV_SCANNER_OFFSET + 2), "5800"); TV.print(111, (TV_ROWS - TV_SCANNER_OFFSET + 2), "5945"); }
void screens::seekMode(uint8_t state) { last_channel = -1; reset(); // start from fresh screen. if (state == STATE_MANUAL) { drawTitleBox("MANUAL MODE"); } else if(state == STATE_SEEK) { drawTitleBox("AUTO SEEK MODE"); } TV.draw_line(0,1*TV_Y_GRID,TV_X_MAX,1*TV_Y_GRID,WHITE); TV.printPGM(5,TV_Y_OFFSET+1*TV_Y_GRID, PSTR("BAND: ")); TV.draw_line(0,2*TV_Y_GRID,TV_X_MAX,2*TV_Y_GRID,WHITE); TV.printPGM(5 ,TV_Y_OFFSET-1+2*TV_Y_GRID, PSTR("1 2 3 4 5 6 7 8")); TV.draw_line(0,3*TV_Y_GRID,TV_X_MAX,3*TV_Y_GRID,WHITE); TV.printPGM(5,TV_Y_OFFSET+3*TV_Y_GRID, PSTR("FREQ: GHz")); TV.draw_line(0,4*TV_Y_GRID,TV_X_MAX,4*TV_Y_GRID,WHITE); TV.select_font(font4x6); TV.printPGM(5,TV_Y_OFFSET+4*TV_Y_GRID, PSTR("RSSI:")); TV.draw_line(0,5*TV_Y_GRID-4,TV_X_MAX,5*TV_Y_GRID-4,WHITE); // frame for tune graph TV.draw_rect(0,TV_ROWS - TV_SCANNER_OFFSET,TV_X_MAX,13, WHITE); // lower frame TV.print(2, (TV_ROWS - TV_SCANNER_OFFSET + 2), "5645"); TV.print(57, (TV_ROWS - TV_SCANNER_OFFSET + 2), "5800"); TV.print(111, (TV_ROWS - TV_SCANNER_OFFSET + 2), "5945"); }
void screens::reset() { TV.clear_screen(); TV.select_font(font8x8); }
void screens::updateSave(const char * msg) { TV.select_font(font4x6); TV.print(((127-strlen(msg)*4)/2), 14+5*MENU_Y_SIZE, msg); }
void screens::updateSeekMode(uint8_t state, uint8_t channelIndex, uint8_t channel, uint8_t rssi, uint16_t channelFrequency, bool locked) { // display refresh handler TV.select_font(font8x8); if(channelIndex != last_channel) // only updated on changes { // show current used channel of bank if(channelIndex > 31) { TV.printPGM(50,TV_Y_OFFSET+1*TV_Y_GRID, PSTR("C/Race ")); } else if(channelIndex > 23) { TV.printPGM(50,TV_Y_OFFSET+1*TV_Y_GRID, PSTR("F/Airwave")); } else if (channelIndex > 15) { TV.printPGM(50,TV_Y_OFFSET+1*TV_Y_GRID, PSTR("E ")); } else if (channelIndex > 7) { TV.printPGM(50,TV_Y_OFFSET+1*TV_Y_GRID, PSTR("B ")); } else { TV.printPGM(50,TV_Y_OFFSET+1*TV_Y_GRID, PSTR("A ")); } // show channel inside band uint8_t active_channel = channelIndex%CHANNEL_BAND_SIZE; // get channel inside band TV.draw_rect(1 ,TV_Y_OFFSET-2+2*TV_Y_GRID,125,12, BLACK, BLACK); // mark current channel TV.printPGM(5 ,TV_Y_OFFSET-1+2*TV_Y_GRID, PSTR("1 2 3 4 5 6 7 8")); // set new marker TV.draw_rect(active_channel*16+2 ,TV_Y_OFFSET-2+2*TV_Y_GRID,12,12, WHITE, INVERT); // mark current channel // clear last square TV.draw_rect(1, (TV_ROWS - TV_SCANNER_OFFSET + 8),125,SCANNER_MARKER_SIZE, BLACK, BLACK); // draw next TV.draw_rect((channel * 3)+5, (TV_ROWS - TV_SCANNER_OFFSET + 8),SCANNER_MARKER_SIZE,SCANNER_MARKER_SIZE, WHITE, WHITE); // show frequence TV.print(50,TV_Y_OFFSET+3*TV_Y_GRID, channelFrequency); } // show signal strength #define RSSI_BAR_SIZE 100 uint8_t rssi_scaled=map(rssi, 1, 100, 1, RSSI_BAR_SIZE); // clear last bar TV.draw_rect(25, TV_Y_OFFSET+4*TV_Y_GRID, RSSI_BAR_SIZE,4 , BLACK, BLACK); // draw new bar TV.draw_rect(25, TV_Y_OFFSET+4*TV_Y_GRID, rssi_scaled, 4 , WHITE, WHITE); // print bar for spectrum #define SCANNER_BAR_MINI_SIZE 14 rssi_scaled=map(rssi, 1, 100, 1, SCANNER_BAR_MINI_SIZE); // clear last bar TV.draw_rect((channel * 3)+4, (TV_ROWS - TV_SCANNER_OFFSET - SCANNER_BAR_MINI_SIZE), 2, SCANNER_BAR_MINI_SIZE , BLACK, BLACK); // draw new bar TV.draw_rect((channel * 3)+4, (TV_ROWS - TV_SCANNER_OFFSET - rssi_scaled), 2, rssi_scaled , WHITE, WHITE); // handling for seek mode after screen and RSSI has been fully processed if(state == STATE_SEEK) { // SEEK MODE if(last_channel != channelIndex) { // fix title flicker TV.draw_rect(0,0,127,14, WHITE,BLACK); if(locked) { TV.printPGM(((127-14*8)/2), TV_Y_OFFSET, PSTR("AUTO MODE LOCK")); } else { TV.printPGM(((127-14*8)/2), TV_Y_OFFSET, PSTR("AUTO MODE SEEK")); } TV.draw_rect(0,0,127,14, WHITE,INVERT); } } last_channel = channelIndex; }