Skip to content

Commit

Permalink
Investigate latest issues
Browse files Browse the repository at this point in the history
  • Loading branch information
omersiar committed Apr 4, 2018
1 parent dad52e2 commit 82706fd
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 125 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Change Log
All notable changes to this project will be documented in this file.

## [Unreleased]
## [0.7.3] - 2018-04-04
#### Added
- [firmware] More debug messages

#### Fixed
- [webui] minor fixes suggested by Codacy
- [webui] get javascript values as real integers

## [0.7.2] - 2018-04-02
#### Fixed
Expand Down
Binary file modified bin/firmware.bin
Binary file not shown.
18 changes: 1 addition & 17 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ board_f_cpu = 160000000L
platform = ${common.platform}
framework = arduino
board = esp12e
board_flash_mode = qio
upload_resetmethod = nodemcu
lib_deps = ${common.lib_deps}
build_flags = -Wl,-Teagle.flash.4m2m.ld
Expand All @@ -33,22 +32,7 @@ board_f_cpu = 160000000L
platform = ${common.platform}
framework = arduino
board = esp12e
board_flash_mode = qio
lib_deps = ${common.lib_deps}
extra_scripts = scripts/pio_script.py
build_flags = -Wl,-Teagle.flash.4m2m.ld
src_build_flags = !echo "-DBUILD_TAG="$TRAVIS_TAG

[env:dout]
board_f_cpu = 160000000L
platform = ${common.platform}
framework = arduino
board = esp12e
board_flash_mode = dout
upload_resetmethod = ck
lib_deps = ${common.lib_deps}
build_flags = -Wl,-Teagle.flash.4m2m.ld
extra_scripts = scripts/pio_script.py
upload_speed = 921600
; Serial Monitor options
monitor_baud = 115200
src_build_flags = !echo "-DBUILD_TAG="$TRAVIS_TAG
95 changes: 54 additions & 41 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,6 @@ String ICACHE_FLASH_ATTR printIP(IPAddress adress) {
return (String)adress[0] + "." + (String)adress[1] + "." + (String)adress[2] + "." + (String)adress[3];
}

/*
time_t ICACHE_FLASH_ATTR checkTimeSync() {
if (nextSyncTime <= sysTime) {
timerequest = true;
return millis();
}
else {
return now();
}
}*/

void ICACHE_FLASH_ATTR writeEvent(String type, String src, String desc, String data) {
DynamicJsonBuffer jsonBuffer44333;
JsonObject& root = jsonBuffer44333.createObject();
Expand Down Expand Up @@ -862,30 +851,30 @@ void ICACHE_FLASH_ATTR onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient *
void onMqttDisconnect(AsyncMqttClientDisconnectReason reason) {
String reasonstr = "";
switch (reason) {
case (AsyncMqttClientDisconnectReason::TCP_DISCONNECTED):
reasonstr = "TCP_DISCONNECTED";
break;
case (AsyncMqttClientDisconnectReason::MQTT_UNACCEPTABLE_PROTOCOL_VERSION):
reasonstr = "MQTT_UNACCEPTABLE_PROTOCOL_VERSION";
break;
case (AsyncMqttClientDisconnectReason::MQTT_IDENTIFIER_REJECTED):
reasonstr = "MQTT_IDENTIFIER_REJECTED";
break;
case (AsyncMqttClientDisconnectReason::MQTT_SERVER_UNAVAILABLE):
reasonstr = "MQTT_SERVER_UNAVAILABLE";
break;
case (AsyncMqttClientDisconnectReason::MQTT_MALFORMED_CREDENTIALS):
reasonstr = "MQTT_MALFORMED_CREDENTIALS";
break;
case (AsyncMqttClientDisconnectReason::MQTT_NOT_AUTHORIZED):
reasonstr = "MQTT_NOT_AUTHORIZED";
break;
case (AsyncMqttClientDisconnectReason::ESP8266_NOT_ENOUGH_SPACE):
reasonstr = "ESP8266_NOT_ENOUGH_SPACE";
break;
default:
reasonstr = "Unknown";
break;
case (AsyncMqttClientDisconnectReason::TCP_DISCONNECTED):
reasonstr = "TCP_DISCONNECTED";
break;
case (AsyncMqttClientDisconnectReason::MQTT_UNACCEPTABLE_PROTOCOL_VERSION):
reasonstr = "MQTT_UNACCEPTABLE_PROTOCOL_VERSION";
break;
case (AsyncMqttClientDisconnectReason::MQTT_IDENTIFIER_REJECTED):
reasonstr = "MQTT_IDENTIFIER_REJECTED";
break;
case (AsyncMqttClientDisconnectReason::MQTT_SERVER_UNAVAILABLE):
reasonstr = "MQTT_SERVER_UNAVAILABLE";
break;
case (AsyncMqttClientDisconnectReason::MQTT_MALFORMED_CREDENTIALS):
reasonstr = "MQTT_MALFORMED_CREDENTIALS";
break;
case (AsyncMqttClientDisconnectReason::MQTT_NOT_AUTHORIZED):
reasonstr = "MQTT_NOT_AUTHORIZED";
break;
case (AsyncMqttClientDisconnectReason::ESP8266_NOT_ENOUGH_SPACE):
reasonstr = "ESP8266_NOT_ENOUGH_SPACE";
break;
default:
reasonstr = "Unknown";
break;
}
writeEvent("WARN", "mqtt", "Disconnected from MQTT server", reasonstr);
if (WiFi.isConnected()) {
Expand Down Expand Up @@ -958,8 +947,8 @@ bool ICACHE_FLASH_ATTR loadConfiguration() {
setupPN532Reader(rfidss);
}

autoRestartIntervalSeconds = general["restart"].as<int>();
wifiTimeout = network["offtime"].as<int>();
autoRestartIntervalSeconds = general["restart"];
wifiTimeout = network["offtime"];

const char * bssidmac = network["bssid"];
byte bssid[6];
Expand Down Expand Up @@ -997,7 +986,7 @@ bool ICACHE_FLASH_ATTR loadConfiguration() {
ws.setAuthentication("admin", http_pass);

if (wmode == 1) {
int hid = network["hide"].as<int>();
int hid = network["hide"];
Serial.println(F("[ INFO ] ESP-RFID is running in AP Mode "));
return startAP(ssid, password, hid);
}
Expand Down Expand Up @@ -1028,8 +1017,9 @@ bool ICACHE_FLASH_ATTR loadConfiguration() {
}




#ifdef DEBUG
Serial.println("Trying to setup NTP Server");
#endif

IPAddress timeserverip;
WiFi.hostByName(ntpserver, timeserverip);
Expand All @@ -1042,8 +1032,13 @@ bool ICACHE_FLASH_ATTR loadConfiguration() {
const char * muser = mqtt["user"];
const char * mpas = mqtt["pswd"];

mqttenabled = mqtt["enabled"].as<int>();
mqttenabled = mqtt["enabled"];


if (mqttenabled == 1) {
#ifdef DEBUG
Serial.println("Trying to setup MQTT");
#endif
mqttTopic = strdup(mqtt["topic"]);
mqttClient.setServer(mhs, mport);
mqttClient.setCredentials(muser, mpas);
Expand Down Expand Up @@ -1251,6 +1246,24 @@ void ICACHE_FLASH_ATTR setup() {

Serial.println();
Serial.println(F("[ INFO ] ESP RFID v0.7"));
#ifdef DEBUG
uint32_t realSize = ESP.getFlashChipRealSize();
uint32_t ideSize = ESP.getFlashChipSize();
FlashMode_t ideMode = ESP.getFlashChipMode();

Serial.printf("Flash real id: %08X\n", ESP.getFlashChipId());
Serial.printf("Flash real size: %u\n\n", realSize);

Serial.printf("Flash ide size: %u\n", ideSize);
Serial.printf("Flash ide speed: %u\n", ESP.getFlashChipSpeed());
Serial.printf("Flash ide mode: %s\n", (ideMode == FM_QIO ? "QIO" : ideMode == FM_QOUT ? "QOUT" : ideMode == FM_DIO ? "DIO" : ideMode == FM_DOUT ? "DOUT" : "UNKNOWN"));

if(ideSize != realSize) {
Serial.println("Flash Chip configuration wrong!\n");
} else {
Serial.println("Flash Chip configuration ok.\n");
}
#endif
// Start SPIFFS filesystem
if (!SPIFFS.begin()) {
#ifdef DEBUG
Expand Down
Loading

0 comments on commit 82706fd

Please sign in to comment.