version info in version.h, some code formatting (arduino style)

This commit is contained in:
Hans P. Reiser 2019-04-28 13:29:53 +02:00
parent b68ffee8b0
commit 8da577a313
1 changed files with 154 additions and 147 deletions

View File

@ -10,6 +10,7 @@
#include <Sonde.h>
#include <Scanner.h>
#include <aprs.h>
#include "version.h"
// UNCOMMENT one of the constructor lines below
U8X8_SSD1306_128X64_NONAME_SW_I2C *u8x8 = NULL; // initialize later after reading config file
@ -523,9 +524,11 @@ void setup()
u8x8->clear();
u8x8->setFont(u8x8_font_7x14_1x2_r);
u8x8->drawString(1, 1, "RDZ_TTGO_SONDE");
u8x8->drawString(2, 3, "devel20190426");
u8x8->drawString(1, 5, "Mods by DL2MF");
u8x8->drawString(8 - strlen(version_name) / 2, 1, version_name);
u8x8->drawString(8 - strlen(version_id) / 2, 3, version_id);
u8x8->setFont(u8x8_font_chroma48medium8_r);
u8x8->drawString(0, 5, "by Hansi, DL9RDZ");
u8x8->drawString(1, 6, "Mods by DL2MF");
delay(3000);
sonde.clearDisplay();
@ -705,7 +708,12 @@ void loopScanner() {
}
}
static int specTimer = 0;
void loopSpectrum() {
int marker = 0;
char buf[5];
switch (getKeyPress()) {
case KP_SHORT: /* move selection of peak, TODO */
sonde.nextConfig(); // TODO: Should be set specific frequency
@ -718,25 +726,9 @@ void loopSpectrum() {
case KP_DOUBLE: /* ignore */ break;
default: break;
}
scanner.scan();
scanner.plotResult();
}
void startSpectrumDisplay() {
int marker=0;
char buf[5];
sonde.clearDisplay();
u8x8->setFont(u8x8_font_chroma48medium8_r);
u8x8->drawString(0, 0, "Spectrum Scan...");
delay(500);
enterMode(ST_SPECTRUM);
for (int i = 0; i < sonde.config.spectrum; i++) {
scanner.scan();
scanner.plotResult();
if (sonde.config.marker != 0) {
itoa((sonde.config.startfreq), buf, 10);
u8x8->drawString(0, 1, buf);
@ -744,19 +736,30 @@ void startSpectrumDisplay() {
itoa((sonde.config.startfreq + 6), buf, 10);
u8x8->drawString(13, 1, buf);
}
if (sonde.config.timer != 0) {
itoa((sonde.config.spectrum - i), buf, 10);
if (specTimer > 0) {
itoa(specTimer, buf, 10);
if (sonde.config.marker != 0) {
marker = 1;
}
u8x8->drawString(0, 1 + marker, buf);
u8x8->drawString(2, 1 + marker, "Sec.");
specTimer--;
if (specTimer <= 0) {
enterMode(ST_SCANNER);
}
}
delay(1000);
}
void startSpectrumDisplay() {
sonde.clearDisplay();
u8x8->setFont(u8x8_font_chroma48medium8_r);
u8x8->drawString(0, 0, "Spectrum Scan...");
delay(500);
specTimer = sonde.config.spectrum;
enterMode(ST_SPECTRUM);
}
String translateEncryptionType(wifi_auth_mode_t encryptionType) {
switch (encryptionType) {
case (WIFI_AUTH_OPEN):
@ -1037,7 +1040,9 @@ void loopWifiScan() {
Serial.println("-----------------------");
const char *id = WiFi.SSID(i).c_str();
int curidx = fetchWifiIndex(id);
if(curidx>=0 && index==-1) { index = curidx; }
if (curidx >= 0 && index == -1) {
index = curidx;
}
}
if (index >= 0) { // some network was found
Serial.print("Connecting to: "); Serial.println(fetchWifiSSID(index));
@ -1082,10 +1087,12 @@ void loopWifiScan() {
initialMode();
if (sonde.config.spectrum != 0) { // enable Spectrum in config.txt: spectrum=number_of_seconds
startSpectrumDisplay();
}
//startSpectrumDisplay();
enterMode(ST_SPECTRUM);
} else {
enterMode(ST_SCANNER);
}
}
void loop() {
Serial.println("Running main loop");