Browse Source

Added new files

master
Englebert 3 years ago
parent
commit
8d119a4b17
  1. 59
      BertFPVDiversity.ino
  2. 122
      icon_reboot.h
  3. 28
      menu.cpp
  4. 2
      menu.h

59
BertFPVDiversity.ino

@ -12,6 +12,7 @@
#include "video.h"
#include "intro.h"
#include "menu.h"
#include "search.h"
uint8_t display_screen = 0;
@ -27,6 +28,7 @@ uint32_t current_millis = 0;
hw_timer_t * timer = NULL; /* create a hardware timer */
uint8_t c = 0;
uint8_t color = 0;
bool display_output_state = true;
void display_output() {
// Wait for the next frame to minimize chance of visible tearing
@ -109,7 +111,8 @@ void setup() {
}
void loop() {
display_output();
if(display_output_state)
display_output();
touched_val = touchRead(TOUCH_MODE);
if(touched_val < VALUE_THRESHOLD) {
@ -124,9 +127,59 @@ void loop() {
String serial_cmd_string = Serial.readStringUntil('\n');
serial_cmd_string.trim();
if(serial_cmd_string == "next") {
Menu::menu_position++;
// Making it cleaner??? not sure..
int key_type = -1;
if(serial_cmd_string == "prev")
key_type = 1;
else if(serial_cmd_string == "next")
key_type = 2;
else if(serial_cmd_string == "reboot")
key_type = 3;
else if(serial_cmd_string == "enter")
key_type = 4;
else if(serial_cmd_string == "mode") {
// Disable this screen and enable the RX5808 output
display_output_state = !display_output_state;
if(!display_output_state) {
dac_i2s_disable();
dac_output_disable(DAC_CHANNEL_1);
// Prevent distortion on the video composite
pinMode(GPIO_NUM_25, INPUT);
gpio_pulldown_dis(GPIO_NUM_25);
gpio_pullup_dis(GPIO_NUM_25);
gpio_set_pull_mode(GPIO_NUM_25, GPIO_FLOATING);
} else {
dac_output_enable(DAC_CHANNEL_1);
dac_i2s_enable();
}
}
switch(key_type) {
case 1:
Menu::menu_position--;
break;
case 2:
Menu::menu_position++;
break;
case 3:
ESP.restart();
break;
case 4:
// Different menu different functions
switch(Menu::menu_position) {
case 3:
ESP.restart();
break;
}
break;
}
Menu::menu_position = (Menu::menu_position < 0) ? Menu::MAX_MENU_ITEMS - 1 : Menu::menu_position;
Menu::menu_position = (Menu::menu_position >= Menu::MAX_MENU_ITEMS) ? 0 : Menu::menu_position;
}
}

122
icon_reboot.h

@ -0,0 +1,122 @@
/*
* Filename: icon_reboot.h
* Date: Mon 20 Sep 22:14:58 +08 2021
* Author: Englebert
* Description:
* - WiFi ICON
*/
#ifndef ICON_REBOOT_H
#define ICON_REBOOT_H
// Filesize: 6478 Bytes
// Size bitmap: 512 bytes
#define imageWidth 100
#define imageHeight 100
const unsigned char icon_reboot [] PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x00,0x00
,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x00,0x00
,0x00,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x00,0x00
,0x00,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00
,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00
,0x00,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x00
,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x00
,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x00
,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x00
,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00
,0x03,0xff,0xff,0xff,0xff,0xff,0x0f,0xff,0xff,0xff,0xff,0xf8,0x00
,0x03,0xff,0xff,0xff,0xff,0xfc,0x07,0xff,0xff,0xff,0xff,0xfc,0x00
,0x03,0xff,0xff,0xff,0xff,0xfc,0x03,0xff,0xff,0xff,0xff,0xfc,0x00
,0x07,0xff,0xff,0xff,0xff,0xfc,0x03,0xff,0xff,0xff,0xff,0xfc,0x00
,0x07,0xff,0xff,0xff,0xff,0xfc,0x03,0xff,0xff,0xff,0xff,0xfc,0x00
,0x07,0xff,0xff,0xff,0xff,0xfc,0x03,0xff,0xff,0xff,0xff,0xfc,0x00
,0x07,0xff,0xff,0xff,0xff,0xfc,0x03,0xff,0xff,0xff,0xff,0xfe,0x00
,0x07,0xff,0xff,0xff,0xff,0xfc,0x03,0xff,0xff,0xff,0xff,0xfe,0x00
,0x07,0xff,0xff,0xff,0x8f,0xfc,0x03,0xff,0x3f,0xff,0xff,0xfe,0x00
,0x07,0xff,0xff,0xfe,0x07,0xfc,0x03,0xfe,0x0f,0xff,0xff,0xfe,0x00
,0x07,0xff,0xff,0xfc,0x07,0xfc,0x03,0xfe,0x03,0xff,0xff,0xfe,0x00
,0x07,0xff,0xff,0xf0,0x07,0xfc,0x03,0xfe,0x01,0xff,0xff,0xfe,0x00
,0x07,0xff,0xff,0xe0,0x0f,0xfc,0x03,0xfe,0x00,0xff,0xff,0xfe,0x00
,0x07,0xff,0xff,0xc0,0x0f,0xfc,0x03,0xff,0x00,0x7f,0xff,0xfe,0x00
,0x07,0xff,0xff,0x80,0x1f,0xfc,0x03,0xff,0x00,0x3f,0xff,0xfe,0x00
,0x07,0xff,0xff,0x00,0x3f,0xfc,0x03,0xff,0xc0,0x1f,0xff,0xfe,0x00
,0x07,0xff,0xfe,0x00,0xff,0xfc,0x03,0xff,0xe0,0x0f,0xff,0xfe,0x00
,0x07,0xff,0xfe,0x01,0xff,0xfc,0x03,0xff,0xf0,0x07,0xff,0xfe,0x00
,0x07,0xff,0xfc,0x03,0xff,0xfc,0x03,0xff,0xf8,0x03,0xff,0xfe,0x00
,0x07,0xff,0xf8,0x07,0xff,0xfc,0x03,0xff,0xfc,0x03,0xff,0xfe,0x00
,0x07,0xff,0xf8,0x0f,0xff,0xfc,0x03,0xff,0xfe,0x01,0xff,0xfe,0x00
,0x07,0xff,0xf0,0x0f,0xff,0xfc,0x03,0xff,0xff,0x01,0xff,0xfe,0x00
,0x07,0xff,0xf0,0x1f,0xff,0xfc,0x03,0xff,0xff,0x00,0xff,0xfe,0x00
,0x07,0xff,0xe0,0x3f,0xff,0xfc,0x03,0xff,0xff,0x80,0xff,0xfe,0x00
,0x07,0xff,0xe0,0x3f,0xff,0xfc,0x07,0xff,0xff,0xc0,0x7f,0xfe,0x00
,0x07,0xff,0xc0,0x7f,0xff,0xff,0x0f,0xff,0xff,0xc0,0x7f,0xfe,0x00
,0x07,0xff,0xc0,0x7f,0xff,0xff,0xff,0xff,0xff,0xe0,0x7f,0xfe,0x00
,0x07,0xff,0xc0,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x3f,0xfe,0x00
,0x07,0xff,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x3f,0xfe,0x00
,0x07,0xff,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x3f,0xfe,0x00
,0x07,0xff,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x3f,0xfe,0x00
,0x07,0xff,0x81,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x1f,0xfe,0x00
,0x07,0xff,0x81,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x1f,0xfe,0x00
,0x07,0xff,0x81,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x1f,0xfe,0x00
,0x07,0xff,0x81,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x1f,0xfe,0x00
,0x07,0xff,0x81,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x1f,0xfe,0x00
,0x07,0xff,0x81,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x1f,0xfe,0x00
,0x07,0xff,0x81,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x1f,0xfe,0x00
,0x07,0xff,0x81,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x1f,0xfe,0x00
,0x07,0xff,0x81,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x1f,0xfe,0x00
,0x07,0xff,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x3f,0xfe,0x00
,0x07,0xff,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x3f,0xfe,0x00
,0x07,0xff,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x3f,0xfe,0x00
,0x07,0xff,0xc0,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x3f,0xfe,0x00
,0x07,0xff,0xc0,0x7f,0xff,0xff,0xff,0xff,0xff,0xe0,0x7f,0xfe,0x00
,0x07,0xff,0xc0,0x7f,0xff,0xff,0xff,0xff,0xff,0xc0,0x7f,0xfe,0x00
,0x07,0xff,0xe0,0x3f,0xff,0xff,0xff,0xff,0xff,0xc0,0x7f,0xfe,0x00
,0x07,0xff,0xe0,0x3f,0xff,0xff,0xff,0xff,0xff,0x80,0xff,0xfe,0x00
,0x07,0xff,0xf0,0x1f,0xff,0xff,0xff,0xff,0xff,0x80,0xff,0xfe,0x00
,0x07,0xff,0xf0,0x0f,0xff,0xff,0xff,0xff,0xff,0x01,0xff,0xfe,0x00
,0x07,0xff,0xf8,0x0f,0xff,0xff,0xff,0xff,0xfe,0x01,0xff,0xfe,0x00
,0x07,0xff,0xf8,0x07,0xff,0xff,0xff,0xff,0xfc,0x03,0xff,0xfe,0x00
,0x07,0xff,0xfc,0x03,0xff,0xff,0xff,0xff,0xfc,0x03,0xff,0xfe,0x00
,0x07,0xff,0xfc,0x01,0xff,0xff,0xff,0xff,0xf8,0x07,0xff,0xfe,0x00
,0x07,0xff,0xfe,0x00,0xff,0xff,0xff,0xff,0xe0,0x0f,0xff,0xfe,0x00
,0x07,0xff,0xff,0x00,0x7f,0xff,0xff,0xff,0xc0,0x1f,0xff,0xfe,0x00
,0x07,0xff,0xff,0x80,0x1f,0xff,0xff,0xff,0x80,0x1f,0xff,0xfe,0x00
,0x07,0xff,0xff,0xc0,0x0f,0xff,0xff,0xfe,0x00,0x3f,0xff,0xfe,0x00
,0x07,0xff,0xff,0xe0,0x03,0xff,0xff,0xf8,0x00,0xff,0xff,0xfe,0x00
,0x07,0xff,0xff,0xf0,0x00,0x7f,0xff,0xe0,0x01,0xff,0xff,0xfe,0x00
,0x07,0xff,0xff,0xfc,0x00,0x07,0xfe,0x00,0x03,0xff,0xff,0xfe,0x00
,0x07,0xff,0xff,0xfe,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xfc,0x00
,0x07,0xff,0xff,0xff,0x80,0x00,0x00,0x00,0x1f,0xff,0xff,0xfc,0x00
,0x07,0xff,0xff,0xff,0xc0,0x00,0x00,0x00,0x7f,0xff,0xff,0xfc,0x00
,0x03,0xff,0xff,0xff,0xf8,0x00,0x00,0x01,0xff,0xff,0xff,0xfc,0x00
,0x03,0xff,0xff,0xff,0xfe,0x00,0x00,0x0f,0xff,0xff,0xff,0xfc,0x00
,0x03,0xff,0xff,0xff,0xff,0xf0,0x00,0xff,0xff,0xff,0xff,0xf8,0x00
,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00
,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00
,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x00
,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x00
,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x00
,0x00,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x00
,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00
,0x00,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00
,0x00,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x00,0x00
,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00
,0x00,0x00,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
#endif

28
menu.cpp

@ -2,10 +2,11 @@
#include "icon_search.h"
#include "icon_wifi.h"
#include "icon_settings.h"
#include "icon_reboot.h"
namespace Menu {
uint8_t menu_position = 0;
uint8_t MAX_MENU_ITEMS = 3;
int8_t menu_position = 0;
uint8_t MAX_MENU_ITEMS = 4;
void begin() {
// Wait for the next frame to minimize chance of visible tearing
@ -14,30 +15,39 @@ namespace Menu {
// Clear screen
Video::video.fillScreen(0x00);
uint8_t title_color = 0xBB;
switch(menu_position) {
case 0:
Video::drawBitmap(60, 50, icon_search, 100, 100, 0xFF);
Video::video.setFont(&FreeSansBold18pt7b);
Video::video.setCursor(60,180);
Video::video.setTextColor(0xC);
Video::video.setCursor(55,180);
Video::video.setTextColor(title_color);
Video::video.print("Search");
break;
case 1:
Video::drawBitmap(60, 50, icon_wifi, 100, 100, 0xFF);
Video::video.setFont(&FreeSansBold18pt7b);
Video::video.setCursor(60,180);
Video::video.setTextColor(0xC);
Video::video.setCursor(65,180);
Video::video.setTextColor(title_color);
Video::video.print("WiFi");
break;
case 2:
Video::drawBitmap(60, 50, icon_settings, 100, 100, 0xFF);
Video::video.setFont(&FreeSansBold18pt7b);
Video::video.setCursor(60,180);
Video::video.setTextColor(0xC);
Video::video.print("WiFi");
Video::video.setCursor(40,180);
Video::video.setTextColor(title_color);
Video::video.print("Settings");
break;
case 3:
Video::drawBitmap(60, 50, icon_reboot, 100, 100, 0xFF);
Video::video.setFont(&FreeSansBold18pt7b);
Video::video.setCursor(40,180);
Video::video.setTextColor(title_color);
Video::video.print("Reboot");
break;
}
}

2
menu.h

@ -14,7 +14,7 @@
#include "video.h"
namespace Menu {
extern uint8_t menu_position;
extern int8_t menu_position;
extern uint8_t MAX_MENU_ITEMS;
void begin();

Loading…
Cancel
Save