Merge branch 'lora-aprs-master' into develop-dd6sw

pull/134/head
Stefan Wahl 2021-12-18 23:39:20 +01:00
commit 3f71de3aa5
8 zmienionych plików z 81 dodań i 44 usunięć

Wyświetl plik

@ -69,16 +69,6 @@ The best success is to use PlatformIO (and it is the only platform where I can s
This firmware is developed in a rolling release system: everyday a new release could be created. But there are still rules where new pull requests has to go and and how the version system looks like.
### Branches
There are 2 main branches:
* *master* and
* *develop*
The *master* branch has all releases and is the most stable one. With the different tags you can jump to different versions or if you take the most current *master* branch you will just get the latest, stable version. There will be no side releases which are branched of from *master*. If there is a bugfix version it will be done directly on the *master* branch and a tag will be generated with a new version.
The *develop* branch is used for new feature development. It will be also used to stabilize the current development to create a new stable version (pull request to *master* branch). **Again:** all new development (pull requests) has to go directly into the *develop* branch!
### Version system
If the *develop* branch is stable enough for a new release it will be merged with a pull request to the *master* branch and a new version will be generated.
@ -125,3 +115,4 @@ A direct mount of the [other display](pics/display-wrong.jpg) is not possible wi
The 'wrong' display works too but you have to change VCC and GND by wire !
feel free to add hints!

Wyświetl plik

@ -2,11 +2,17 @@
"callsign": "NOCODE-11",
"network": {
"DHCP": true,
"staticIP": "192.0.2.100",
"subnet": "255.255.255.0",
"gateway": "192.0.2.1",
"dns1": "192.0.2.1",
"dns2": "192.0.2.2"
"static": {
"ip": "192.168.0.100",
"subnet": "255.255.255.0",
"gateway": "192.168.0.1",
"dns1": "192.168.0.1",
"dns2": "192.168.0.2"
},
"hostname": {
"overwrite": false,
"name": "NOCALL-10"
}
},
"wifi": {
"active": true,

Wyświetl plik

@ -21,7 +21,7 @@
#include "TaskWifi.h"
#include "project_configuration.h"
#define VERSION "21.44.0-dev"
#define VERSION "21.50.0"
String create_lat_aprs(double lat);
String create_long_aprs(double lng);

Wyświetl plik

@ -36,13 +36,14 @@ void WiFiEvent(WiFiEvent_t event) {
break;
case SYSTEM_EVENT_ETH_START:
logPrintlnI("ETH Started");
ETH.setHostname("esp32-ethernet");
break;
case SYSTEM_EVENT_ETH_CONNECTED:
logPrintlnI("ETH Connected");
break;
case SYSTEM_EVENT_ETH_GOT_IP:
logPrintI("ETH MAC: ");
logPrintI("Hostname: ");
logPrintI(ETH.getHostname());
logPrintI(", ETH MAC: ");
logPrintI(ETH.macAddress());
logPrintI(", IPv4: ");
logPrintI(ETH.localIP().toString());
@ -100,11 +101,16 @@ bool EthTask::setup(System &system) {
delay(200);
digitalWrite(ETH_NRST, 1);
if (!system.getUserConfig()->network.DHCP) {
ETH.config(system.getUserConfig()->network.staticIP, system.getUserConfig()->network.gateway, system.getUserConfig()->network.subnet, system.getUserConfig()->network.dns1, system.getUserConfig()->network.dns2);
}
ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLK);
if (!system.getUserConfig()->network.DHCP) {
ETH.config(system.getUserConfig()->network.static_.ip, system.getUserConfig()->network.static_.gateway, system.getUserConfig()->network.static_.subnet, system.getUserConfig()->network.static_.dns1, system.getUserConfig()->network.static_.dns2);
}
if (system.getUserConfig()->network.hostname.overwrite) {
ETH.setHostname(system.getUserConfig()->network.hostname.name.c_str());
} else {
ETH.setHostname(system.getUserConfig()->callsign.c_str());
}
return true;
}

Wyświetl plik

@ -43,7 +43,11 @@ bool OTATask::setup(System &system) {
else if (error == OTA_END_ERROR)
logPrintlnE("End Failed");
});
_ota.setHostname(system.getUserConfig()->callsign.c_str());
if (system.getUserConfig()->network.hostname.overwrite) {
_ota.setHostname(system.getUserConfig()->network.hostname.name.c_str());
} else {
_ota.setHostname(system.getUserConfig()->callsign.c_str());
}
_stateInfo = "";
return true;
}

Wyświetl plik

@ -20,10 +20,14 @@ bool WifiTask::setup(System &system) {
WiFi.mode(WIFI_STA);
WiFi.onEvent(WiFiEvent);
WiFi.setHostname(system.getUserConfig()->callsign.c_str());
if (system.getUserConfig()->network.hostname.overwrite) {
WiFi.setHostname(system.getUserConfig()->network.hostname.name.c_str());
} else {
WiFi.setHostname(system.getUserConfig()->callsign.c_str());
}
if (!system.getUserConfig()->network.DHCP) {
WiFi.config(system.getUserConfig()->network.staticIP, system.getUserConfig()->network.gateway, system.getUserConfig()->network.subnet, system.getUserConfig()->network.dns1, system.getUserConfig()->network.dns2);
WiFi.config(system.getUserConfig()->network.static_.ip, system.getUserConfig()->network.static_.gateway, system.getUserConfig()->network.static_.subnet, system.getUserConfig()->network.static_.dns1, system.getUserConfig()->network.static_.dns2);
}
for (Configuration::Wifi::AP ap : system.getUserConfig()->wifi.APs) {

Wyświetl plik

@ -8,13 +8,25 @@ void ProjectConfigurationManagement::readProjectConfiguration(DynamicJsonDocumen
if (data.containsKey("callsign"))
conf.callsign = data["callsign"].as<String>();
if (data.containsKey("network") && data["network"].containsKey("DHCP")) {
conf.network.DHCP = data["network"]["DHCP"];
conf.network.staticIP.fromString(data["network"]["staticIP"].as<String>());
conf.network.subnet.fromString(data["network"]["subnet"].as<String>());
conf.network.gateway.fromString(data["network"]["gateway"].as<String>());
conf.network.dns1.fromString(data["network"]["dns1"].as<String>());
conf.network.dns2.fromString(data["network"]["dns2"].as<String>());
if (data.containsKey("network")) {
conf.network.DHCP = data["network"]["DHCP"] | false;
if (data["network"].containsKey("static")) {
if (data["network"]["static"].containsKey("ip"))
conf.network.static_.ip.fromString(data["network"]["static"]["ip"].as<String>());
if (data["network"]["static"].containsKey("subnet"))
conf.network.static_.subnet.fromString(data["network"]["static"]["subnet"].as<String>());
if (data["network"]["static"].containsKey("gateway"))
conf.network.static_.gateway.fromString(data["network"]["static"]["gateway"].as<String>());
if (data["network"]["static"].containsKey("dns1"))
conf.network.static_.dns1.fromString(data["network"]["static"]["dns1"].as<String>());
if (data["network"]["static"].containsKey("dns2"))
conf.network.static_.dns2.fromString(data["network"]["static"]["dns2"].as<String>());
}
if (data["network"].containsKey("hostname")) {
conf.network.hostname.overwrite = data["network"]["hostname"]["overwrite"] | false;
if (data["network"]["hostname"].containsKey("name"))
conf.network.hostname.name = data["network"]["hostname"]["name"].as<String>();
}
}
conf.wifi.active = data["wifi"]["active"];
@ -86,12 +98,14 @@ void ProjectConfigurationManagement::writeProjectConfiguration(Configuration &co
data["callsign"] = conf.callsign;
if (!conf.network.DHCP) {
data["network"]["DHCP"] = conf.network.DHCP;
data["network"]["staticIP"] = conf.network.staticIP.toString();
data["network"]["subnet"] = conf.network.subnet.toString();
data["network"]["gateway"] = conf.network.gateway.toString();
data["network"]["dns1"] = conf.network.dns1.toString();
data["network"]["dns2"] = conf.network.dns2.toString();
data["network"]["DHCP"] = conf.network.DHCP;
data["network"]["static"]["ip"] = conf.network.static_.ip.toString();
data["network"]["static"]["subnet"] = conf.network.static_.subnet.toString();
data["network"]["static"]["gateway"] = conf.network.static_.gateway.toString();
data["network"]["static"]["dns1"] = conf.network.static_.dns1.toString();
data["network"]["static"]["dns2"] = conf.network.static_.dns2.toString();
data["network"]["hostname"]["overwrite"] = conf.network.hostname.overwrite;
data["network"]["hostname"]["name"] = conf.network.hostname.name;
}
data["wifi"]["active"] = conf.wifi.active;

Wyświetl plik

@ -6,17 +6,29 @@
class Configuration {
public:
class Static {
public:
IPAddress ip;
IPAddress subnet;
IPAddress gateway;
IPAddress dns1;
IPAddress dns2;
};
class Hostname {
public:
bool overwrite;
String name;
};
class Network {
public:
Network() : DHCP(true) {
}
bool DHCP;
IPAddress staticIP;
IPAddress subnet;
IPAddress gateway;
IPAddress dns1;
IPAddress dns2;
bool DHCP;
Static static_;
Hostname hostname;
};
class Wifi {