Added support for GSP, DS003a, DS003c and added printIPAddress functionality
This commit is contained in:
parent
94c553f824
commit
25f5136013
|
@ -61,7 +61,7 @@ enum UpdateStatus {
|
|||
*/
|
||||
|
||||
unsigned long HW_GROUP = 1; // Changes with hardware changes that require software changes
|
||||
unsigned long FW_VERSION = 1802120001; // Changes with each release; must always increase
|
||||
unsigned long FW_VERSION = 1802130009; // Changes with each release; must always increase
|
||||
unsigned long SP_VERSION = 0; // Loaded from SPIFFS; changed with each SPIFFS build; must always increase (uses timestamp as version)
|
||||
|
||||
// HTTPS update settings
|
||||
|
@ -357,7 +357,7 @@ void ISR_config() {
|
|||
}
|
||||
|
||||
/*
|
||||
MAIN PROGRAM ROUTINES
|
||||
PROGRAM ROUTINES
|
||||
*/
|
||||
|
||||
void doWiFiConfigViaWPS() {
|
||||
|
@ -384,6 +384,24 @@ void doWiFiConfigViaAP() {
|
|||
setLED(1);
|
||||
}
|
||||
|
||||
void printIPAddress() {
|
||||
// TODO: Stops working after the first time
|
||||
IPAddress addr = WiFi.localIP();
|
||||
String addrStr;
|
||||
addrStr += String(addr[0]);
|
||||
addrStr += ".";
|
||||
addrStr += String(addr[1]);
|
||||
addrStr += ".";
|
||||
addrStr += String(addr[2]);
|
||||
addrStr += ".";
|
||||
addrStr += String(addr[3]);
|
||||
IBIS_DS009(addrStr);
|
||||
}
|
||||
|
||||
/*
|
||||
FIRMWARE & SPIFFS UPDATE
|
||||
*/
|
||||
|
||||
UpdateStatus checkForFWUpdate() {
|
||||
/*WiFiClientSecure httpsClient;
|
||||
if (!httpsClient.connect(UPDATE_HOST.c_str(), UPDATE_PORT)) {
|
||||
|
@ -451,6 +469,10 @@ void doSPUpdate() {
|
|||
t_httpUpdate_return ret = ESPhttpUpdate.updateSpiffs(url);
|
||||
}
|
||||
|
||||
/*
|
||||
MAIN PROGRAM
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
pinMode(PIN_STATUS, OUTPUT);
|
||||
pinMode(PIN_CONFIG, INPUT_PULLUP);
|
||||
|
@ -567,6 +589,11 @@ void loop() {
|
|||
doWiFiConfigViaAP();
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
// AP mode
|
||||
printIPAddress();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
|
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
|
@ -1 +1 @@
|
|||
1802120001
|
||||
1802130009
|
65
ibis.h
65
ibis.h
|
@ -12,6 +12,18 @@ void IBIS_processSpecialCharacters(String* telegram) {
|
|||
telegram->replace("Ü", "]");
|
||||
}
|
||||
|
||||
String IBIS_vdvHex(byte value) {
|
||||
String vdvHexCharacters = "0123456789:;<=>?";
|
||||
String vdvHexValue;
|
||||
byte highNibble = value >> 4;
|
||||
byte lowNibble = value & 15;
|
||||
if (highNibble > 0) {
|
||||
vdvHexValue += vdvHexCharacters.charAt(highNibble);
|
||||
}
|
||||
vdvHexValue += vdvHexCharacters.charAt(lowNibble);
|
||||
return vdvHexValue;
|
||||
}
|
||||
|
||||
String IBIS_wrapTelegram(String telegram) {
|
||||
telegram += '\x0d';
|
||||
unsigned char checksum = 0x7F;
|
||||
|
@ -30,8 +42,61 @@ void IBIS_sendTelegram(String telegram) {
|
|||
Serial.print(telegram);
|
||||
}
|
||||
|
||||
void IBIS_DS003a(String text) {
|
||||
String telegram;
|
||||
byte numBlocks = ceil(text.length() / 16.0);
|
||||
telegram = "zA";
|
||||
telegram += IBIS_vdvHex(numBlocks);
|
||||
telegram += text;
|
||||
byte remainder = text.length() % 16;
|
||||
if (remainder > 0) {
|
||||
for (byte i = 16; i > remainder; i--) {
|
||||
telegram += " ";
|
||||
}
|
||||
}
|
||||
IBIS_sendTelegram(telegram);
|
||||
}
|
||||
|
||||
void IBIS_DS003c(String text) {
|
||||
String telegram;
|
||||
byte numBlocks = ceil(text.length() / 4.0);
|
||||
telegram = "zI";
|
||||
telegram += IBIS_vdvHex(numBlocks);
|
||||
telegram += text;
|
||||
byte remainder = text.length() % 4;
|
||||
if (remainder > 0) {
|
||||
for (byte i = 4; i > remainder; i--) {
|
||||
telegram += " ";
|
||||
}
|
||||
}
|
||||
IBIS_sendTelegram(telegram);
|
||||
}
|
||||
|
||||
void IBIS_DS009(String text) {
|
||||
String telegram = "v" + text;
|
||||
IBIS_sendTelegram(telegram);
|
||||
}
|
||||
|
||||
void IBIS_GSP(byte address, String line1, String line2) {
|
||||
String telegram;
|
||||
String lines;
|
||||
lines += line1;
|
||||
if (line2.length() > 0) {
|
||||
lines += "\x0a";
|
||||
}
|
||||
lines += line2;
|
||||
lines += "\x0a\x0a";
|
||||
byte numBlocks = ceil(lines.length() / 16.0);
|
||||
byte remainder = lines.length() % 16;
|
||||
if (remainder > 0) {
|
||||
for (byte i = 16; i > remainder; i--) {
|
||||
lines += " ";
|
||||
}
|
||||
}
|
||||
telegram = "aA";
|
||||
telegram += IBIS_vdvHex(address);
|
||||
telegram += IBIS_vdvHex(numBlocks);
|
||||
telegram += lines;
|
||||
IBIS_sendTelegram(telegram);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue