Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5570da3aa |
@@ -1,10 +1,11 @@
|
|||||||
RadioSonde Version 0.8.5
|
RadioSonde Version 0.8.7
|
||||||
============================
|
============================
|
||||||
<img src="http://xavier.debert.free.fr/RS/TTGO.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO2.jpg" width="50%">
|
<img src="http://xavier.debert.free.fr/RS/TTGO.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO2.jpg" width="50%">
|
||||||
<img src="http://xavier.debert.free.fr/RS/TTGO3.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO4.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO5.jpg" width="50%">
|
<img src="http://xavier.debert.free.fr/RS/TTGO3.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO4.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO5.jpg" width="50%">
|
||||||
<img src="http://xavier.debert.free.fr/RS/Web4.png" width="20%"><img src="http://xavier.debert.free.fr/RS/Web.png" width="20%">
|
<img src="http://xavier.debert.free.fr/RS/Web4.png" width="20%"><img src="http://xavier.debert.free.fr/RS/Web.png" width="20%">
|
||||||
<img src="http://xavier.debert.free.fr/RS/Web3.png" width="20%"><img src="http://xavier.debert.free.fr/RS/Web2.png" width="20%">
|
<img src="http://xavier.debert.free.fr/RS/Web3.png" width="20%"><img src="http://xavier.debert.free.fr/RS/Web2.png" width="20%">
|
||||||
<img src="http://xavier.debert.free.fr/RS/Web5.png" width="20%">
|
<img src="http://xavier.debert.free.fr/RS/Web5.png" width="20%"><img src="http://xavier.debert.free.fr/RS/Web6.png" width="20%">
|
||||||
|
<img src="http://xavier.debert.free.fr/RS/Web7.png" width="20%">
|
||||||
|
|
||||||
|
|
||||||
Projet basé sur le travail de DL9RDZ
|
Projet basé sur le travail de DL9RDZ
|
||||||
@@ -18,13 +19,17 @@ vous devez modifier dans config.txt, le port de l'écran OLED
|
|||||||
- TTGO v1: SDA=4 SCL=15, RST=16
|
- TTGO v1: SDA=4 SCL=15, RST=16
|
||||||
- TTGO v2: SDA=21 SCL=22, RST=16
|
- TTGO v2: SDA=21 SCL=22, RST=16
|
||||||
|
|
||||||
## Version en production 0.8.5 et devel 0.8.7
|
## Version en production 0.8.5 devel 0.8.7
|
||||||
|
|
||||||
## 0.8.0
|
## 0.8.0
|
||||||
travail de refonte et réécriture du code
|
travail de refonte et réécriture du code
|
||||||
|
|
||||||
## 0.8.1
|
## 0.8.1
|
||||||
|
|
||||||
modification de la partie Web
|
modification de la partie Web
|
||||||
|
|
||||||
## 0.8.5
|
## 0.8.5
|
||||||
|
|
||||||
Evolution majeur du système
|
Evolution majeur du système
|
||||||
affichage du pourcentage de la batterie en mode scanning
|
affichage du pourcentage de la batterie en mode scanning
|
||||||
création d'une fenetre Batterie, Boussole
|
création d'une fenetre Batterie, Boussole
|
||||||
@@ -34,6 +39,18 @@ Ajout fonction Smetre, Buzzer, QTH, Gps on off ...
|
|||||||
mise à jour OTA
|
mise à jour OTA
|
||||||
trop de modification pour toutes les expliciter!
|
trop de modification pour toutes les expliciter!
|
||||||
|
|
||||||
|
## 0.8.7
|
||||||
|
correction bug Buzzer Off->On->Off
|
||||||
|
Add GainLNA RX SX1278FSK on Web config paramètre
|
||||||
|
Add update OTA Os + DataWeb
|
||||||
|
correction bugs sondmap.html
|
||||||
|
correction text upgrade Os et DataWeb
|
||||||
|
correction texte boussole S et N
|
||||||
|
correction bugs distance 4928Km si lat et lon =0 erroné
|
||||||
|
correction bugs fonction Vbat
|
||||||
|
Add Telemetry width export data.csv
|
||||||
|
Suppression µSD incompatible avec pin SX1278FSK et SPI
|
||||||
|
Add transfert Telemetry To µSD on put SD automatic
|
||||||
|
|
||||||
## Les Boutons optionnel à ajouter(souder)
|
## Les Boutons optionnel à ajouter(souder)
|
||||||
sur les GPIO 1002 et 1004
|
sur les GPIO 1002 et 1004
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "geteph.h"
|
#include "geteph.h"
|
||||||
#include "rs92gps.h"
|
#include "rs92gps.h"
|
||||||
|
|
||||||
|
#include "spiffs_sd.h"
|
||||||
|
|
||||||
int e;
|
int e;
|
||||||
enum MainState { ST_DECODER, ST_SPECTRUM, ST_WIFISCAN, ST_UPDATE, ST_TOUCHCALIB };
|
enum MainState { ST_DECODER, ST_SPECTRUM, ST_WIFISCAN, ST_UPDATE, ST_TOUCHCALIB };
|
||||||
@@ -41,6 +42,16 @@ String updateBinM = "/RS/radiosonde/update.ino.bin";
|
|||||||
String updateBinD = "/RS/radiosondedevel/update.ino.bin";
|
String updateBinD = "/RS/radiosondedevel/update.ino.bin";
|
||||||
String *updateBin = &updateBinM;
|
String *updateBin = &updateBinM;
|
||||||
|
|
||||||
|
String updateDataWeb = "/RS/dataweb/index.html.txt";
|
||||||
|
String updateDataWeb2 = "/RS/dataweb/sondemap.html.txt";
|
||||||
|
String updateDataWeb3 = "/RS/dataweb/config.txt";
|
||||||
|
String updateDataWeb4 = "/RS/dataweb/screens.txt";
|
||||||
|
String updateDataWeb5 = "/RS/dataweb/style.css.txt";
|
||||||
|
String updateDataWeb6 = "/RS/dataweb/qrg.txt";
|
||||||
|
String updateDataWeb7 = "/RS/dataweb/networks.txt";
|
||||||
|
String updateDataWeb8 = "/RS/dataweb/fontawesome-webfont.eot.txt";
|
||||||
|
String updateDataWeb9 = "/RS/dataweb/fontawesome-webfont.woff.txt";
|
||||||
|
|
||||||
#define LOCALUDPPORT 9002
|
#define LOCALUDPPORT 9002
|
||||||
|
|
||||||
boolean connected = false;
|
boolean connected = false;
|
||||||
@@ -435,6 +446,7 @@ struct st_configitems config_list[] = {
|
|||||||
{"noisefloor", "Sepctrum noisefloor", 0, &sonde.config.noisefloor},
|
{"noisefloor", "Sepctrum noisefloor", 0, &sonde.config.noisefloor},
|
||||||
/* decoder settings */
|
/* decoder settings */
|
||||||
{"", "Receiver configuration", -5, NULL},
|
{"", "Receiver configuration", -5, NULL},
|
||||||
|
{"gainLNA", "Gain SX1278 default 0 or -32 only negatif", 0, &sonde.config.gainLNA},
|
||||||
{"showafc", "Show AFC value", 0, &sonde.config.showafc},
|
{"showafc", "Show AFC value", 0, &sonde.config.showafc},
|
||||||
{"freqofs", "RX frequency offset (Hz)", 0, &sonde.config.freqofs},
|
{"freqofs", "RX frequency offset (Hz)", 0, &sonde.config.freqofs},
|
||||||
{"rs41.agcbw", "RS41 AGC bandwidth", 0, &sonde.config.rs41.agcbw},
|
{"rs41.agcbw", "RS41 AGC bandwidth", 0, &sonde.config.rs41.agcbw},
|
||||||
@@ -485,7 +497,7 @@ struct st_configitems config_list[] = {
|
|||||||
{"mdnsname", "mDNS name", 14, &sonde.config.mdnsname},
|
{"mdnsname", "mDNS name", 14, &sonde.config.mdnsname},
|
||||||
{"vbatmax", "VBat Max", 5, sonde.config.vbatmax},
|
{"vbatmax", "VBat Max", 5, sonde.config.vbatmax},
|
||||||
{"vbatmin", "VBat Min", 5, sonde.config.vbatmin},
|
{"vbatmin", "VBat Min", 5, sonde.config.vbatmin},
|
||||||
{"sdOn", "SDCard (0=Disabled, 1 Enable)", 0, &sonde.config.sdOn},
|
{"telemetryOn", "Telemetry (0=Disabled, 1 Enable)", 0, &sonde.config.telemetryOn},
|
||||||
{"buzzerOn", "Buzzer (0=Disabled, 1 Enable)", 0, &sonde.config.buzzerOn},
|
{"buzzerOn", "Buzzer (0=Disabled, 1 Enable)", 0, &sonde.config.buzzerOn},
|
||||||
{"buzzerPort", "Buzzer Port (12)", 0, &sonde.config.buzzerPort},
|
{"buzzerPort", "Buzzer Port (12)", 0, &sonde.config.buzzerPort},
|
||||||
{"buzzerFreq", "Buzzer Frequency (700)", 0, &sonde.config.buzzerFreq},
|
{"buzzerFreq", "Buzzer Frequency (700)", 0, &sonde.config.buzzerFreq},
|
||||||
@@ -880,7 +892,9 @@ void SetupAsyncServer() {
|
|||||||
server.on("/index.html", HTTP_GET, [](AsyncWebServerRequest * request) {
|
server.on("/index.html", HTTP_GET, [](AsyncWebServerRequest * request) {
|
||||||
request->send(SPIFFS, "/index.html", String(), false, processor);
|
request->send(SPIFFS, "/index.html", String(), false, processor);
|
||||||
});
|
});
|
||||||
|
server.on("/download", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
|
request->send(SPIFFS, "/data.csv", "text/plain", true);
|
||||||
|
});
|
||||||
server.on("/test.html", HTTP_GET, [](AsyncWebServerRequest * request) {
|
server.on("/test.html", HTTP_GET, [](AsyncWebServerRequest * request) {
|
||||||
request->send(SPIFFS, "/test.html", String(), false, processor);
|
request->send(SPIFFS, "/test.html", String(), false, processor);
|
||||||
});
|
});
|
||||||
@@ -1589,7 +1603,7 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//sx1278.setLNAGain(-48);
|
//sx1278.setLNAGain(-48);
|
||||||
sx1278.setLNAGain(0);
|
sx1278.setLNAGain(sonde.config.gainLNA);
|
||||||
|
|
||||||
int gain = sx1278.getLNAGain();
|
int gain = sx1278.getLNAGain();
|
||||||
Serial.print("RX LNA Gain is ");
|
Serial.print("RX LNA Gain is ");
|
||||||
@@ -1632,7 +1646,26 @@ void setup()
|
|||||||
initGPS();
|
initGPS();
|
||||||
|
|
||||||
WiFi.onEvent(WiFiEvent);
|
WiFi.onEvent(WiFiEvent);
|
||||||
getKeyPress(); // clear key buffer
|
|
||||||
|
// init fichie data.csv
|
||||||
|
File file = SPIFFS.open("/data.csv", "w");
|
||||||
|
|
||||||
|
// Read all the lines of the reply from server and print them to Serial
|
||||||
|
|
||||||
|
if (!file) {
|
||||||
|
Serial.println("There was an error opening the file for writing");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
String telemetry = "RadioSonde N; Ser ; Type ; Freq ; Lat ; Lon; Alt; QTHLat; QTHLon; QTHAlt; VSpeed ; HSpeed ; Dir ; DESIGNATION ; RSSI; SMETRE; STAT; AFC; ValidPos\n";
|
||||||
|
if (file.print(telemetry+"\n")) {
|
||||||
|
Serial.println("File was written");
|
||||||
|
} else {
|
||||||
|
Serial.println("File write failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void enterMode(int mode) {
|
void enterMode(int mode) {
|
||||||
@@ -2213,7 +2246,8 @@ void execOTA() {
|
|||||||
bool isValidContentType = false;
|
bool isValidContentType = false;
|
||||||
sonde.clearDisplay();
|
sonde.clearDisplay();
|
||||||
disp.rdis->setFont(FONT_SMALL);
|
disp.rdis->setFont(FONT_SMALL);
|
||||||
disp.rdis->drawString(0, 0, "RadioSonde Upgrade");
|
disp.rdis->drawString(0, 0, "RadioSonde");
|
||||||
|
disp.rdis->drawString(0, 1, "Upgrade Os");
|
||||||
String dispHost = updateHost.substring(0, 14);
|
String dispHost = updateHost.substring(0, 14);
|
||||||
//disp.rdis->drawString(2, 0, dispHost.c_str());
|
//disp.rdis->drawString(2, 0, dispHost.c_str());
|
||||||
|
|
||||||
@@ -2222,7 +2256,7 @@ void execOTA() {
|
|||||||
if (client.connect(updateHost.c_str(), updatePort)) {
|
if (client.connect(updateHost.c_str(), updatePort)) {
|
||||||
// Connection succeeded, fecthing the bin
|
// Connection succeeded, fecthing the bin
|
||||||
Serial.println("Fetching bin: " + String(*updateBin));
|
Serial.println("Fetching bin: " + String(*updateBin));
|
||||||
disp.rdis->drawString(0, 1, "Fetching update");
|
disp.rdis->drawString(0, 2, "Fetching update");
|
||||||
|
|
||||||
// Get the contents of the bin file
|
// Get the contents of the bin file
|
||||||
client.print(String("GET ") + *updateBin + " HTTP/1.1\r\n" +
|
client.print(String("GET ") + *updateBin + " HTTP/1.1\r\n" +
|
||||||
@@ -2263,6 +2297,8 @@ void execOTA() {
|
|||||||
{{BIN FILE CONTENTS}}
|
{{BIN FILE CONTENTS}}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
while (client.available()) {
|
while (client.available()) {
|
||||||
// read line till /n
|
// read line till /n
|
||||||
String line = client.readStringUntil('\n');
|
String line = client.readStringUntil('\n');
|
||||||
@@ -2341,6 +2377,29 @@ void execOTA() {
|
|||||||
// execOTA();
|
// execOTA();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ICI Update Data
|
||||||
|
/*
|
||||||
|
// Update DATAWeb!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
//Data1 index.html
|
||||||
|
updatedataweb(updateHost,updatePort,updateDataWeb,"index.html");
|
||||||
|
//Data2 sondemap.html
|
||||||
|
updatedataweb(updateHost,updatePort,updateDataWeb2,"sondemap.html");
|
||||||
|
//Data3 config.txt
|
||||||
|
updatedataweb(updateHost,updatePort,updateDataWeb3,"config.txt");
|
||||||
|
//Data4 screens.txt
|
||||||
|
updatedataweb(updateHost,updatePort,updateDataWeb4,"screens.txt");
|
||||||
|
//Data5 styles.css
|
||||||
|
updatedataweb(updateHost,updatePort,updateDataWeb5,"style.css");
|
||||||
|
//Data6 qrg.txt
|
||||||
|
updatedataweb(updateHost,updatePort,updateDataWeb6,"qrg.txt");
|
||||||
|
//Data7 networks.txt
|
||||||
|
updatedataweb(updateHost,updatePort,updateDataWeb7,"networks.txt");
|
||||||
|
//Data8 fontawesome-webfont.eot
|
||||||
|
updatedataweb(updateHost,updatePort,updateDataWeb8,"fontawesome-webfont.eot");
|
||||||
|
//Data9 fontawesome-webfont.eot
|
||||||
|
updatedataweb(updateHost,updatePort,updateDataWeb9,"fontawesome-webfont.woff");
|
||||||
|
*/
|
||||||
|
|
||||||
if (Update.end()) {
|
if (Update.end()) {
|
||||||
Serial.println("OTA done!");
|
Serial.println("OTA done!");
|
||||||
if (Update.isFinished()) {
|
if (Update.isFinished()) {
|
||||||
@@ -2365,15 +2424,76 @@ void execOTA() {
|
|||||||
Serial.println("There was no content in the response");
|
Serial.println("There was no content in the response");
|
||||||
client.flush();
|
client.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Back to some normal state
|
// Back to some normal state
|
||||||
enterMode(ST_DECODER);
|
enterMode(ST_DECODER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updatedataweb(String host, int port, String dataweb, String fichier){
|
||||||
|
|
||||||
|
//Data1 index.html
|
||||||
|
sonde.clearDisplay();
|
||||||
|
disp.rdis->setFont(FONT_SMALL);
|
||||||
|
disp.rdis->drawString(0, 0, "RadioSonde");
|
||||||
|
disp.rdis->drawString(0, 1, "Upgrade Data");
|
||||||
|
String *data = &dataweb;
|
||||||
|
String dispHost = host.substring(0, 14);
|
||||||
|
Serial.println("Connecting to: " + host);
|
||||||
|
// Connect to Update host
|
||||||
|
if (client.connect(host.c_str(), port)) {
|
||||||
|
// Connection succeeded, fecthing the dataweb
|
||||||
|
Serial.println("Fetching data: " + String(*data));
|
||||||
|
disp.rdis->drawString(0, 3, "Fetching data");
|
||||||
|
char buf[16];
|
||||||
|
snprintf(buf, 16, "%s", fichier);
|
||||||
|
disp.rdis->drawString(0, 4, buf);
|
||||||
|
// Get the contents of the bin file
|
||||||
|
client.print(String("GET ") + *data + " HTTP/1.1\r\n" +
|
||||||
|
"Host: " + host + "\r\n" +
|
||||||
|
"Cache-Control: no-cache\r\n" +
|
||||||
|
"Connection: close\r\n\r\n");
|
||||||
|
|
||||||
|
unsigned long timeout = millis();
|
||||||
|
while (client.available() == 0) {
|
||||||
|
if (millis() - timeout > 5000) {
|
||||||
|
Serial.println("Client Timeout !");
|
||||||
|
client.stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = SPIFFS.open("/"+fichier, FILE_WRITE);
|
||||||
|
int cpt=0;
|
||||||
|
// Read all the lines of the reply from server and print them to Serial
|
||||||
|
while(client.available()){
|
||||||
|
String line = client.readStringUntil('\r');
|
||||||
|
line.trim();
|
||||||
|
Serial.print(line);
|
||||||
|
cpt += 1;
|
||||||
|
if (!file) {
|
||||||
|
Serial.println("There was an error opening the file for writing");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cpt>10){
|
||||||
|
if (file.print(line+"\n")) {
|
||||||
|
Serial.println("File was written");
|
||||||
|
} else {
|
||||||
|
Serial.println("File write failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
client.flush();
|
||||||
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
if(sonde.config.buzzerOn==1){
|
if(sonde.config.buzzerOn==1){
|
||||||
ledcSetup(0, sonde.config.buzzerFreq, 8);
|
ledcSetup(0, sonde.config.buzzerFreq, 8);
|
||||||
ledcAttachPin(sonde.config.buzzerPort, 0);
|
ledcAttachPin(sonde.config.buzzerPort, 0);
|
||||||
|
} else {
|
||||||
|
ledcSetup(0, 0, 8);
|
||||||
|
ledcAttachPin(sonde.config.buzzerPort, 0);
|
||||||
}
|
}
|
||||||
Serial.printf("\nRunning main loop in state %d. free heap: %d;\n", mainState, ESP.getFreeHeap());
|
Serial.printf("\nRunning main loop in state %d. free heap: %d;\n", mainState, ESP.getFreeHeap());
|
||||||
Serial.printf("currentDisp:%d lastDisp:%d\n", currentDisplay, lastDisplay);
|
Serial.printf("currentDisp:%d lastDisp:%d\n", currentDisplay, lastDisplay);
|
||||||
@@ -2405,8 +2525,7 @@ void loop() {
|
|||||||
sonde.clearDisplay();
|
sonde.clearDisplay();
|
||||||
sonde.updateDisplay();
|
sonde.updateDisplay();
|
||||||
lastDisplay = currentDisplay;
|
lastDisplay = currentDisplay;
|
||||||
|
|
||||||
}
|
}
|
||||||
Serial.printf("Unused stack: %d\n", uxTaskGetStackHighWaterMark(0));
|
Serial.printf("Unused stack: %d\n", uxTaskGetStackHighWaterMark(0));
|
||||||
|
//transfert_sd();
|
||||||
}
|
}
|
||||||
@@ -52,11 +52,12 @@ display=0,1,2,3,4,5,6
|
|||||||
norx_timeout=20
|
norx_timeout=20
|
||||||
vbatmax=1.86
|
vbatmax=1.86
|
||||||
vbatmin=1.64
|
vbatmin=1.64
|
||||||
sdOn=0
|
telemetryOn=0
|
||||||
buzzerOn=0
|
buzzerOn=0
|
||||||
buzzerPort=12
|
buzzerPort=12
|
||||||
buzzerFreq=700
|
buzzerFreq=700
|
||||||
dbsmetre=1
|
dbsmetre=1
|
||||||
|
gainLNA=0
|
||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
# Spectrum display settings
|
# Spectrum display settings
|
||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
@@ -68,8 +69,8 @@ marker=1
|
|||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
# APRS settings
|
# APRS settings
|
||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
call=NOCALL
|
call=FRS2013
|
||||||
passcode=123456
|
passcode=26035
|
||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
# Sonde specific settings: bandwidth
|
# Sonde specific settings: bandwidth
|
||||||
# valid values: 3100, 3900, 5200, 6300, 7800, 10400, 12500,
|
# valid values: 3100, 3900, 5200, 6300, 7800, 10400, 12500,
|
||||||
@@ -89,7 +90,7 @@ dfm.rxbw=10400
|
|||||||
# local use only, do not feed to public services
|
# local use only, do not feed to public services
|
||||||
# data not sanitized / quality checked, outliers not filtered out
|
# data not sanitized / quality checked, outliers not filtered out
|
||||||
axudp.active=1
|
axudp.active=1
|
||||||
axudp.host=monurl.fr
|
axudp.host=fra1od.fr.to
|
||||||
axudp.port=14580
|
axudp.port=14580
|
||||||
axudp.symbol=/O
|
axudp.symbol=/O
|
||||||
axudp.highrate=1
|
axudp.highrate=1
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
<button class="tablinks fa fa-gears" onclick="selTab(event,'Config'); w3_close()"> Config</button><br>
|
<button class="tablinks fa fa-gears" onclick="selTab(event,'Config'); w3_close()"> Config</button><br>
|
||||||
<button class="tablinks fa fa-sliders" onclick="selTab(event,'Control'); w3_close()"> Control</button><br>
|
<button class="tablinks fa fa-sliders" onclick="selTab(event,'Control'); w3_close()"> Control</button><br>
|
||||||
<button class="tablinks fa fa-download" onclick="selTab(event,'Update'); w3_close()"> Update</button><br>
|
<button class="tablinks fa fa-download" onclick="selTab(event,'Update'); w3_close()"> Update</button><br>
|
||||||
|
<button class="tablinks fa fa-download" onclick="selTab(event,'Telemetry'); w3_close()"> Telemetry</button><br>
|
||||||
<button class="tablinks fa fa-support" onclick="selTab(event,'About'); w3_close()"> About</button><br><br><br><br>
|
<button class="tablinks fa fa-support" onclick="selTab(event,'About'); w3_close()"> About</button><br><br><br><br>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@@ -48,17 +49,7 @@
|
|||||||
<div id="SondeMap" class="tabcontent" data-src="sondemap.html">
|
<div id="SondeMap" class="tabcontent" data-src="sondemap.html">
|
||||||
<iframe src="sondemap.html" style="border:none;" width="98%%" height="98%%"></iframe>
|
<iframe src="sondemap.html" style="border:none;" width="98%%" height="98%%"></iframe>
|
||||||
</div>
|
</div>
|
||||||
<!--
|
|
||||||
<div id="SondeMap" class="tabcontent" data-src="http://wx.dl2mf.de/#?">
|
|
||||||
<iframe src="http://wx.dl2mf.de/" style="border:none;" width="98%%" height="98%%"></iframe>
|
|
||||||
</div>
|
|
||||||
<div id="SondeMap2" class="tabcontent" data-src="https://radiosondy.info/">
|
|
||||||
<iframe src="https://radiosondy.info/" style="border:none;" width="98%%" height="98%%"></iframe>
|
|
||||||
</div>
|
|
||||||
<div id="SondeMap3" class="tabcontent" data-src="https://tracker.sondehub.org/?sondehub=1#!mt=osm&mz=8&qm=6_hours&mc=43.76665,6.24011&f=none&q=RS_*;*chase">
|
|
||||||
<iframe src="https://tracker.sondehub.org/?sondehub=1#!mt=osm&mz=8&qm=6_hours&mc=43.76665,6.24011&f=none&q=RS_*;*chase" style="border:none;" width="98%%" height="98%%"></iframe>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
<div id="Config" class="tabcontent">
|
<div id="Config" class="tabcontent">
|
||||||
<h3>Configuration</h3>
|
<h3>Configuration</h3>
|
||||||
<iframe src="config.html" style="border:none;" width="100%%" height="100%%"></iframe>
|
<iframe src="config.html" style="border:none;" width="100%%" height="100%%"></iframe>
|
||||||
@@ -73,7 +64,10 @@
|
|||||||
<h3>Update</h3>
|
<h3>Update</h3>
|
||||||
<iframe src="update.html" style="border:none;" width="100%%" height="100%%"></iframe>
|
<iframe src="update.html" style="border:none;" width="100%%" height="100%%"></iframe>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="Telemetry" class="tabcontent">
|
||||||
|
<h3>Telemetry</h3>
|
||||||
|
<button onclick="javascript:window.open('/download','_self');">Telemetry</button>
|
||||||
|
</div>
|
||||||
<div id="About" class="tabcontent">
|
<div id="About" class="tabcontent">
|
||||||
<h3>About</h3>
|
<h3>About</h3>
|
||||||
%VERSION_NAME%<br>
|
%VERSION_NAME%<br>
|
||||||
@@ -184,4 +178,3 @@ showDivs(1);
|
|||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
Radiosonde
|
Radiosonde
|
||||||
Radiosonde
|
Radiosonde
|
||||||
VotreSSID
|
Terreandro
|
||||||
votrepass
|
terrexavier
|
||||||
|
TERREWIFI
|
||||||
|
terrexavier
|
||||||
|
|||||||
@@ -213,25 +213,6 @@ timeaction=#,#,#
|
|||||||
7,4=gD
|
7,4=gD
|
||||||
7,11=gI°
|
7,11=gI°
|
||||||
|
|
||||||
############
|
|
||||||
# Boussole Oled
|
|
||||||
@BOUSSOLE
|
|
||||||
timer=-1,-1,-1
|
|
||||||
key1action=+,0,F,W
|
|
||||||
key2action=>,#,#,#
|
|
||||||
timeaction=#,#,#
|
|
||||||
0,0=g0
|
|
||||||
0,10=a
|
|
||||||
1,10=h
|
|
||||||
2,9=v
|
|
||||||
3,10=gC
|
|
||||||
3,13=gB
|
|
||||||
4,9=gD
|
|
||||||
5,11=gI°
|
|
||||||
6,9=xEl:
|
|
||||||
6,11=gE
|
|
||||||
7,9=t
|
|
||||||
|
|
||||||
############
|
############
|
||||||
@BatteryOLED
|
@BatteryOLED
|
||||||
timer=-1,-1,-1
|
timer=-1,-1,-1
|
||||||
@@ -247,3 +228,21 @@ fonts=0,1
|
|||||||
6,0=xPower:
|
6,0=xPower:
|
||||||
6,7=bPmW
|
6,7=bPmW
|
||||||
|
|
||||||
|
############
|
||||||
|
# Boussole Oled
|
||||||
|
@Boussole
|
||||||
|
timer=-1,0,0
|
||||||
|
key1action=D,#,F,W
|
||||||
|
key2action=#,#,#,#
|
||||||
|
timeaction=#,D,+
|
||||||
|
0,0=g0
|
||||||
|
0,10=a
|
||||||
|
1,10=h
|
||||||
|
2,9=v
|
||||||
|
3,10=gC
|
||||||
|
3,13=gB
|
||||||
|
4,9=gD
|
||||||
|
5,11=gI°
|
||||||
|
6,9=xEl:
|
||||||
|
6,11=gE
|
||||||
|
7,9=t
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">
|
<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<button class="tablinks" onclick="javascript:window.open('http://wx.dl2mf.de/','_self')"> Sonde Map</button><br><br>
|
<button class="tablinks" onclick="javascript:window.open('http://wx.dl2mf.de/','_blank')"> Sonde Map</button><br><br>
|
||||||
<button class="tablinks" onclick="javascript:window.open('https://radiosondy.info/','_self')"> RadioSony</button><br><br>
|
<button class="tablinks" onclick="javascript:window.open('http://radiosondy.info/','_self')"> RadioSondy</button><br><br>
|
||||||
<button class="tablinks" onclick="javascript:window.open('https://tracker.sondehub.org/?sondehub=1#!mt=osm&mz=8&qm=6_hours&mc=43.76665,6.24011&f=none&q=RS_*;*chase','_self')"> SondeHub</button><br><br>
|
<button class="tablinks" onclick="javascript:window.open('http://tracker.sondehub.org/','_blank')"> SondeHub</button><br><br>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const char *version_name = "RadioSonde";
|
const char *version_name = "RadioSonde";
|
||||||
const char *version_id = "0.8.5";
|
const char *version_id = "0.8.7";
|
||||||
const int SPIFFS_MAJOR=2;
|
//const int SPIFFS_MAJOR=3;
|
||||||
const int SPIFFS_MINOR=4;
|
//const int SPIFFS_MINOR=5;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "Sonde.h"
|
#include "Sonde.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
|
|
||||||
int readLine(Stream &stream, char *buffer, int maxlen);
|
int readLine(Stream &stream, char *buffer, int maxlen);
|
||||||
|
|
||||||
extern const char *version_name;
|
extern const char *version_name;
|
||||||
@@ -980,7 +981,45 @@ void Display::drawSite(DispEntry *de) {
|
|||||||
if(de->extra[0]) strcat(buf, de->extra+1);
|
if(de->extra[0]) strcat(buf, de->extra+1);
|
||||||
drawString(de, buf);
|
drawString(de, buf);
|
||||||
}
|
}
|
||||||
void Display::drawTelemetry(DispEntry *de) {
|
void Telemetry() {
|
||||||
|
if (sonde.config.telemetryOn==1) {
|
||||||
|
File file = SPIFFS.open("/data.csv", "a");
|
||||||
|
|
||||||
|
if (!file) {
|
||||||
|
Serial.println("There was an error opening the file for writing");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
int dbmetre=sonde.si()->rssi/2;
|
||||||
|
String smetre ="";
|
||||||
|
if (dbmetre>138) smetre="S0";
|
||||||
|
if ((dbmetre<137)&&(dbmetre>122)) smetre="S1";
|
||||||
|
if ((dbmetre<121)&&(dbmetre>116)) smetre="S2";
|
||||||
|
if ((dbmetre<115)&&(dbmetre>108)) smetre="S3";
|
||||||
|
if ((dbmetre<109)&&(dbmetre>104)) smetre="S4";
|
||||||
|
if ((dbmetre<103)&&(dbmetre>98)) smetre="S5";
|
||||||
|
if ((dbmetre<97)&&(dbmetre>92)) smetre="S6";
|
||||||
|
if ((dbmetre<91)&&(dbmetre>86)) smetre="S7";
|
||||||
|
if ((dbmetre<85)&&(dbmetre>80)) smetre="S8";
|
||||||
|
if ((dbmetre<79)&&(dbmetre>74)) smetre="S9";
|
||||||
|
if ((dbmetre<73)&&(dbmetre>64)) smetre="S9+10";
|
||||||
|
if ((dbmetre<63)&&(dbmetre>54)) smetre="S9+20";
|
||||||
|
if ((dbmetre<53)&&(dbmetre>44)) smetre="S9+30";
|
||||||
|
if ((dbmetre<43)&&(dbmetre>34)) smetre="S9+40";
|
||||||
|
if ((dbmetre<33)&&(dbmetre>24)) smetre="S9+50";
|
||||||
|
if ((dbmetre<23)&&(dbmetre>14)) smetre="S9+60";
|
||||||
|
if ((dbmetre<13)&&(dbmetre>0)) smetre="S9+70";
|
||||||
|
|
||||||
|
String telemetry = telemetry + sonde.si()->id + ";" + sonde.si()->ser + ";" + sondeTypeStr[sonde.si()->type] + ";" + sonde.si()->freq + "Mhz;" + sonde.si()->lat + "; "+ sonde.si()->lon + ";" + sonde.si()->alt + "m;" + sonde.config.gps_lat + ";" + sonde.config.gps_lon +";" + sonde.config.gps_alt + ";" + sonde.si()->vs + "m/s;" + sonde.si()->hs + "m/s;" + ";" + sonde.si()->dir + "°;" + sonde.si()->launchsite + ";" + sonde.si()->rssi/2 + ";" + smetre + ";" + *sonde.si()->rxStat + ";" + sonde.si()->afc*0.001 + ";" + sonde.si()->validPos + "\n";
|
||||||
|
if (file.print(telemetry+"\n")) {
|
||||||
|
Serial.println("File was written");
|
||||||
|
} else {
|
||||||
|
Serial.println("File write failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::drawKilltimer(DispEntry *de) {
|
void Display::drawKilltimer(DispEntry *de) {
|
||||||
@@ -1090,23 +1129,24 @@ static int tmpc=0;
|
|||||||
Serial.printf("\nGPS data: valid%d GPS at %f,%f (alt=%d,cog=%d); sonde at dist=%d, dir=%d rel.bear=%d\n",gpsValid?1:0,
|
Serial.printf("\nGPS data: valid%d GPS at %f,%f (alt=%d,cog=%d); sonde at dist=%d, dir=%d rel.bear=%d\n",gpsValid?1:0,
|
||||||
gpsLat, gpsLon, gpsAlt, gpsCourse, gpsDist, gpsDir, gpsBear);
|
gpsLat, gpsLon, gpsAlt, gpsCourse, gpsDist, gpsDir, gpsBear);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
void Display::calcVbat() {
|
||||||
//VBat %
|
//VBat %
|
||||||
float vbat,r,Dmax, Dact;
|
float vbat,r,Dmax, Dact;
|
||||||
float ADC_PIN = 35;
|
float ADC_PIN = 35;
|
||||||
float vbatmax=atof(sonde.config.vbatmax), vbatmin=atof(sonde.config.vbatmin);
|
float vbatmax=atof(sonde.config.vbatmax), vbatmin=atof(sonde.config.vbatmin);
|
||||||
r = analogRead(ADC_PIN);
|
r = analogRead(ADC_PIN);
|
||||||
vbat = r * (3.30 / 4094.00); //convert the value to a true voltage.
|
vbat = r * (3.30 / 4094.00); //convert the value to a true voltage.
|
||||||
Serial.printf("\nVbatMAX= %1.2fV",vbatmax);
|
//Serial.printf("\nVbatMAX= %1.2fV",vbatmax);
|
||||||
Serial.printf("\nVbatMIN= %1.2fV",vbatmin);
|
//Serial.printf("\nVbatMIN= %1.2fV",vbatmin);
|
||||||
Dmax = vbatmax - vbatmin;
|
Dmax = vbatmax - vbatmin;
|
||||||
Dact = vbat - vbatmin;
|
Dact = vbat - vbatmin;
|
||||||
vbat = (Dact / Dmax)*100;
|
vbat = (Dact / Dmax)*100;
|
||||||
Serial.printf("\nVbat:%3.0f\%\n",vbat);
|
Serial.printf("\nVbat:%3.0f\%\n",vbat);
|
||||||
sonde.si()->vbat=vbat;
|
sonde.si()->vbat=vbat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::drawGPS(DispEntry *de) {
|
void Display::drawGPS(DispEntry *de) {
|
||||||
//if(sonde.config.gps_rxd<0) return;
|
|
||||||
rdis->setFont(de->fmt);
|
rdis->setFont(de->fmt);
|
||||||
switch(de->extra[0]) {
|
switch(de->extra[0]) {
|
||||||
case 'W':
|
case 'W':
|
||||||
@@ -1144,7 +1184,7 @@ void Display::drawGPS(DispEntry *de) {
|
|||||||
if( (sonde.si()->validPos&0x03)!=0x03 ) {
|
if( (sonde.si()->validPos&0x03)!=0x03 ) {
|
||||||
snprintf(buf, 16, "no pos ");
|
snprintf(buf, 16, "no pos ");
|
||||||
if(de->extra && *de->extra=='5') buf[5]=0;
|
if(de->extra && *de->extra=='5') buf[5]=0;
|
||||||
} else if((!disp.gpsValid)||(disp.gpsLat!=0)&&(disp.gpsLon!=0)) {
|
} else if((!disp.gpsValid)&&(disp.gpsLat!=0)) {
|
||||||
snprintf(buf, 16, "no gps ");
|
snprintf(buf, 16, "no gps ");
|
||||||
if(de->extra && *de->extra=='5') buf[5]=0;
|
if(de->extra && *de->extra=='5') buf[5]=0;
|
||||||
} else {
|
} else {
|
||||||
@@ -1527,6 +1567,7 @@ void Display::updateDisplayPos() {
|
|||||||
if(di->func != disp.drawLat && di->func != disp.drawLon) continue;
|
if(di->func != disp.drawLat && di->func != disp.drawLon) continue;
|
||||||
di->func(di);
|
di->func(di);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void Display::updateDisplayPos2() {
|
void Display::updateDisplayPos2() {
|
||||||
for(DispEntry *di=layout->de; di->func != NULL; di++) {
|
for(DispEntry *di=layout->de; di->func != NULL; di++) {
|
||||||
@@ -1582,9 +1623,12 @@ void Display::updateDisplayIP() {
|
|||||||
|
|
||||||
void Display::updateDisplay() {
|
void Display::updateDisplay() {
|
||||||
calcGPS();
|
calcGPS();
|
||||||
|
calcVbat();
|
||||||
|
Telemetry();
|
||||||
for(DispEntry *di=layout->de; di->func != NULL; di++) {
|
for(DispEntry *di=layout->de; di->func != NULL; di++) {
|
||||||
di->func(di);
|
di->func(di);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Display disp = Display();
|
Display disp = Display();
|
||||||
@@ -85,6 +85,7 @@ private:
|
|||||||
static void circ(int x, int y);
|
static void circ(int x, int y);
|
||||||
static int countEntries(File f);
|
static int countEntries(File f);
|
||||||
void calcGPS();
|
void calcGPS();
|
||||||
|
void calcVbat();
|
||||||
boolean gpsValid;
|
boolean gpsValid;
|
||||||
float gpsLat, gpsLon;
|
float gpsLat, gpsLon;
|
||||||
int gpsAlt;
|
int gpsAlt;
|
||||||
|
|||||||
@@ -10,14 +10,6 @@
|
|||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
|
|
||||||
#define SDCARD
|
|
||||||
|
|
||||||
#ifdef SDCARD
|
|
||||||
#include "sd.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int snOn=0;
|
|
||||||
|
|
||||||
extern SX1278FSK sx1278;
|
extern SX1278FSK sx1278;
|
||||||
|
|
||||||
RXTask rxtask = { -1, -1, -1, 0xFFFF, 0 };
|
RXTask rxtask = { -1, -1, -1, 0xFFFF, 0 };
|
||||||
@@ -158,12 +150,13 @@ void Sonde::defaultConfig() {
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
config.noisefloor = -125;
|
config.noisefloor = -125;
|
||||||
|
config.gainLNA=0;
|
||||||
strcpy(config.call,"NOCALL");
|
strcpy(config.call,"NOCALL");
|
||||||
strcpy(config.passcode, "---");
|
strcpy(config.passcode, "---");
|
||||||
strcpy(config.mdnsname, "radiosonde");
|
strcpy(config.mdnsname, "radiosonde");
|
||||||
strcpy(config.vbatmax,"1.84");
|
strcpy(config.vbatmax,"1.84");
|
||||||
strcpy(config.vbatmin,"1.64");
|
strcpy(config.vbatmin,"1.64");
|
||||||
config.sdOn=0;
|
config.telemetryOn=0;
|
||||||
config.buzzerOn=0;
|
config.buzzerOn=0;
|
||||||
config.buzzerFreq=700;
|
config.buzzerFreq=700;
|
||||||
config.buzzerPort=12;
|
config.buzzerPort=12;
|
||||||
@@ -215,6 +208,8 @@ void Sonde::setConfig(const char *cfg) {
|
|||||||
if(strcmp(cfg,"noisefloor")==0) {
|
if(strcmp(cfg,"noisefloor")==0) {
|
||||||
config.noisefloor = atoi(val);
|
config.noisefloor = atoi(val);
|
||||||
if(config.noisefloor==0) config.noisefloor=-130;
|
if(config.noisefloor==0) config.noisefloor=-130;
|
||||||
|
} else if(strcmp(cfg,"gainLNA")==0) {
|
||||||
|
config.gainLNA = atoi(val);
|
||||||
} else if(strcmp(cfg,"call")==0) {
|
} else if(strcmp(cfg,"call")==0) {
|
||||||
strncpy(config.call, val, 9);
|
strncpy(config.call, val, 9);
|
||||||
config.call[9]=0;
|
config.call[9]=0;
|
||||||
@@ -269,8 +264,8 @@ void Sonde::setConfig(const char *cfg) {
|
|||||||
strncpy(config.vbatmax,val,5);
|
strncpy(config.vbatmax,val,5);
|
||||||
} else if(strcmp(cfg,"vbatmin")==0) {
|
} else if(strcmp(cfg,"vbatmin")==0) {
|
||||||
strncpy(config.vbatmin,val,5);
|
strncpy(config.vbatmin,val,5);
|
||||||
} else if(strcmp(cfg,"sdOn")==0) {
|
} else if(strcmp(cfg,"telemetryOn")==0) {
|
||||||
config.sdOn=atoi(val);
|
config.telemetryOn=atoi(val);
|
||||||
} else if(strcmp(cfg,"buzzerOn")==0) {
|
} else if(strcmp(cfg,"buzzerOn")==0) {
|
||||||
config.buzzerOn=atoi(val);
|
config.buzzerOn=atoi(val);
|
||||||
} else if(strcmp(cfg,"buzzerPort")==0) {
|
} else if(strcmp(cfg,"buzzerPort")==0) {
|
||||||
@@ -466,7 +461,9 @@ void Sonde::receive() {
|
|||||||
// state information for RX_TIMER / NORX_TIMER events
|
// state information for RX_TIMER / NORX_TIMER events
|
||||||
if(res==0) { // RX OK
|
if(res==0) { // RX OK
|
||||||
flashLed(700);
|
flashLed(700);
|
||||||
if(sonde.config.buzzerOn==1) buzzerLed(500);
|
if(sonde.config.buzzerOn==1) {
|
||||||
|
buzzerLed(500);
|
||||||
|
}
|
||||||
if(si->lastState != 1) {
|
if(si->lastState != 1) {
|
||||||
si->rxStart = millis();
|
si->rxStart = millis();
|
||||||
si->lastState = 1;
|
si->lastState = 1;
|
||||||
@@ -511,11 +508,7 @@ void Sonde::receive() {
|
|||||||
Serial.printf("receive Result is %04x\n", res);
|
Serial.printf("receive Result is %04x\n", res);
|
||||||
// let waitRXcomplete resume...
|
// let waitRXcomplete resume...
|
||||||
rxtask.receiveResult = res;
|
rxtask.receiveResult = res;
|
||||||
#ifdef SDCARD
|
|
||||||
if (sonde.config.sdOn==1){
|
|
||||||
sdwrite();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// return (action<<8) | (rxresult)
|
// return (action<<8) | (rxresult)
|
||||||
|
|||||||
@@ -178,10 +178,11 @@ typedef struct st_rdzconfig {
|
|||||||
int maxsonde; // number of max sonde in scan (range=1-99)
|
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 norx_timeout; // Time after which rx mode switches to scan mode (without rx signal)
|
||||||
int noisefloor; // for spectrum display
|
int noisefloor; // for spectrum display
|
||||||
char mdnsname[15]; // mDNS-Name, defaults to rdzsonde
|
int gainLNA;
|
||||||
|
char mdnsname[15]; // mDNS-Name, defaults to radiosonde
|
||||||
char vbatmax[5]; // Vbat maxi when bat charged
|
char vbatmax[5]; // Vbat maxi when bat charged
|
||||||
char vbatmin[5]; // Vbat minimum discharged
|
char vbatmin[5]; // Vbat minimum discharged
|
||||||
int sdOn; // Active SDCard
|
int telemetryOn; // Active Save information telemetry
|
||||||
int buzzerPort; // Buzzer port
|
int buzzerPort; // Buzzer port
|
||||||
int buzzerFreq; // Buzzer Frequency
|
int buzzerFreq; // Buzzer Frequency
|
||||||
int buzzerOn; // Buzzer On
|
int buzzerOn; // Buzzer On
|
||||||
@@ -262,4 +263,3 @@ public:
|
|||||||
extern Sonde sonde;
|
extern Sonde sonde;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Executable
+124
@@ -0,0 +1,124 @@
|
|||||||
|
#include "FS.h"
|
||||||
|
#include <SPIFFS.h>
|
||||||
|
#include <WiFi.h>
|
||||||
|
//Write data web
|
||||||
|
|
||||||
|
//Fonction
|
||||||
|
void writedataweb(){
|
||||||
|
|
||||||
|
|
||||||
|
String updateHost = "xavier.debert.free.fr";
|
||||||
|
String updateDataWeb = "/RS/dataweb/index.html.txt";
|
||||||
|
String *updateData = &updateDataWeb;
|
||||||
|
String dispHost = updateHost.substring(0, 14);
|
||||||
|
//disp.rdis->drawString(2, 0, dispHost.c_str());
|
||||||
|
|
||||||
|
Serial.println("Connecting to: " + updateHost);
|
||||||
|
// Connect to Update host
|
||||||
|
if (client.connect(updateHost.c_str(), updatePort)) {
|
||||||
|
// Connection succeeded, fecthing the bin
|
||||||
|
Serial.println("Fetching index.html: " + String(*updateData));
|
||||||
|
|
||||||
|
|
||||||
|
// Get the contents of the bin file
|
||||||
|
client.print(String("GET ") + *updateData + " HTTP/1.1\r\n" +
|
||||||
|
"Host: " + updateHost + "\r\n" +
|
||||||
|
"Cache-Control: no-cache\r\n" +
|
||||||
|
"Connection: close\r\n\r\n");
|
||||||
|
|
||||||
|
// Check what is being sent
|
||||||
|
// Serial.print(String("GET ") + bin + " HTTP/1.1\r\n" +
|
||||||
|
// "Host: " + host + "\r\n" +
|
||||||
|
// "Cache-Control: no-cache\r\n" +
|
||||||
|
// "Connection: close\r\n\r\n");
|
||||||
|
|
||||||
|
unsigned long timeout = millis();
|
||||||
|
while (client.available() == 0) {
|
||||||
|
if (millis() - timeout > 5000) {
|
||||||
|
Serial.println("Client Timeout !");
|
||||||
|
client.stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Once the response is available,
|
||||||
|
// check stuff
|
||||||
|
|
||||||
|
/*
|
||||||
|
Response Structure
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
x-amz-id-2: NVKxnU1aIQMmpGKhSwpCBh8y2JPbak18QLIfE+OiUDOos+7UftZKjtCFqrwsGOZRN5Zee0jpTd0=
|
||||||
|
x-amz-request-id: 2D56B47560B764EC
|
||||||
|
Date: Wed, 14 Jun 2017 03:33:59 GMT
|
||||||
|
Last-Modified: Fri, 02 Jun 2017 14:50:11 GMT
|
||||||
|
ETag: "d2afebbaaebc38cd669ce36727152af9"
|
||||||
|
Accept-Ranges: bytes
|
||||||
|
Content-Type: application/octet-stream
|
||||||
|
Content-Length: 357280
|
||||||
|
Server: AmazonS3
|
||||||
|
|
||||||
|
{{BIN FILE CONTENTS}}
|
||||||
|
|
||||||
|
*/
|
||||||
|
while (client.available()) {
|
||||||
|
// read line till /n
|
||||||
|
String line = client.readStringUntil('\n');
|
||||||
|
// remove space, to check if the line is end of headers
|
||||||
|
line.trim();
|
||||||
|
|
||||||
|
// if the the line is empty,
|
||||||
|
// this is end of headers
|
||||||
|
// break the while and feed the
|
||||||
|
// remaining `client` to the
|
||||||
|
// Update.writeStream();
|
||||||
|
if (!line.length()) {
|
||||||
|
//headers ended
|
||||||
|
break; // and get the OTA started
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the HTTP Response is 200
|
||||||
|
// else break and Exit Update
|
||||||
|
if (line.startsWith("HTTP/1.1")) {
|
||||||
|
if (line.indexOf("200") < 0) {
|
||||||
|
Serial.println("Got a non 200 status code from server. error.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// extract headers here
|
||||||
|
// Start with content length
|
||||||
|
if (line.startsWith("Content-Length: ")) {
|
||||||
|
contentLength = atoi((getHeaderValue(line, "Content-Length: ")).c_str());
|
||||||
|
Serial.println("Got " + String(contentLength) + " bytes from server");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Next, the content type
|
||||||
|
if (line.startsWith("Content-Type: ")) {
|
||||||
|
String contentType = getHeaderValue(line, "Content-Type: ");
|
||||||
|
Serial.println("Got " + contentType + " payload.");
|
||||||
|
if (contentType == "application/text") {
|
||||||
|
isValidContentType = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Connect to updateHost failed
|
||||||
|
// May be try?
|
||||||
|
// Probably a choppy network?
|
||||||
|
Serial.println("Connection to " + String(updateHost) + " failed. Please check your setup");
|
||||||
|
// retry??
|
||||||
|
// execOTA();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Serial.printf("\nDataWeb On\n");
|
||||||
|
//open file for appending new blank line to EOF.
|
||||||
|
File f = SPIFFS.open("/data.html", "w");
|
||||||
|
|
||||||
|
f.println("<html><body>TEST de DATAWeb1</body></html>");
|
||||||
|
|
||||||
|
f.close();
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,179 +0,0 @@
|
|||||||
#include "FS.h"
|
|
||||||
#include "SD_MMC.h"
|
|
||||||
//Write data RadioSonde on SD
|
|
||||||
|
|
||||||
//Fonction de gestion SD
|
|
||||||
void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
|
|
||||||
Serial.printf("Listing directory: %s\n", dirname);
|
|
||||||
|
|
||||||
File root = fs.open(dirname);
|
|
||||||
if(!root){
|
|
||||||
Serial.println("Failed to open directory");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!root.isDirectory()){
|
|
||||||
Serial.println("Not a directory");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
File file = root.openNextFile();
|
|
||||||
while(file){
|
|
||||||
if(file.isDirectory()){
|
|
||||||
Serial.print(" DIR : ");
|
|
||||||
Serial.println(file.name());
|
|
||||||
if(levels){
|
|
||||||
listDir(fs, file.name(), levels -1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Serial.print(" FILE: ");
|
|
||||||
Serial.print(file.name());
|
|
||||||
Serial.print(" SIZE: ");
|
|
||||||
Serial.println(file.size());
|
|
||||||
}
|
|
||||||
file = root.openNextFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void createDir(fs::FS &fs, const char * path){
|
|
||||||
Serial.printf("Creating Dir: %s\n", path);
|
|
||||||
if(fs.mkdir(path)){
|
|
||||||
Serial.println("Dir created");
|
|
||||||
} else {
|
|
||||||
Serial.println("mkdir failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void readFile(fs::FS &fs, const char * path){
|
|
||||||
Serial.printf("Reading file: %s\n", path);
|
|
||||||
|
|
||||||
File file = fs.open(path);
|
|
||||||
if(!file){
|
|
||||||
Serial.println("Failed to open file for reading");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Serial.print("Read from file: ");
|
|
||||||
while(file.available()){
|
|
||||||
Serial.write(file.read());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void appendFile(fs::FS &fs, const char * path, const char * message){
|
|
||||||
Serial.printf("Appending to file: %s\n", path);
|
|
||||||
|
|
||||||
File file = fs.open(path, FILE_APPEND);
|
|
||||||
if(!file){
|
|
||||||
Serial.println("Failed to open file for appending");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(file.print(message)){
|
|
||||||
Serial.println("Message appended");
|
|
||||||
} else {
|
|
||||||
Serial.println("Append failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeFile(fs::FS &fs, const char * path, const char * message){
|
|
||||||
Serial.printf("Writing file: %s\n", path);
|
|
||||||
|
|
||||||
File file = fs.open(path, FILE_WRITE);
|
|
||||||
if(!file){
|
|
||||||
Serial.println("Failed to open file for writing");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(file.print(message)){
|
|
||||||
Serial.println("File written");
|
|
||||||
} else {
|
|
||||||
Serial.println("Write failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void sdwrite()
|
|
||||||
{
|
|
||||||
Serial.print("Detect SD\n");
|
|
||||||
if(SD_MMC.begin()){
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t cardType = SD_MMC.cardType();
|
|
||||||
|
|
||||||
if(cardType != CARD_NONE){
|
|
||||||
|
|
||||||
|
|
||||||
Serial.print("SD_MMC Card Type: ");
|
|
||||||
if(cardType == CARD_MMC){
|
|
||||||
Serial.println("MMC");
|
|
||||||
} else if(cardType == CARD_SD){
|
|
||||||
Serial.println("SDSC");
|
|
||||||
} else if(cardType == CARD_SDHC){
|
|
||||||
Serial.println("SDHC");
|
|
||||||
} else {
|
|
||||||
Serial.println("UNKNOWN");
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t cardSize = SD_MMC.cardSize() / (1024 * 1024);
|
|
||||||
Serial.printf("SD_MMC Card Size: %lluMB\n", cardSize);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Serial.printf("Total space: %lluMB\n", SD_MMC.totalBytes() / (1024 * 1024));
|
|
||||||
Serial.printf("Used space: %lluMB\n", SD_MMC.usedBytes() / (1024 * 1024));
|
|
||||||
*/
|
|
||||||
if (sonde.si()->validPos) {
|
|
||||||
char buff[20];
|
|
||||||
char chemin[40];
|
|
||||||
//String repertoire="/radiosonde/", name=sonde.si()->ser;
|
|
||||||
//repertoire.toCharArray(chemin, 40);
|
|
||||||
//if (!SD_MMC.exists(chemin)) {
|
|
||||||
createDir(SD_MMC, "/radiosonde/");
|
|
||||||
Serial.printf("\nWrite Rep\n");
|
|
||||||
//listDir(SD_MMC, chemin, 0);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if (name.length()>8) {
|
|
||||||
//name.concat(".csv");
|
|
||||||
//repertoire.concat(name);
|
|
||||||
//repertoire.toCharArray(chemin, 40);
|
|
||||||
writeFile(SD_MMC, "/radiosonde/sonde.csv", "");
|
|
||||||
Serial.printf("\nWrite file\n");
|
|
||||||
//if (!SD_MMC.exists(chemin)) {
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", "RadioSonde N; Ser ; Type ; Freq ; Alt ; VSpeed ; HSpeed ; Dir ; LaunchSite ; RSSI\n");
|
|
||||||
Serial.printf("\nWrite titre\n");
|
|
||||||
//}
|
|
||||||
Serial.printf("\nWrite Data\n");
|
|
||||||
snprintf(buff, 16, "%10c", sonde.si()->id);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", buff);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", ";");
|
|
||||||
snprintf(buff, 16, "%12c", sonde.si()->ser);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", buff);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", ";");
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", sondeTypeStr[sonde.si()->type]);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", ";");
|
|
||||||
snprintf(buff, 16, "%3.3fMhz", sonde.si()->freq);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", buff);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", ";");
|
|
||||||
snprintf(buff, 16, sonde.si()->alt>=1000?" %5.0fm":" %3.1fm", sonde.si()->alt);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", buff);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", ";");
|
|
||||||
snprintf(buff, 16, "%2.2fm/s", sonde.si()->vs);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", buff);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", ";");
|
|
||||||
snprintf(buff, 16, "%2.2fm/s", sonde.si()->hs);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", buff);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", ";");
|
|
||||||
snprintf(buff, 16, "%3.0f°", sonde.si()->dir);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", buff);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", ";");
|
|
||||||
snprintf(buff, 16, "%18c", sonde.si()->launchsite);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", buff);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", ";");
|
|
||||||
snprintf(buff, 16, "%d", sonde.si()->rssi);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", buff);
|
|
||||||
appendFile(SD_MMC, "/radiosonde/sonde.csv", "\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#include <FS.h>
|
||||||
|
#include <SPIFFS.h>
|
||||||
|
#include <SD_MMC.h> // (or SD_MMC.h)
|
||||||
|
|
||||||
|
|
||||||
|
void transfert_sd() {
|
||||||
|
|
||||||
|
if (!SD_MMC.begin()) {
|
||||||
|
Serial.println("Carte SD introuvable");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Serial.println("Carte SD détectée");
|
||||||
|
sonde.clearDisplay();
|
||||||
|
disp.rdis->drawString(0, 2, "Carte SD On");
|
||||||
|
disp.rdis->drawString(0, 4, "Transfert Data");
|
||||||
|
File sourceFile = SPIFFS.open("/data.csv", "r");
|
||||||
|
File destFile = SD_MMC.open("/data.csv","w");
|
||||||
|
|
||||||
|
static uint8_t buf[512];
|
||||||
|
while( sourceFile.read( buf, 512) ) {
|
||||||
|
destFile.write( buf, 512 );
|
||||||
|
}
|
||||||
|
destFile.close();
|
||||||
|
sourceFile.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
delay(1000);
|
||||||
|
//sonde.updateDisplay();
|
||||||
|
sonde.clearDisplay();
|
||||||
|
disp.rdis->drawString(0, 2, "Sortir SD");
|
||||||
|
disp.rdis->drawString(0, 4, "Reboot 5s");
|
||||||
|
delay(5000);
|
||||||
|
ESP.restart();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user