Some cleanup, Power control for Heltec v2 board, hor.speed in m/s
This commit is contained in:
parent
804632dd88
commit
038f1f9c6d
|
|
@ -68,27 +68,12 @@ Button button2 = {0, 0, KP_NONE, 0, -1, false};
|
|||
static int lastDisplay = 1;
|
||||
static int currentDisplay = 1;
|
||||
|
||||
// Set LED GPIO
|
||||
int ledPin = 1;
|
||||
// Stores LED state
|
||||
String ledState;
|
||||
|
||||
// timestamp when spectrum display was activated
|
||||
static unsigned long specTimer;
|
||||
|
||||
// Replaces placeholder with LED state value
|
||||
String processor(const String& var) {
|
||||
Serial.println(var);
|
||||
if (var == "STATE") {
|
||||
if (digitalRead(ledPin)) {
|
||||
ledState = "ON";
|
||||
}
|
||||
else {
|
||||
ledState = "OFF";
|
||||
}
|
||||
Serial.print(ledState);
|
||||
return ledState;
|
||||
}
|
||||
if (var == "VERSION_NAME") {
|
||||
return String(version_name);
|
||||
}
|
||||
|
|
@ -398,25 +383,23 @@ struct st_configitems {
|
|||
|
||||
struct st_configitems config_list[] = {
|
||||
/* General config settings */
|
||||
{"", "Software configuration", -5, NULL},
|
||||
{"wifi", "Wifi mode (0/1/2/3)", 0, &sonde.config.wifi},
|
||||
{"debug", "Debug mode (0/1)", 0, &sonde.config.debug},
|
||||
{"maxsonde", "Maxsonde", 0, &sonde.config.maxsonde},
|
||||
{"display", "Display mode (1/2/3)", 0, &sonde.config.display},
|
||||
{"---", "---", -1, NULL},
|
||||
/* Spectrum display settings */
|
||||
{"spectrum", "ShowSpectrum (s)", 0, &sonde.config.spectrum},
|
||||
{"spectrum", "Show spectrum (-1=no, 0=forever, >0=seconds)", 0, &sonde.config.spectrum},
|
||||
{"startfreq", "Startfreq (MHz)", 0, &sonde.config.startfreq},
|
||||
{"channelbw", "Bandwidth (kHz)", 0, &sonde.config.channelbw},
|
||||
{"timer", "Spectrum Timer", 0, &sonde.config.timer},
|
||||
{"marker", "Spectrum MHz marker", 0, &sonde.config.marker},
|
||||
{"noisefloor", "Sepctrum noisefloor", 0, &sonde.config.noisefloor},
|
||||
{"showafc", "Show AFC value", 0, &sonde.config.showafc},
|
||||
{"freqofs", "RX frequency offset (Hz)", 0, &sonde.config.freqofs},
|
||||
{"---", "---", -1, NULL},
|
||||
{"", "Data feed configuration", -5, NULL},
|
||||
/* APRS settings */
|
||||
{"call", "Call", 8, sonde.config.call},
|
||||
{"passcode", "Passcode", 8, sonde.config.passcode},
|
||||
{"---", "---", -1, NULL},
|
||||
/* KISS tnc settings */
|
||||
{"kisstnc", "KISS TNC (port 14590) (needs reboot)", 0, &sonde.config.kisstnc.active},
|
||||
{"kisstnc.idformat", "DFM ID Format", -2, &sonde.config.kisstnc.idformat},
|
||||
|
|
@ -426,33 +409,33 @@ struct st_configitems config_list[] = {
|
|||
{"axudp.port", "AXUDP Port", 0, &sonde.config.udpfeed.port},
|
||||
{"axudp.idformat", "DFM ID Format", -2, &sonde.config.udpfeed.idformat},
|
||||
{"axudp.highrate", "Rate limit", 0, &sonde.config.udpfeed.highrate},
|
||||
{"---", "---", -1, NULL},
|
||||
/* APRS TCP settings, current not used */
|
||||
{"tcp.active", "APRS TCP active", -3, &sonde.config.tcpfeed.active},
|
||||
{"tcp.host", "ARPS TCP Host", 63, sonde.config.tcpfeed.host},
|
||||
{"tcp.port", "APRS TCP Port", 0, &sonde.config.tcpfeed.port},
|
||||
{"tcp.idformat", "DFM ID Format", -2, &sonde.config.tcpfeed.idformat},
|
||||
{"tcp.highrate", "Rate limit", 0, &sonde.config.tcpfeed.highrate},
|
||||
{"---", "---", -1, NULL},
|
||||
/* decoder settings */
|
||||
{"", "Receiver configuration", -5, NULL},
|
||||
{"rs41.agcbw", "RS41 AGC bandwidth", 0, &sonde.config.rs41.agcbw},
|
||||
{"rs41.rxbw", "RS41 RX bandwidth", 0, &sonde.config.rs41.rxbw},
|
||||
{"rs92.rxbw", "RS92 RX (and AGC) bandwidth", 0, &sonde.config.rs92.rxbw},
|
||||
{"rs92.alt2d", "RS92 2D fix default altitude", 0, &sonde.config.rs92.alt2d},
|
||||
{"dfm.agcbw", "DFM6/9 AGC bandwidth", 0, &sonde.config.dfm.agcbw},
|
||||
{"dfm.rxbw", "DFM6/9 RX bandwidth", 0, &sonde.config.dfm.rxbw},
|
||||
{"---", "---", -1, NULL},
|
||||
/* Hardware dependeing settings */
|
||||
{"", "Hardware configuration (requires reboot)", -5, NULL},
|
||||
{"disptype", "Display type (0=OLED/SSD1306, 1=TFT/ILI9225, 2=OLED/SH1106)", 0, &sonde.config.disptype},
|
||||
{"oled_sda", "OLED/TFT SDA (needs reboot)", 0, &sonde.config.oled_sda},
|
||||
{"oled_scl", "OLED SCL/TFT CLK (needs reboot)", 0, &sonde.config.oled_scl},
|
||||
{"oled_rst", "OLED/TFT RST (needs reboot)", 0, &sonde.config.oled_rst},
|
||||
{"tft_rs", "TFT RS (needs reboot)", 0, &sonde.config.tft_rs},
|
||||
{"tft_cs", "TFT CS (needs reboot)", 0, &sonde.config.tft_cs},
|
||||
{"button_pin", "Button input port (needs reboot)", -4, &sonde.config.button_pin},
|
||||
{"button2_pin", "Button 2 input port (needs reboot)", -4, &sonde.config.button2_pin},
|
||||
{"touch_thresh", "Touch button threshold (needs reboot)", 0, &sonde.config.touch_thresh},
|
||||
{"led_pout", "LED output port (needs reboot)", 0, &sonde.config.led_pout},
|
||||
{"oled_sda", "OLED SDA/TFT SDA", 0, &sonde.config.oled_sda},
|
||||
{"oled_scl", "OLED SCL/TFT CLK", 0, &sonde.config.oled_scl},
|
||||
{"oled_rst", "OLED RST/TFT RST (needs reboot)", 0, &sonde.config.oled_rst},
|
||||
{"tft_rs", "TFT RS", 0, &sonde.config.tft_rs},
|
||||
{"tft_cs", "TFT CS", 0, &sonde.config.tft_cs},
|
||||
{"button_pin", "Button input port", -4, &sonde.config.button_pin},
|
||||
{"button2_pin", "Button 2 input port", -4, &sonde.config.button2_pin},
|
||||
{"touch_thresh", "Touch button threshold", 0, &sonde.config.touch_thresh},
|
||||
{"power_pout", "Power control port", 0, &sonde.config.power_pout},
|
||||
{"led_pout", "LED output port", 0, &sonde.config.led_pout},
|
||||
{"gps_rxd", "GPS RXD pin (-1 to disable)", 0, &sonde.config.gps_rxd},
|
||||
{"gps_txd", "GPS TXD pin (not really needed)", 0, &sonde.config.gps_txd},
|
||||
};
|
||||
|
|
@ -480,12 +463,19 @@ void addConfigOnOffEntry(char *ptr, int idx, const char *label, int *value) {
|
|||
void addConfigSeparatorEntry(char *ptr) {
|
||||
strcat(ptr, "<tr><td colspan=\"2\" class=\"divider\"><hr /></td></tr>\n");
|
||||
}
|
||||
void addConfigHeading(char *ptr, const char *label) {
|
||||
strcat(ptr, "<tr><th colspan=\"2\">");
|
||||
strcat(ptr, label);
|
||||
strcat(ptr, "</th></tr>\n");
|
||||
}
|
||||
|
||||
const char *createConfigForm() {
|
||||
char *ptr = message;
|
||||
strcpy(ptr, "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"></head><body><form action=\"config.html\" method=\"post\"><table><tr><th>Option</th><th>Value</th></tr>");
|
||||
for (int i = 0; i < N_CONFIG; i++) {
|
||||
switch (config_list[i].type) {
|
||||
case -5: // Heading
|
||||
addConfigHeading(ptr, config_list[i].label);
|
||||
case -3: // in/offt
|
||||
addConfigOnOffEntry(ptr, i, config_list[i].label, (int *)config_list[i].data);
|
||||
break;
|
||||
|
|
@ -771,7 +761,6 @@ void SetupAsyncServer() {
|
|||
|
||||
// Route to set GPIO to HIGH
|
||||
server.on("/test.php", HTTP_POST, [](AsyncWebServerRequest * request) {
|
||||
//digitalWrite(ledPin, HIGH);
|
||||
request->send(SPIFFS, "/index.html", String(), false, processor);
|
||||
});
|
||||
|
||||
|
|
@ -889,7 +878,19 @@ void initTouch() {
|
|||
char buffer[85];
|
||||
MicroNMEA nmea(buffer, sizeof(buffer));
|
||||
|
||||
void unkHandler(const MicroNMEA& nmea) {
|
||||
if(strcmp(nmea.getMessageID(), "VTG")==0) {
|
||||
const char *s = nmea.getSentence();
|
||||
while(*s && *s!=',') s++;
|
||||
if(*s==',') s++; else return;
|
||||
if(*s==',') return; /// no new course data
|
||||
int course = nmea.parseFloat(s, 0, NULL);
|
||||
Serial.printf("Course update: %d\n", course);
|
||||
}
|
||||
}
|
||||
void gpsTask(void *parameter) {
|
||||
nmea.setUnknownSentenceHandler(unkHandler);
|
||||
|
||||
while (1) {
|
||||
while (Serial2.available()) {
|
||||
char c = Serial2.read();
|
||||
|
|
@ -1196,6 +1197,10 @@ void setup()
|
|||
sleep(500);
|
||||
}
|
||||
}
|
||||
if(sonde.config.power_pout>=0) { // for a heltec v2, pull GPIO21 low for display power
|
||||
pinMode(sonde.config.power_pout&127, OUTPUT);
|
||||
digitalWrite(sonde.config.power_pout&127, sonde.config.power_pout&128?1:0);
|
||||
}
|
||||
|
||||
LORA_LED = sonde.config.led_pout;
|
||||
pinMode(LORA_LED, OUTPUT);
|
||||
|
|
@ -1324,9 +1329,6 @@ void setup()
|
|||
sonde.setup();
|
||||
initGPS();
|
||||
|
||||
if (sonde.config.kisstnc.active) {
|
||||
tncserver.begin();
|
||||
}
|
||||
WiFi.onEvent(WiFiEvent);
|
||||
getKeyPress(); // clear key buffer
|
||||
}
|
||||
|
|
@ -1482,10 +1484,10 @@ void loopSpectrum() {
|
|||
itoa((sonde.config.startfreq + 6), buf, 10);
|
||||
disp.rdis->drawString(13, 1, buf);
|
||||
}
|
||||
if (sonde.config.timer) {
|
||||
if (sonde.config.spectrum>0) {
|
||||
int remaining = sonde.config.spectrum - (millis() - specTimer) / 1000;
|
||||
itoa(remaining, buf, 10);
|
||||
Serial.printf("timer:%d config.spectrum:%d specTimer:%ld millis:%ld remaining:%d\n", sonde.config.timer, sonde.config.spectrum, specTimer, millis(), remaining);
|
||||
Serial.printf("config.spectrum:%d specTimer:%ld millis:%ld remaining:%d\n", sonde.config.spectrum, specTimer, millis(), remaining);
|
||||
if (sonde.config.marker != 0) {
|
||||
marker = 1;
|
||||
}
|
||||
|
|
@ -1531,7 +1533,7 @@ void enableNetwork(bool enable) {
|
|||
SetupAsyncServer();
|
||||
udp.begin(WiFi.localIP(), LOCALUDPPORT);
|
||||
MDNS.addService("http", "tcp", 80);
|
||||
tncserver.begin();
|
||||
if(sonde.config.kisstnc.active) { tncserver.begin(); }
|
||||
connected = true;
|
||||
} else {
|
||||
MDNS.end();
|
||||
|
|
@ -1639,7 +1641,7 @@ void WiFiEvent(WiFiEvent_t event)
|
|||
|
||||
|
||||
void wifiConnect(int16_t res) {
|
||||
Serial.printf("WLAN scan result: found %d networks\n", res);
|
||||
Serial.printf("WiFi scan result: found %d networks\n", res);
|
||||
|
||||
// pick best network
|
||||
int bestEntry = -1;
|
||||
|
|
@ -1684,13 +1686,13 @@ void loopWifiBackground() {
|
|||
|
||||
if (wifi_state == WIFI_DISABLED) { // stopped => start can
|
||||
wifi_state = WIFI_SCAN;
|
||||
Serial.println("WLAN start scan");
|
||||
Serial.println("WiFi start scan");
|
||||
WiFi.scanNetworks(true); // scan in async mode
|
||||
} else if (wifi_state == WIFI_SCAN) {
|
||||
int16_t res = WiFi.scanComplete();
|
||||
if (res == 0 || res == WIFI_SCAN_FAILED) {
|
||||
// retry
|
||||
Serial.println("WLAN restart scan");
|
||||
Serial.println("WiFi restart scan");
|
||||
WiFi.disconnect(true);
|
||||
wifi_state = WIFI_DISABLED;
|
||||
return;
|
||||
|
|
@ -1739,9 +1741,8 @@ void startAP() {
|
|||
}
|
||||
|
||||
void initialMode() {
|
||||
if (sonde.config.spectrum != 0) { // enable Spectrum in config.txt: spectrum=number_of_seconds
|
||||
if (sonde.config.spectrum != -1) { // enable Spectrum in config.txt: spectrum=number_of_seconds
|
||||
startSpectrumDisplay();
|
||||
//done in startSpectrumScan(): enterMode(ST_SPECTRUM);
|
||||
} else {
|
||||
currentDisplay = 0;
|
||||
enterMode(ST_DECODER);
|
||||
|
|
@ -1860,14 +1861,15 @@ void loopWifiScan() {
|
|||
}
|
||||
enableNetwork(true);
|
||||
initialMode();
|
||||
|
||||
if (sonde.config.spectrum != 0) { // enable Spectrum in config.txt: spectrum=number_of_seconds
|
||||
//startSpectrumDisplay();
|
||||
#if 0
|
||||
// done already in initialMode
|
||||
if (sonde.config.spectrum != -1) { // enable Spectrum in config.txt: spectrum=number_of_seconds (0=forever)
|
||||
enterMode(ST_SPECTRUM);
|
||||
} else {
|
||||
currentDisplay = 0;
|
||||
enterMode(ST_DECODER);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<div class="tab">
|
||||
<button class="tablinks" onclick="selTab(event,'QRG')" id="defaultTab">QRG</button>
|
||||
<button class="tablinks" onclick="selTab(event,'WLAN')">WLAN</button>
|
||||
<button class="tablinks" onclick="selTab(event,'WiFi')">WiFi</button>
|
||||
<button class="tablinks" onclick="selTab(event,'Data')">Data</button>
|
||||
<button class="tablinks" onclick="selTab(event,'SondeMap')">SondeMap</button>
|
||||
<button class="tablinks" onclick="selTab(event,'Config')">Config</button>
|
||||
|
|
@ -29,8 +29,8 @@
|
|||
<iframe src="qrg.html" style="border:none;" width="100%%" height="100%%"></iframe>
|
||||
</div>
|
||||
|
||||
<div id="WLAN" class="tabcontent">
|
||||
<h3> WLAN - Settings</h3>
|
||||
<div id="WiFi" class="tabcontent">
|
||||
<h3> WiFi - Settings</h3>
|
||||
<iframe src="wifi.html" style="border:none;" width="100%%" height="100%%"></iframe>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,12 @@ table, th, td {
|
|||
background-color: #ddd
|
||||
}
|
||||
|
||||
td#caption {
|
||||
text-align: center;
|
||||
background-color: #aaa;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
td#sfreq {
|
||||
background-color: #ccc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
const char *version_name = "rdzTTGOsonde";
|
||||
const char *version_id = "devel20191016";
|
||||
const char *version_id = "devel20191018";
|
||||
|
|
|
|||
|
|
@ -240,6 +240,11 @@ void U8x8Display::drawString(uint8_t x, uint8_t y, const char *s, int16_t width,
|
|||
void U8x8Display::drawTile(uint8_t x, uint8_t y, uint8_t cnt, uint8_t *tile_ptr) {
|
||||
u8x8->drawTile(x, y, cnt, tile_ptr);
|
||||
}
|
||||
|
||||
void U8x8Display::drawBitmap(uint16_t x1, uint16_t y1, const uint16_t* bitmap, int16_t w, int16_t h) {
|
||||
// not supported
|
||||
}
|
||||
|
||||
void U8x8Display::welcome() {
|
||||
u8x8->clear();
|
||||
setFont(FONT_LARGE);
|
||||
|
|
@ -401,6 +406,10 @@ void ILI9225Display::drawTile(uint8_t x, uint8_t y, uint8_t cnt, uint8_t *tile_p
|
|||
#endif
|
||||
}
|
||||
|
||||
void ILI9225Display::drawBitmap(uint16_t x1, uint16_t y1, const uint16_t* bitmap, int16_t w, int16_t h) {
|
||||
tft->drawBitmap(x1, y1, bitmap, w, h);
|
||||
}
|
||||
|
||||
void ILI9225Display::welcome() {
|
||||
tft->clear();
|
||||
setFont(6);
|
||||
|
|
@ -577,7 +586,19 @@ void Display::parseDispElement(char *text, DispEntry *de)
|
|||
de->func = disp.drawSite; break;
|
||||
case 'g':
|
||||
de->func = disp.drawGPS;
|
||||
de->extra = strdup(text+1);
|
||||
if(text[1]=='0') {
|
||||
// extended configuration for arrow...
|
||||
struct CircleInfo *circinfo = (struct CircleInfo *)malloc(sizeof(struct CircleInfo));
|
||||
circinfo->type = '0';
|
||||
circinfo->radius = atoi(text+2);
|
||||
circinfo->brad = 3;
|
||||
circinfo->bcol = 0xffff;
|
||||
circinfo->acol = 0xffff;
|
||||
circinfo->awidth = 4;
|
||||
de->extra = (char *)circinfo;
|
||||
} else {
|
||||
de->extra = strdup(text+1);
|
||||
}
|
||||
Serial.printf("parsing 'g' entry: extra is '%s'\n", de->extra);
|
||||
break;
|
||||
case 'r':
|
||||
|
|
@ -724,6 +745,42 @@ void Display::initFromFile() {
|
|||
setLayout(0);
|
||||
}
|
||||
|
||||
void Display::circ(uint16_t *bm, int16_t size, int16_t x0, int16_t y0, int16_t r, uint16_t fg, boolean fill, uint16_t bg) {
|
||||
// draw circle
|
||||
int x = 0;
|
||||
int y = r;
|
||||
int ddF_x = 1;
|
||||
int ddF_y = -2 * r;
|
||||
int f = 1-r;
|
||||
bm[x0 + (y0+r)*size] = fg;
|
||||
bm[x0 + (y0-r)*size] = fg;
|
||||
bm[x0+r + y0*size] = fg;
|
||||
bm[x0-r + y0*size] = fg;
|
||||
if(fill) { for(int yy=-y+1; yy<y-1; yy++) { bm[ (x0+yy) + y0*size ] = bg; } }
|
||||
while(x<y) {
|
||||
boolean newy = false;
|
||||
if(f>=0) { y--; ddF_y += 2; f += ddF_y; newy = true; }
|
||||
x++; ddF_x += 2; f += ddF_x;
|
||||
bm[ (x0+x) + (y0+y)*size ] = fg;
|
||||
bm[ (x0-x) + (y0+y)*size ] = fg;
|
||||
bm[ (x0+x) + (y0-y)*size ] = fg;
|
||||
bm[ (x0-x) + (y0-y)*size ] = fg;
|
||||
bm[ (x0+y) + (y0+x)*size ] = fg;
|
||||
bm[ (x0-y) + (y0+x)*size ] = fg;
|
||||
bm[ (x0+y) + (y0-x)*size ] = fg;
|
||||
bm[ (x0-y) + (y0-x)*size ] = fg;
|
||||
if(fill) {
|
||||
if(newy) {
|
||||
for(int xx = -x+1; xx<x-1; xx++) bm[ (x0+xx) + (y0+y)*size ] = bg;
|
||||
for(int xx = -x+1; xx<x-1; xx++) bm[ (x0+xx) + (y0-y)*size ] = bg;
|
||||
}
|
||||
for(int yy = -y+1; yy<y-1; yy++) bm[ (x0+yy) + (y0+x)*size ] = bg;
|
||||
for(int yy = -y+1; yy<y-1; yy++) bm[ (x0+yy) + (y0-x)*size ] = bg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Display::setLayout(int layoutIdx) {
|
||||
layout = &layouts[layoutIdx];
|
||||
}
|
||||
|
|
@ -765,10 +822,14 @@ void Display::drawHS(DispEntry *de) {
|
|||
drawString(de," ");
|
||||
return;
|
||||
}
|
||||
boolean is_ms = (de->extra && de->extra[0]=='m')?true:false; // m/s or km/h
|
||||
float hs = sonde.si()->hs;
|
||||
if(is_ms) hs = hs / 3.6;
|
||||
boolean has_extra = (de->extra && de->extra[1]!=0)? true: false;
|
||||
snprintf(buf, 16, sonde.si()->hs>99?" %3.0f":" %2.1f", sonde.si()->hs);
|
||||
if(de->extra) { strcat(buf, de->extra); }
|
||||
drawString(de,buf+strlen(buf)-4- (de->extra?strlen(de->extra):0) );
|
||||
if(!de->extra) rdis->drawTile(de->x+4,de->y,2,kmh_tiles);
|
||||
if(has_extra) { strcat(buf, de->extra+1); }
|
||||
drawString(de,buf+strlen(buf)-4- (has_extra?strlen(de->extra+1):0) );
|
||||
if(!has_extra) rdis->drawTile(de->x+4,de->y,2,is_ms?ms_tiles:kmh_tiles);
|
||||
}
|
||||
void Display::drawVS(DispEntry *de) {
|
||||
rdis->setFont(de->fmt);
|
||||
|
|
@ -985,6 +1046,23 @@ void Display::drawGPS(DispEntry *de) {
|
|||
rdis->drawTile(de->x+3, de->y, 1, deg_tile);
|
||||
}
|
||||
break;
|
||||
case '0':
|
||||
// diagram
|
||||
{
|
||||
struct CircleInfo *circinfo = (struct CircleInfo *)de->extra;
|
||||
int size = 1 + 2*circinfo->radius + 2*circinfo->brad;
|
||||
uint16_t *bitmap = (uint16_t *)malloc(sizeof(uint16_t) * size * size);
|
||||
Serial.printf("Drawing circle with size %d at %d,%d\n",size,de->x, de->y);
|
||||
for(int i=0; i<size*size; i++) { bitmap[i] = 0; }
|
||||
// draw circle
|
||||
int x0=size/2;
|
||||
int y0=x0;
|
||||
circ(bitmap, size, x0, y0, circinfo->radius, de->fg, true, de->bg);
|
||||
circ(bitmap, size, x0+circinfo->radius, y0, circinfo->brad, 0xff00, true, 0xff00);
|
||||
rdis->drawBitmap(de->x, de->y, bitmap, size, size);
|
||||
free(bitmap);
|
||||
}
|
||||
break;
|
||||
case 'E':
|
||||
// elevation
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
#define WIDTH_AUTO 9999
|
||||
struct DispEntry {
|
||||
int8_t y;
|
||||
int8_t x;
|
||||
int16_t y;
|
||||
int16_t x;
|
||||
int16_t fmt, width;
|
||||
uint16_t fg,bg;
|
||||
void (*func)(DispEntry *de);
|
||||
|
|
@ -25,6 +25,15 @@ struct DispInfo {
|
|||
int16_t *timeouts;
|
||||
};
|
||||
|
||||
struct CircleInfo {
|
||||
char type;
|
||||
uint8_t radius;
|
||||
uint8_t brad;
|
||||
uint16_t bcol;
|
||||
uint8_t awidth;
|
||||
uint16_t acol;
|
||||
};
|
||||
|
||||
// Now starting towards supporting different Display types / libraries
|
||||
class RawDisplay {
|
||||
public:
|
||||
|
|
@ -34,8 +43,10 @@ public:
|
|||
virtual void getDispSize(uint8_t *height, uint8_t *width, uint8_t *lineskip, uint8_t *colskip) = 0;
|
||||
virtual void drawString(uint8_t x, uint8_t y, const char *s, int16_t width=WIDTH_AUTO, uint16_t fg=0xffff, uint16_t bg=0 ) = 0;
|
||||
virtual void drawTile(uint8_t x, uint8_t y, uint8_t cnt, uint8_t *tile_ptr) = 0;
|
||||
virtual void drawBitmap(uint16_t x1, uint16_t y1, const uint16_t* bitmap, int16_t w, int16_t h) = 0;
|
||||
virtual void welcome() = 0;
|
||||
virtual void drawIP(uint8_t x, uint8_t y, int16_t width=WIDTH_AUTO, uint16_t fg=0xffff, uint16_t bg=0 ) = 0;
|
||||
|
||||
};
|
||||
|
||||
class U8x8Display : public RawDisplay {
|
||||
|
|
@ -53,6 +64,7 @@ public:
|
|||
void getDispSize(uint8_t *height, uint8_t *width, uint8_t *lineskip, uint8_t *colskip);
|
||||
void drawString(uint8_t x, uint8_t y, const char *s, int16_t width=WIDTH_AUTO, uint16_t fg=0xffff, uint16_t bg=0);
|
||||
void drawTile(uint8_t x, uint8_t y, uint8_t cnt, uint8_t *tile_ptr);
|
||||
void drawBitmap(uint16_t x1, uint16_t y1, const uint16_t* bitmap, int16_t w, int16_t h);
|
||||
void welcome();
|
||||
void drawIP(uint8_t x, uint8_t y, int16_t width=WIDTH_AUTO, uint16_t fg=0xffff, uint16_t bg=0);
|
||||
};
|
||||
|
|
@ -78,6 +90,7 @@ public:
|
|||
void getDispSize(uint8_t *height, uint8_t *width, uint8_t *lineskip, uint8_t *colskip);
|
||||
void drawString(uint8_t x, uint8_t y, const char *s, int16_t width=WIDTH_AUTO, uint16_t fg=0xffff, uint16_t bg=0);
|
||||
void drawTile(uint8_t x, uint8_t y, uint8_t cnt, uint8_t *tile_ptr);
|
||||
void drawBitmap(uint16_t x1, uint16_t y1, const uint16_t* bitmap, int16_t w, int16_t h);
|
||||
void welcome();
|
||||
void drawIP(uint8_t x, uint8_t y, int16_t width=WIDTH_AUTO, uint16_t fg=0xffff, uint16_t bg=0);
|
||||
};
|
||||
|
|
@ -90,6 +103,7 @@ private:
|
|||
int xscale=13, yscale=22;
|
||||
int fontsma=0, fontlar=1;
|
||||
uint16_t colfg, colbg;
|
||||
static void circ(uint16_t *bm, int16_t w, int16_t x0, int16_t y0, int16_t r, uint16_t fg, boolean fill, uint16_t bg);
|
||||
public:
|
||||
void initFromFile();
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ void Sonde::defaultConfig() {
|
|||
memset(sondeList, 0, (MAXSONDE+1)*sizeof(SondeInfo));
|
||||
config.touch_thresh = 70;
|
||||
config.led_pout = 9;
|
||||
config.power_pout = -1;
|
||||
// Try autodetecting board type
|
||||
// Seems like on startup, GPIO4 is 1 on v1 boards, 0 on v2.1 boards?
|
||||
config.gps_rxd = -1;
|
||||
|
|
@ -79,6 +80,7 @@ void Sonde::defaultConfig() {
|
|||
config.oled_scl = 15;
|
||||
config.button_pin = 0;
|
||||
config.button2_pin = T4 + 128; // T4 == GPIO13
|
||||
config.power_pout = 21; // for Heltec v2
|
||||
Serial.println("Autoconfig: looks like TTGO v1 / Heltec v1/V2 board");
|
||||
} else {
|
||||
config.oled_sda = 21;
|
||||
|
|
@ -146,7 +148,6 @@ void Sonde::defaultConfig() {
|
|||
config.startfreq=400;
|
||||
config.channelbw=10;
|
||||
config.spectrum=10;
|
||||
config.timer=0;
|
||||
config.marker=0;
|
||||
config.showafc=0;
|
||||
config.freqofs=0;
|
||||
|
|
@ -196,6 +197,8 @@ void Sonde::setConfig(const char *cfg) {
|
|||
config.touch_thresh = atoi(val);
|
||||
} else if(strcmp(cfg,"led_pout")==0) {
|
||||
config.led_pout = atoi(val);
|
||||
} else if(strcmp(cfg,"power_pout")==0) {
|
||||
config.power_pout = atoi(val);
|
||||
} else if(strcmp(cfg,"disptype")==0) {
|
||||
config.disptype = atoi(val);
|
||||
} else if(strcmp(cfg,"oled_sda")==0) {
|
||||
|
|
@ -230,8 +233,6 @@ void Sonde::setConfig(const char *cfg) {
|
|||
config.channelbw = atoi(val);
|
||||
} else if(strcmp(cfg,"spectrum")==0) {
|
||||
config.spectrum = atoi(val);
|
||||
} else if(strcmp(cfg,"timer")==0) {
|
||||
config.timer = atoi(val);
|
||||
} else if(strcmp(cfg,"marker")==0) {
|
||||
config.marker = atoi(val);
|
||||
} else if(strcmp(cfg,"showafc")==0) {
|
||||
|
|
|
|||
|
|
@ -81,10 +81,12 @@ struct st_dfmconfig {
|
|||
};
|
||||
|
||||
typedef struct st_rdzconfig {
|
||||
// hardware configuration
|
||||
int button_pin; // PIN port number menu button (+128 for touch mode)
|
||||
int button2_pin; // PIN port number menu button (+128 for touch mode)
|
||||
int touch_thresh; // Threshold value (0..100) for touch input button
|
||||
int led_pout; // POUT port number of LED (used as serial monitor)
|
||||
int power_pout; // Power control pin (for Heltec v2)
|
||||
int disptype; // 0=OLED; 1=ILI9225
|
||||
int oled_sda; // OLED/TFT data pin
|
||||
int oled_scl; // OLED/TFT clock pin
|
||||
|
|
@ -93,26 +95,28 @@ typedef struct st_rdzconfig {
|
|||
int tft_cs; // TFT CS pin
|
||||
int gps_rxd; // GPS module RXD pin. We expect 9600 baud NMEA data.
|
||||
int gps_txd; // GPS module TXD pin
|
||||
// software configuration
|
||||
int debug; // show port and config options after reboot
|
||||
int wifi; // connect to known WLAN 0=skip
|
||||
int wifiap; // enable/disable WiFi AccessPoint mode 0=disable
|
||||
int display; // select display mode (0=default, 1=default, 2=fieldmode)
|
||||
int startfreq; // spectrum display start freq (400, 401, ...)
|
||||
int channelbw; // spectrum channel bandwidth (valid: 5, 10, 20, 25, 50, 100 kHz)
|
||||
int spectrum; // show freq spectrum for n seconds 0=disable
|
||||
int timer; // show remaining time in spectrum 0=disable
|
||||
int spectrum; // show freq spectrum for n seconds -1=disable; 0=forever
|
||||
int marker; // show freq marker in spectrum 0=disable
|
||||
int maxsonde; // number of max sonde in scan (range=1-99)
|
||||
int norx_timeout; // Time after which rx mode switches to scan mode (without rx signal)
|
||||
int noisefloor; // for spectrum display
|
||||
// receiver configuration
|
||||
int showafc; // show afc value in rx screen
|
||||
int freqofs; // frequency offset (tuner config = rx frequency + freqofs) in Hz
|
||||
char call[9]; // APRS callsign
|
||||
char passcode[9]; // APRS passcode
|
||||
struct st_rs41config rs41; // configuration options specific for RS41 receiver
|
||||
struct st_rs92config rs92;
|
||||
struct st_dfmconfig dfm;
|
||||
// data feed configuration
|
||||
// for now, one feed for each type is enough, but might get extended to more?
|
||||
char call[9]; // APRS callsign
|
||||
char passcode[9]; // APRS passcode
|
||||
struct st_feedinfo udpfeed; // target for AXUDP messages
|
||||
struct st_feedinfo tcpfeed; // target for APRS-IS TCP connections
|
||||
struct st_kisstnc kisstnc; // target for KISS TNC (via TCP, mainly for APRSdroid)
|
||||
|
|
|
|||
Loading…
Reference in New Issue