some reorg, gps factory def, ftp bugfix

pull/63/head
Hansi, dl9rdz 2020-12-31 00:10:15 +01:00
rodzic b0f5f0c7ea
commit 82db61c91f
16 zmienionych plików z 68 dodań i 35 usunięć

Wyświetl plik

@ -47,7 +47,6 @@ install:
- arduino --pref "build.path=$PWD/build" --save-prefs
- arduino --install-boards esp32:esp32 --save-prefs
- ln -s $PWD/libraries/SondeLib /usr/local/share/arduino/libraries/SondeLib
- ln -s $PWD/libraries/SX1278FSK /usr/local/share/arduino/libraries/SX1278FSK
- arduino --install-library "U8g2"
- arduino --install-library "MicroNMEA"
script:

Wyświetl plik

@ -1,16 +1,14 @@
RDZ_TTGO_SONDE
==============
This a simple, experimental, not (well) tested, and incomplete decoder for
radiosonde RS41 and DFM06/09 on a TTGO LoRa ESP32 with OLED display board.
This a simple, experimental decoder for radiosonde RS41, RS92, DFM06/09/17 and M10/M20 on
a TTGO LoRa ESP32 board with either a OLED or extern TFT display.
There have been made some additions for TTGO LoRa ESP32 with only RST button.
Please check also your OLED port settings, both versions use different ports.
You can setup the depending ports in config.txt, OLED Setup is depending on hardware of LoRa board
- TTGO v1: SDA=4 SCL=15, RST=16
- TTGO v2: SDA=21 SCL=22, RST=16
Please consult the Wiki at https://github.com/dl9rdz/rdz_ttgo_sonde/wiki/Supported-boards
for details on supported boardsi, and additional setup instructions.
## Button commands
You can use the button on the board (not the reset button, the second one) to
issue some commands. The software distinguishes between several inputs:
@ -19,6 +17,10 @@ issue some commands. The software distinguishes between several inputs:
- MID Medium-length button press (2-4 seconds)
- LONG Long button press (>5 seconds)
You can optionally use a second button, which you have to add manually to your board.
See https://github.com/dl9rdz/rdz_ttgo_sonde/wiki/Hardware-configuration for details.
## Wireless configuration
On startup, as well as after a LONG button press, the WiFI configuration will
@ -32,19 +34,23 @@ bottom line. Then the board will switch to scanning mode.
## Scanning mode
In the scanning mode, the board will iterate over all channels configured in
channels.txt, trying to decode a radio sonde on each channel for about 1 second
for RS41, a bit less for DMF06/09. If a valid signal is found, the board switches
to receiving mode on that channel. a SHORT buttong press will also switch to
receiving mode.
channels.txt, trying to decode a radio sonde on each channel for about 1 second.
If a valid signal is found, the board switches to receiving mode on that channel.
A SHORT buttong press will also switch to receiving mode.
## Receiving mode
In receiving mode, a single frequency will be decoded, and sonde info (ID, GPS
coordinates, RSSI) will be displayed. The bar above the IP address indicates,
for the last 18 frames, if reception was successfull (|) or failed (.)
for the last 18 frames, if reception was successfull (|) or failed (.), or had
some errors (E), e.g., CRC check failed.
A DOUBLE press will switch to scanning mode.
A SHORT press will switch to the next channel in channels.txt
A SHORT press on the second button will switch to a different display screen.
## Spectrum mode
A medium press will active scan the whole band (400..406 MHz) and display a

Wyświetl plik

@ -79,6 +79,10 @@ static int currentDisplay = 1;
// timestamp when spectrum display was activated
static unsigned long specTimer;
void enterMode(int mode);
void WiFiEvent(WiFiEvent_t event);
// Read line from file, independent of line termination (LF or CR LF)
String readLine(Stream &stream) {
String s = stream.readStringUntil('\n');
@ -1134,6 +1138,7 @@ void unkHandler(T nmea) {
Serial.printf("Course update: %d\n", lastCourse);
}
}
//#define DEBUG_GPS 1
void gpsTask(void *parameter) {
nmea.setUnknownSentenceHandler(unkHandler);
@ -1142,7 +1147,8 @@ void gpsTask(void *parameter) {
char c = Serial2.read();
//Serial.print(c);
if (nmea.process(c)) {
//Serial.println(nmea.getSentence());
#ifdef DEBUG_GPS
Serial.print(nmea.getSentence());
long lat = nmea.getLatitude();
long lon = nmea.getLongitude();
long alt = -1;
@ -1150,17 +1156,38 @@ void gpsTask(void *parameter) {
bool valid = nmea.isValid();
int course = nmea.getCourse() / 1000;
uint8_t hdop = nmea.getHDOP();
//Serial.printf("\nDecode: valid: %d N %ld E %ld alt %ld (%d) course:%d dop:%d", valid ? 1 : 0, lat, lon, alt, b, c, hdop);
Serial.printf(" =>: valid: %d N %ld E %ld alt %ld (%d) course:%d dop:%d\n", valid ? 1 : 0, lat, lon, alt, b, c, hdop);
#endif
}
}
delay(50);
}
}
#define UBX_SYNCH_1 0xB5
#define UBX_SYNCH_2 0x62
uint8_t ubx_set9k6[]={UBX_SYNCH_1, UBX_SYNCH_2, 0x06, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x08, 0x00, 0x00, 0x80, 0x25, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8D, 0x8F};
uint8_t ubx_factorydef[]={UBX_SYNCH_1, UBX_SYNCH_2, 0x06, 0x09, 13, 0, 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0x17, 0x8A };
void initGPS() {
if (sonde.config.gps_rxd < 0) return; // GPS disabled
Serial2.begin(9600, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd);
if (sonde.config.gps_txd >= 0) { // TX enable, thus try setting baud to 9600 and do a factory reset
Serial.println("Trying to reset GPS...");
Serial2.begin(115200, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd);
Serial2.write(ubx_set9k6, sizeof(ubx_set9k6));
delay(100);
Serial2.begin(38400, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd);
Serial2.write(ubx_set9k6, sizeof(ubx_set9k6));
delay(100);
Serial2.begin(19200, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd);
Serial2.write(ubx_set9k6, sizeof(ubx_set9k6));
delay(100);
Serial2.begin(9600, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd);
Serial2.write(ubx_factorydef, sizeof(ubx_factorydef));
delay(1000);
} else {
Serial2.begin(9600, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd);
}
xTaskCreate( gpsTask, "gpsTask",
5000, /* stack size */
NULL, /* paramter */

Wyświetl plik

@ -1,4 +1,4 @@
const char *version_name = "rdzTTGOsonde";
const char *version_id = "devel20201230";
const char *version_id = "devel20201230b";
const int SPIFFS_MAJOR=2;
const int SPIFFS_MINOR=8;

Wyświetl plik

@ -591,7 +591,7 @@ int DFM::receiveOld() {
for(int i=0; i<2; i++) {
sx1278.setPayloadLength(33); // Expect 33 bytes (7+13+13 bytes)
sx1278.writeRegister(REG_OP_MODE, FSK_RX_MODE);
int t = millis();
//int t = millis();
int e = sx1278.receivePacketTimeout(1000, data);
//Serial.printf("rxPTO done after %d ms", (int)(millis()-t));
if(e) { return RX_TIMEOUT; } //if timeout... return 1

Wyświetl plik

@ -11,11 +11,11 @@ int readLine(Stream &stream, char *buffer, int maxlen);
extern const char *version_name;
extern const char *version_id;
#include <../fonts/FreeMono9pt7b.h>
#include <../fonts/FreeMono12pt7b.h>
#include <../fonts/FreeSans9pt7b.h>
#include <../fonts/FreeSans12pt7b.h>
#include <../fonts/Picopixel.h>
#include <fonts/FreeMono9pt7b.h>
#include <fonts/FreeMono12pt7b.h>
#include <fonts/FreeSans9pt7b.h>
#include <fonts/FreeSans12pt7b.h>
#include <fonts/Picopixel.h>
extern Sonde sonde;

Wyświetl plik

@ -23,7 +23,7 @@ static uint8_t rxbitc;
static uint16_t rxbyte;
static int rxp=0;
static int haveNewFrame = 0;
static int lastFrame = 0;
//static int lastFrame = 0;
static int headerDetected = 0;
int M10M20::setup(float frequency)
@ -195,7 +195,6 @@ static uint16_t crc_M10M20(int len, uint8_t *msg) {
return cs;
}
static bool checkM10M20crc(int crcpos, uint8_t *msg) {
int i;
uint16_t cs, cs1;
cs = crc_M10M20(crcpos, msg);
cs1 = (msg[crcpos] << 8) | msg[crcpos+1];

Wyświetl plik

@ -164,8 +164,8 @@ void SX1278FSK::writeRegister(byte address, byte data)
*/
void SX1278FSK::clearIRQFlags()
{
byte st0;
#if 0
byte st0;
// Save the previous status
st0 = readRegister(REG_OP_MODE);
// Stdby mode to write in registers
@ -197,7 +197,7 @@ uint8_t SX1278FSK::setFSK()
{
uint8_t state = 2;
byte st0;
byte config1;
//byte config1;
#if (SX1278FSK_debug_mode > 1)
Serial.println();

Wyświetl plik

@ -136,9 +136,13 @@ void geteph() {
int len=0;
while(dclient.connected()) {
while(dclient.available()) {
char c = dclient.read();
fh.write(c);
len++;
int c = dclient.read();
if(c==-1) {
Serial.println("dclient.read() returned -1 inspite of available() being true?!");
} else {
fh.write(c);
len++;
}
}
}
Serial.printf("fetched %d bytes\n", len);

Wyświetl plik

@ -16,13 +16,11 @@ data_dir = RX_FSK/data
[extra]
lib_deps_builtin =
SondeLib
SX1278FSK
fonts
lib_deps_external =
olikraus/U8g2 @ ^2.28.8
AXP202X_Library
stevemarple/MicroNMEA @ ^2.0.3
nkawu/TFT 22 ILI9225 @ ^1.4.4
stevemarple/MicroNMEA @ ^2.0.5
; nkawu/TFT 22 ILI9225 @ ^1.4.4
me-no-dev/ESP Async WebServer @ ^1.2.3
https://github.com/dx168b/async-mqtt-client