Skip to content

Commit

Permalink
Merge pull request #28 from jomjol/rolling
Browse files Browse the repository at this point in the history
Rolling
  • Loading branch information
jomjol authored Sep 25, 2020
2 parents 954388e + d428abc commit 480da7c
Show file tree
Hide file tree
Showing 44 changed files with 1,874 additions and 1,089 deletions.
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,35 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571

### Known Issues

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

------

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



##### Rolling - (2020-09-12)
##### Rolling - (2020-09-25)

* based on v2.0.0 (2020-09-12)
* based on v2.1.0 (2020-09-25)



##### 2.1.0 Layout update (2020-09-25)

* Implementation of Decimal Shift

* Update default CNN for digits to v6.4.0

* Improvement HTML

* Support for Chrome and Firefox

* Reduce logging to minimum - extended logging on demand

* Implementation of hostname in wlan.ini (`hostname = "HOSTNAME")`

* Bug fixing, code corrections



Expand Down
29 changes: 24 additions & 5 deletions code/lib/connect_wlan/connect_wlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ static const char *MAIN_TAG = "connect_wlan";

std::string ssid;
std::string passphrase;
std::string hostname;

std::string std_hostname = "watermeter";

static EventGroupHandle_t wifi_event_group;

Expand Down Expand Up @@ -100,33 +103,36 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
return ESP_OK;
}

void initialise_wifi(std::string _ssid, std::string _passphrase)
void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _hostname)
{
ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL) );
wifi_event_group = xEventGroupCreate();
ssid = _ssid;
passphrase = _passphrase;
hostname = _hostname;
esp_log_level_set("wifi", ESP_LOG_NONE); // disable wifi driver logging
tcpip_adapter_init();
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK( esp_wifi_start() );
esp_err_t ret = tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA ,"icircuit");
esp_err_t ret = tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA , hostname.c_str());
if(ret != ESP_OK ){
ESP_LOGE(MAIN_TAG,"failed to set hostname:%d",ret);
}
xEventGroupWaitBits(wifi_event_group,CONNECTED_BIT,true,true,portMAX_DELAY);
tcpip_adapter_ip_info_t ip_info;
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info));
printf("IP : %s\n", ip4addr_ntoa(&ip_info.ip));
printf("IPv4 : %s\n", ip4addr_ntoa(&ip_info.ip));
printf("HostName : %s\n", hostname.c_str());
}


void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase)
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase, std::string &_hostname)
{
string line = "";
std::vector<string> zerlegt;
_hostname = std_hostname;

FILE* pFile;
fn = FormatFileName(fn);
Expand All @@ -145,13 +151,26 @@ void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphra
// printf("%s", line.c_str());
zerlegt = ZerlegeZeile(line, "=");
zerlegt[0] = trim(zerlegt[0], " ");
zerlegt[1] = trim(zerlegt[1], " ");
zerlegt[1] = trim(zerlegt[1], " ");

if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "HOSTNAME")){
_hostname = zerlegt[1];
if ((_hostname[0] == '"') && (_hostname[_hostname.length()-1] == '"')){
_hostname = _hostname.substr(1, _hostname.length()-2);
}
// Check if Hostname was empty in .ini if yes set to std_hostname
if(_hostname.length() <= 0){
_hostname = std_hostname;
}
}

if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "SSID")){
_ssid = zerlegt[1];
if ((_ssid[0] == '"') && (_ssid[_ssid.length()-1] == '"')){
_ssid = _ssid.substr(1, _ssid.length()-2);
}
}

if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "PASSWORD")){
_passphrase = zerlegt[1];
if ((_passphrase[0] == '"') && (_passphrase[_passphrase.length()-1] == '"')){
Expand Down
4 changes: 2 additions & 2 deletions code/lib/connect_wlan/connect_wlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

const int CONNECTED_BIT = BIT0;

void initialise_wifi(std::string _ssid, std::string _passphrase);
void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _hostname);

void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase);
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase, std::string &_hostname);

#endif
13 changes: 12 additions & 1 deletion code/lib/jomjol_flowcontroll/ClassFlowAnalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "CTfLiteClass.h"
#endif

#include "ClassLogFile.h"

ClassFlowAnalog::ClassFlowAnalog()
{
isLogImage = false;
Expand Down Expand Up @@ -140,7 +142,10 @@ string ClassFlowAnalog::getHTMLSingleStep(string host)

bool ClassFlowAnalog::doFlow(string time)
{
doAlignAndCut(time);
if (!doAlignAndCut(time)){
return false;
};

doNeuralNetwork(time);

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

if (!caic->ImageOkay()){
LogFile.WriteToFile("ClassFlowAnalog::doAlignAndCut not okay!");
delete caic;
return false;
}

if (input_roi.length() > 0)
img_roi = new CImageBasis(input_roi);

Expand Down
Loading

0 comments on commit 480da7c

Please sign in to comment.