void screens::seekMode(uint8_t state) { last_channel = -1; reset(); // start from fresh screen. if (state == STATE_MANUAL) { drawTitleBox(PSTR2("MANUAL MODE")); } else if(state == STATE_SEEK) { drawTitleBox(PSTR2("AUTO SEEK MODE")); } display.setTextColor(WHITE); display.drawLine(0, 20, display.width(), 20, WHITE); display.drawLine(0, 32, display.width(), 32, WHITE); display.setCursor(5,12); display.drawLine(97,11,97,20,WHITE); display.print(PSTR2("BAND:")); for(uint16_t i=0;i<8;i++) { display.setCursor(15*i+8,23); display.print((char) (i+'1')); } display.drawLine(0, 36, display.width(), 36, WHITE); display.drawLine(0, display.height()-11, display.width(), display.height()-11, WHITE); display.setCursor(2,display.height()-9); display.print(PSTR2("5645")); display.setCursor(55,display.height()-9); display.print(PSTR2("5800")); display.setCursor(display.width()-25,display.height()-9); display.print(PSTR2("5945")); display.display(); }
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::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::bandScanMode(uint8_t state) { reset(); // start from fresh screen. best_rssi = 0; if(state==STATE_SCAN) { drawTitleBox(PSTR2("BAND SCANNER")); display.setCursor(5,12); display.print(PSTR2("BEST:")); } else { drawTitleBox(PSTR2("RSSI SETUP")); display.setCursor(5,12); display.print(PSTR2("Min: Max:")); } display.drawLine(0, 20, display.width(), 20, WHITE); display.drawLine(0, display.height()-11, display.width(), display.height()-11, WHITE); display.setCursor(2,display.height()-9); display.print(PSTR2("5645")); display.setCursor(55,display.height()-9); display.print(PSTR2("5800")); display.setCursor(display.width()-25,display.height()-9); display.print(PSTR2("5945")); display.display(); }
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"); } }
void screens::diversity(uint8_t diversity_mode) { reset(); drawTitleBox(PSTR2("DIVERSITY")); //selected display.fillRect(0, 10*diversity_mode+12, display.width(), 10, WHITE); display.setTextColor(diversity_mode == useReceiverAuto ? BLACK : WHITE); display.setCursor(5,10*1+3); display.print(PSTR2("AUTO")); display.setTextColor(diversity_mode == useReceiverA ? BLACK : WHITE); display.setCursor(5,10*2+3); display.print(PSTR2("RECEIVER A")); display.setTextColor(diversity_mode == useReceiverB ? BLACK : WHITE); display.setCursor(5,10*3+3); display.print(PSTR2("RECEIVER B")); // RSSI Strength display.setTextColor(WHITE); display.drawRect(0, display.height()-21, display.width(), 11, WHITE); display.setCursor(5,display.height()-19); display.print("A:"); display.setCursor(5,display.height()-9); display.print("B:"); display.display(); }
void screens::voltage(uint8_t menu_id, int voltage_calibration, uint8_t warning_voltage, uint8_t critical_voltage) { reset(); drawTitleBox(PSTR2("VOLTAGE ALARM")); display.fillRect(0, 10*menu_id+12, display.width(), 10, WHITE); display.setTextColor(menu_id == 0 ? BLACK : WHITE); display.setCursor(5,10*1+3); display.print(PSTR2("Warning:")); display.setCursor(80 ,10*1+3); display.print((float)warning_voltage/10.0); display.setTextColor(menu_id == 1 ? BLACK : WHITE); display.setCursor(5,10*2+3); display.print(PSTR2("Critical:")); display.setCursor(80 ,10*2+3); display.print((float)critical_voltage/10.0); display.setTextColor(menu_id == 2 ? BLACK : WHITE); display.setCursor(5,10*3+3); display.print(PSTR2("Calibrate:")); display.setCursor(80 ,10*3+3); display.print(voltage_calibration); display.setTextColor(menu_id == 3 ? BLACK : WHITE); display.setCursor(5,10*4+3); display.print(PSTR2("Save")); display.setTextColor(WHITE); display.setCursor(5,10*5+3); display.print(PSTR2("Measured:")); display.display(); }
void screens::mainMenu(uint8_t menu_id){ u8g.firstPage(); do { reset(); // start from fresh screen. drawTitleBox("MODE SELECTION"); u8g.setColorIndex(WHITE); u8g.drawBox(0, 10*menu_id+12, u8g.getWidth(), 10); u8g.setColorIndex(menu_id == 0 ? BLACK : WHITE); u8g.setPrintPos(5,10*0+12); u8g.print("AUTO SEARCH"); u8g.setColorIndex(menu_id == 1 ? BLACK : WHITE); u8g.setPrintPos(5,10*1+12); u8g.print("BAND SCANNER"); u8g.setColorIndex(menu_id == 2 ? BLACK : WHITE); u8g.setPrintPos(5,10*2+12); u8g.print("MANUAL MODE"); #ifdef USE_DIVERSITY u8g.setColorIndex(menu_id == 3 ? BLACK : WHITE); u8g.setPrintPos(5,10*3+12); u8g.print("DIVERSITY"); #endif u8g.setColorIndex(menu_id == 4 ? BLACK : WHITE); u8g.setPrintPos(5,10*4+12); u8g.print("SAVE SETUP"); } while( u8g.nextPage() ); }
void screens::mainMenu(uint8_t menu_id) { reset(); // start from fresh screen. drawTitleBox(PSTR2("MODE SELECTION")); display.fillRect(0, 10*menu_id+12, display.width(), 10,WHITE); display.setTextColor(menu_id == 0 ? BLACK : WHITE); display.setCursor(5,10*0+13); display.print(PSTR2("AUTO SEARCH")); display.setTextColor(menu_id == 1 ? BLACK : WHITE); display.setCursor(5,10*1+13); display.print(PSTR2("BAND SCANNER")); display.setTextColor(menu_id == 2 ? BLACK : WHITE); display.setCursor(5,10*2+13); display.print(PSTR2("MANUAL MODE")); #ifdef USE_DIVERSITY if(isDiversity()) { display.setTextColor(menu_id == 3 ? BLACK : WHITE); display.setCursor(5,10*3+13); display.print(PSTR2("DIVERSITY")); } #endif display.setTextColor(menu_id == 4 ? BLACK : WHITE); display.setCursor(5,10*4+13); display.print(PSTR2("SETUP MENU")); display.display(); }
void screens::updateSetupMenu(uint8_t menu_id, bool settings_beeps, bool settings_orderby_channel, const char *call_sign, char editing){ reset(); drawTitleBox(PSTR2("SETUP MENU")); //selected display.fillRect(0, 10*menu_id+12, display.width(), 10, WHITE); #ifdef OLED_128x64_ADAFRUIT_SCREENS display.setTextColor(menu_id == 0 ? BLACK : WHITE); display.setCursor(5,10*1+3); display.print(PSTR2("CHANNEL SETUP")); #else display.setTextColor(menu_id == 0 ? BLACK : WHITE); display.setCursor(5,10*1+3); display.print(PSTR2("ORDER: ")); if(settings_orderby_channel) { display.print(PSTR2("CHANNEL ")); } else { display.print(PSTR2("FREQUENCY")); } #endif display.setTextColor(menu_id == 1 ? BLACK : WHITE); display.setCursor(5,10*2+3); display.print(PSTR2("BEEPS: ")); if(settings_beeps) { display.print(PSTR2("ON ")); } else { display.print(PSTR2("OFF")); } display.setTextColor(menu_id == 2 ? BLACK : WHITE); display.setCursor(5,10*3+3); display.print(PSTR2("SIGN : ")); if(editing>=0) { display.fillRect(6*6+5, 10*2+13, display.width()-(6*6+6), 8, BLACK); display.fillRect(6*7+6*(editing)+4, 10*2+13, 7, 8, WHITE); //set cursor for(uint8_t i=0; i<10; i++) { display.setTextColor(i == editing ? BLACK : WHITE); display.print(call_sign[i]); } } else { display.print(call_sign); } display.setTextColor(menu_id == 3 ? BLACK : WHITE); display.setCursor(5,10*4+3); display.print(PSTR2("CALIBRATE RSSI")); display.setTextColor(menu_id == 4 ? BLACK : WHITE); display.setCursor(5,10*5+3); display.print(PSTR2("SAVE & EXIT")); display.display(); }
void screens::diversity(uint8_t diversity_mode) { reset(); drawTitleBox("DIVERSITY"); TV.printPGM(10, 5+1*MENU_Y_SIZE, PSTR("Auto")); TV.printPGM(10, 5+2*MENU_Y_SIZE, PSTR("Receiver A")); TV.printPGM(10, 5+3*MENU_Y_SIZE, PSTR("Receiver B")); // RSSI Strength TV.draw_line(0,3+4*MENU_Y_SIZE, TV_X_MAX, 3+4*MENU_Y_SIZE, WHITE); TV.printPGM(10, 6+4*MENU_Y_SIZE, PSTR("A:")); TV.draw_line(0,3+5*MENU_Y_SIZE, TV_X_MAX, 3+5*MENU_Y_SIZE, WHITE); TV.printPGM(10, 6+5*MENU_Y_SIZE, PSTR("B:")); TV.draw_rect(0,3+(diversity_mode+1)*MENU_Y_SIZE,127,12, WHITE, INVERT); }
void screens::mainMenu(uint8_t menu_id) { reset(); // start from fresh screen. drawTitleBox("MODE SELECTION"); TV.printPGM(10, 5+1*MENU_Y_SIZE, PSTR("Auto Search")); TV.printPGM(10, 5+2*MENU_Y_SIZE, PSTR("Band Scanner")); TV.printPGM(10, 5+3*MENU_Y_SIZE, PSTR("Manual Mode")); #ifdef USE_DIVERSITY TV.printPGM(10, 5+4*MENU_Y_SIZE, PSTR("Diversity")); #endif TV.printPGM(10, 5+5*MENU_Y_SIZE, PSTR("Save Setup")); // selection by inverted box TV.draw_rect(0,3+(menu_id+1)*MENU_Y_SIZE,127,12, WHITE, INVERT); }
void screens::updateChannelSetupMenu(uint8_t menu_id, bool settings_orderby_channel, bool settings_channel_filter_on, const char *channel_filter_preset_name, int8_t channel_filter_preset_id) { reset(); //Screen Title drawTitleBox(PSTR2("CHANNEL SETUP")); //Highlight Selected display.fillRect(0, 10*menu_id+12, display.width(), 10, WHITE); //Channel Sort Channel / Frequency display.setTextColor(menu_id == 0 ? BLACK : WHITE); display.setCursor(5,10*1+3); display.print(PSTR2("ORDER: ")); if(settings_orderby_channel) { display.print(PSTR2("CHANNEL ")); } else { display.print(PSTR2("FREQUENCY")); } //Channel Filter On / Off display.setTextColor(menu_id == 1 ? BLACK : WHITE); display.setCursor(5,10*2+3); display.print(PSTR2("CHANNEL FILTER: ")); if(settings_channel_filter_on) { display.print(PSTR2("ON ")); } else { display.print(PSTR2("OFF")); } //Display Name of Current Preset display.setTextColor(menu_id == 2 ? BLACK : WHITE); display.setCursor(5,10*3+3); display.print(PSTR2("PRESET: ")); display.print(channel_filter_preset_name); //Edit Filter display.setTextColor(menu_id == 3 ? BLACK : WHITE); display.setCursor(5,10*4+3); display.print(PSTR2("EDIT FILTER")); //Exit display.setTextColor(menu_id == 4 ? BLACK : WHITE); display.setCursor(5,10*5+3); display.print(PSTR2("EXIT")); display.display(); }
void screens::updateEditChannelFilter(uint8_t channel_id, const uint8_t *channel_filter, const uint16_t *channelFreqTable, const uint8_t *channelNames) { int screen_line; int ce_ct; int ce_ct_adj; reset(); drawTitleBox(PSTR2("FILTER EDIT")); display.display(); screen_line = 1; display.fillRect(0, 10*2+12, display.width(), 10, WHITE); for (ce_ct=(channel_id-2);ce_ct<=(channel_id+2);ce_ct++) { if ((ce_ct>=CHANNEL_MIN-1) && (ce_ct<=CHANNEL_MAX+1)) { ce_ct_adj = ce_ct; } else if (ce_ct <= CHANNEL_MIN) { ce_ct_adj = (CHANNEL_MAX+1) + ce_ct; } else { ce_ct_adj = (CHANNEL_MIN-1) + abs((CHANNEL_MAX+1)-ce_ct); } display.setCursor(5,10*screen_line+3); display.setTextColor(screen_line == 3 ? BLACK : WHITE); if ((ce_ct_adj == (CHANNEL_MIN-1)) || (ce_ct_adj == (CHANNEL_MAX+1))) { display.print(PSTR2("EXIT")); } else { //Display Channel Name display.print(pgm_read_byte_near(channelNames + ce_ct_adj), HEX); //Display Channel Freq display.print(PSTR2(" (")); display.print(pgm_read_word_near(channelFreqTable + ce_ct_adj), DEC); display.print(PSTR2("): ")); //Display Channel Status On/Off display.print((bitRead(channel_filter[ce_ct_adj / 8], ce_ct_adj - (ce_ct_adj / 8) * 8)) == 1 ? PSTR2("On ") : PSTR2("Off")); } screen_line++; } display.display(); }
void screens::save(uint8_t mode, uint8_t channelIndex, uint16_t channelFrequency) { reset(); drawTitleBox("SAVE SETTINGS"); TV.printPGM(10, 5+1*MENU_Y_SIZE, PSTR("Mode:")); switch (mode) { case STATE_SCAN: // Band Scanner TV.printPGM(50,5+1*MENU_Y_SIZE, PSTR("Scanner")); break; case STATE_MANUAL: // manual mode TV.printPGM(50,5+1*MENU_Y_SIZE, PSTR("Manual")); break; case STATE_SEEK: // seek mode TV.printPGM(50,5+1*MENU_Y_SIZE, PSTR("Search")); break; } TV.printPGM(10, 5+2*MENU_Y_SIZE, PSTR("Band:")); // print band if(channelIndex > 31) { TV.printPGM(50,5+2*MENU_Y_SIZE, PSTR("C/Race ")); } else if(channelIndex > 23) { TV.printPGM(50,5+2*MENU_Y_SIZE, PSTR("F/Airwave")); } else if (channelIndex > 15) { TV.printPGM(50,5+2*MENU_Y_SIZE, PSTR("E ")); } else if (channelIndex > 7) { TV.printPGM(50,5+2*MENU_Y_SIZE, PSTR("B ")); } else { TV.printPGM(50,5+2*MENU_Y_SIZE, PSTR("A ")); } TV.printPGM(10, 5+3*MENU_Y_SIZE, PSTR("Chan:")); uint8_t active_channel = channelIndex%CHANNEL_BAND_SIZE+1; // get channel inside band TV.print(50,5+3*MENU_Y_SIZE,active_channel,DEC); TV.printPGM(10, 5+4*MENU_Y_SIZE, PSTR("FREQ: GHz")); TV.print(50,5+4*MENU_Y_SIZE, channelFrequency); TV.printPGM(10, 5+5*MENU_Y_SIZE, PSTR("--- SAVED ---")); }
void screens::save(uint8_t mode, uint8_t channelIndex, uint16_t channelFrequency, const char *call_sign) { reset(); drawTitleBox(PSTR2("SAVE SETTINGS")); display.setTextColor(WHITE); display.setCursor(5,8*1+4); display.print(PSTR2("MODE:")); display.setCursor(38,8*1+4); switch (mode) { case STATE_SCAN: // Band Scanner display.print(PSTR2("BAND SCANNER")); break; case STATE_MANUAL: // manual mode display.print(PSTR2("MANUAL")); break; case STATE_SEEK: // seek mode display.print(PSTR2("AUTO SEEK")); break; } display.setCursor(5,8*2+4); display.print(PSTR2("BAND:")); display.setCursor(38,8*2+4); // print band if(channelIndex > 31) { display.print(PSTR2("C/Race")); } else if(channelIndex > 23) { display.print(PSTR2("F/Airwave")); } else if (channelIndex > 15) { display.print(PSTR2("E")); } else if (channelIndex > 7) { display.print(PSTR2("B")); } else { display.print(PSTR2("A")); } display.setCursor(5,8*3+4); display.print(PSTR2("CHAN:")); display.setCursor(38,8*3+4); uint8_t active_channel = channelIndex%CHANNEL_BAND_SIZE+1; // get channel inside band display.print(active_channel,DEC); display.setCursor(5,8*4+4); display.print(PSTR2("FREQ: GHz")); display.setCursor(38,8*4+4); display.print(channelFrequency); display.setCursor(5,8*5+4); display.print(PSTR2("SIGN:")); display.setCursor(38,8*5+4); display.print(call_sign); display.setCursor(((display.width()-11*6)/2),8*6+4); display.print(PSTR2("-- SAVED --")); display.display(); }
void screens::save(uint8_t mode, uint8_t channelIndex, uint16_t channelFrequency) { reset(); drawTitleBox("SAVE SETTINGS"); }
void screens::updateSetupMenu(uint8_t menu_id, bool settings_beeps, bool settings_orderby_channel, const char *call_sign, char editing){ reset(); drawTitleBox(PSTR2("SETUP MENU")); //selected int selected_position = menu_id % 5; display.fillRect(0, 10*selected_position+12, display.width(), 10, WHITE); if(menu_id < 5){ drawBottomTriangle(selected_position == 4 ? BLACK : WHITE); display.setTextColor(selected_position == 0 ? BLACK : WHITE); display.setCursor(5,10*1+3); display.print(PSTR2("ORDER: ")); if(settings_orderby_channel) { display.print(PSTR2("CHANNEL ")); } else { display.print(PSTR2("FREQUENCY")); } display.setTextColor(selected_position == 1 ? BLACK : WHITE); display.setCursor(5,10*2+3); display.print(PSTR2("BEEPS: ")); if(settings_beeps) { display.print(PSTR2("ON ")); } else { display.print(PSTR2("OFF")); } display.setTextColor(selected_position == 2 ? BLACK : WHITE); display.setCursor(5,10*3+3); display.print(PSTR2("SIGN : ")); if(editing>=0) { display.fillRect(6*6+5, 10*2+13, display.width()-(6*6+6), 8, BLACK); display.fillRect(6*7+6*(editing)+4, 10*2+13, 7, 8, WHITE); //set cursor for(uint8_t i=0; i<10; i++) { display.setTextColor(i == editing ? BLACK : WHITE); display.print(call_sign[i]); } } else { display.print(call_sign); } display.setTextColor(selected_position == 3 ? BLACK : WHITE); display.setCursor(5,10*4+3); display.print(PSTR2("CALIBRATE RSSI")); #ifdef USE_VOLTAGE_MONITORING display.setTextColor(selected_position == 4 ? BLACK : WHITE); display.setCursor(5,10*5+3); display.print(PSTR2("VOLTAGE ALARM")); } else { drawTopTriangle(selected_position == 0 ? BLACK : WHITE); display.setTextColor(selected_position == 0 ? BLACK : WHITE); display.setCursor(5,10*1+3); display.print(PSTR2("SAVE & EXIT")); } #else display.setTextColor(selected_position == 4 ? BLACK : WHITE); display.setCursor(5,10*5+3); display.print(PSTR2("SAVE & EXIT")); }
void screens::diversity(uint8_t diversity_mode) { reset(); drawTitleBox("DIVERSITY"); }