Skip to content

Commit 480da7c

Browse files
authored
Merge pull request #28 from jomjol/rolling
Rolling
2 parents 954388e + d428abc commit 480da7c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1874
-1089
lines changed

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,35 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
1919

2020
### Known Issues
2121

22-
* Parts of the web page only works correctly in **Firefox** and Chrome!
23-
With **Edge** not all parts (especially the configuration) are **not full functional**.
24-
* spontaneous reboot, especially in case of intensive web server access (improved since v2.0.0)
22+
* spontaneous reboot, especially in case of intensive web server access (improved since v2.1.0)
2523

2624
------
2725

2826
**General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
2927

3028

3129

32-
##### Rolling - (2020-09-12)
30+
##### Rolling - (2020-09-25)
3331

34-
* based on v2.0.0 (2020-09-12)
32+
* based on v2.1.0 (2020-09-25)
33+
34+
35+
36+
##### 2.1.0 Layout update (2020-09-25)
37+
38+
* Implementation of Decimal Shift
39+
40+
* Update default CNN for digits to v6.4.0
41+
42+
* Improvement HTML
43+
44+
* Support for Chrome and Firefox
45+
46+
* Reduce logging to minimum - extended logging on demand
47+
48+
* Implementation of hostname in wlan.ini (`hostname = "HOSTNAME")`
49+
50+
* Bug fixing, code corrections
3551

3652

3753

code/lib/connect_wlan/connect_wlan.cpp

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ static const char *MAIN_TAG = "connect_wlan";
2121

2222
std::string ssid;
2323
std::string passphrase;
24+
std::string hostname;
25+
26+
std::string std_hostname = "watermeter";
2427

2528
static EventGroupHandle_t wifi_event_group;
2629

@@ -100,33 +103,36 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
100103
return ESP_OK;
101104
}
102105

103-
void initialise_wifi(std::string _ssid, std::string _passphrase)
106+
void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _hostname)
104107
{
105108
ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL) );
106109
wifi_event_group = xEventGroupCreate();
107110
ssid = _ssid;
108111
passphrase = _passphrase;
112+
hostname = _hostname;
109113
esp_log_level_set("wifi", ESP_LOG_NONE); // disable wifi driver logging
110114
tcpip_adapter_init();
111115
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
112116
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
113117
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
114118
ESP_ERROR_CHECK( esp_wifi_start() );
115-
esp_err_t ret = tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA ,"icircuit");
119+
esp_err_t ret = tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA , hostname.c_str());
116120
if(ret != ESP_OK ){
117121
ESP_LOGE(MAIN_TAG,"failed to set hostname:%d",ret);
118122
}
119123
xEventGroupWaitBits(wifi_event_group,CONNECTED_BIT,true,true,portMAX_DELAY);
120124
tcpip_adapter_ip_info_t ip_info;
121125
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info));
122-
printf("IP : %s\n", ip4addr_ntoa(&ip_info.ip));
126+
printf("IPv4 : %s\n", ip4addr_ntoa(&ip_info.ip));
127+
printf("HostName : %s\n", hostname.c_str());
123128
}
124129

125130

126-
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase)
131+
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase, std::string &_hostname)
127132
{
128133
string line = "";
129134
std::vector<string> zerlegt;
135+
_hostname = std_hostname;
130136

131137
FILE* pFile;
132138
fn = FormatFileName(fn);
@@ -145,13 +151,26 @@ void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphra
145151
// printf("%s", line.c_str());
146152
zerlegt = ZerlegeZeile(line, "=");
147153
zerlegt[0] = trim(zerlegt[0], " ");
148-
zerlegt[1] = trim(zerlegt[1], " ");
154+
zerlegt[1] = trim(zerlegt[1], " ");
155+
156+
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "HOSTNAME")){
157+
_hostname = zerlegt[1];
158+
if ((_hostname[0] == '"') && (_hostname[_hostname.length()-1] == '"')){
159+
_hostname = _hostname.substr(1, _hostname.length()-2);
160+
}
161+
// Check if Hostname was empty in .ini if yes set to std_hostname
162+
if(_hostname.length() <= 0){
163+
_hostname = std_hostname;
164+
}
165+
}
166+
149167
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "SSID")){
150168
_ssid = zerlegt[1];
151169
if ((_ssid[0] == '"') && (_ssid[_ssid.length()-1] == '"')){
152170
_ssid = _ssid.substr(1, _ssid.length()-2);
153171
}
154172
}
173+
155174
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "PASSWORD")){
156175
_passphrase = zerlegt[1];
157176
if ((_passphrase[0] == '"') && (_passphrase[_passphrase.length()-1] == '"')){

code/lib/connect_wlan/connect_wlan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
const int CONNECTED_BIT = BIT0;
88

9-
void initialise_wifi(std::string _ssid, std::string _passphrase);
9+
void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _hostname);
1010

11-
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase);
11+
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase, std::string &_hostname);
1212

1313
#endif

code/lib/jomjol_flowcontroll/ClassFlowAnalog.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include "CTfLiteClass.h"
1111
#endif
1212

13+
#include "ClassLogFile.h"
14+
1315
ClassFlowAnalog::ClassFlowAnalog()
1416
{
1517
isLogImage = false;
@@ -140,7 +142,10 @@ string ClassFlowAnalog::getHTMLSingleStep(string host)
140142

141143
bool ClassFlowAnalog::doFlow(string time)
142144
{
143-
doAlignAndCut(time);
145+
if (!doAlignAndCut(time)){
146+
return false;
147+
};
148+
144149
doNeuralNetwork(time);
145150

146151
return true;
@@ -160,6 +165,12 @@ bool ClassFlowAnalog::doAlignAndCut(string time)
160165
CImageBasis *img_roi = NULL;
161166
CAlignAndCutImage *caic = new CAlignAndCutImage(input);
162167

168+
if (!caic->ImageOkay()){
169+
LogFile.WriteToFile("ClassFlowAnalog::doAlignAndCut not okay!");
170+
delete caic;
171+
return false;
172+
}
173+
163174
if (input_roi.length() > 0)
164175
img_roi = new CImageBasis(input_roi);
165176

0 commit comments

Comments
 (0)