mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 12:36:52 +03:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cefc44fb6 | ||
|
|
e5ff8f2164 | ||
|
|
a000252c8a | ||
|
|
9a42c580cf | ||
|
|
6e0a7a742e | ||
|
|
026bac121f | ||
|
|
8a26b817f7 | ||
|
|
528a4435a9 | ||
|
|
9b791bb7a7 | ||
|
|
58eb0b1292 | ||
|
|
39eda4a4be | ||
|
|
87a6445ff6 | ||
|
|
b7e6d33d48 | ||
|
|
52e9cd20ee | ||
|
|
b34bd5d988 |
17
README.md
17
README.md
@@ -45,9 +45,24 @@ In other cases you can contact the developer via email: <img src="https://raw.gi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### 7.0.0 MQTT-Update - (2021-05-08)
|
|
||||||
|
##### 7.1.0 MQTT-Update - (2021-05-28)
|
||||||
|
|
||||||
|
* MQTT error message: changes "no error", send retain flag
|
||||||
|
|
||||||
|
* Update wlan handling to esp-idf 4.1
|
||||||
|
|
||||||
|
* Upgrade digital CNN to v8.7.0 (added new images)
|
||||||
|
|
||||||
|
* Bug fix: MQTT, WLAN, LED-Controll, GPIO usage, fixed IP, calculation flow rate
|
||||||
|
|
||||||
|
|
||||||
|
##### 7.0.1 MQTT-Update - (2021-05-13)
|
||||||
|
|
||||||
|
* NEW: 7.0.1: bug fix wlan password with "="
|
||||||
|
|
||||||
* Upgrade digital CNN to v8.5.0 (added new images)
|
* Upgrade digital CNN to v8.5.0 (added new images)
|
||||||
|
|
||||||
* New MQTT topics: flow rate (units/minute), time stamp (last correct read readout)
|
* New MQTT topics: flow rate (units/minute), time stamp (last correct read readout)
|
||||||
|
|
||||||
* Update MQTT/Error topic to " " in case no error (instead of empty string)
|
* Update MQTT/Error topic to " " in case no error (instead of empty string)
|
||||||
|
|||||||
BIN
code/components/connect_wlan.zip
Normal file
BIN
code/components/connect_wlan.zip
Normal file
Binary file not shown.
@@ -1,492 +0,0 @@
|
|||||||
#include "connect_wlan.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include "esp_wifi.h"
|
|
||||||
#include "esp_event_loop.h"
|
|
||||||
#include "freertos/event_groups.h"
|
|
||||||
#include "esp_log.h"
|
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <sstream>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
|
|
||||||
#include "Helper.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static const char *MAIN_TAG = "connect_wlan";
|
|
||||||
|
|
||||||
std::string ssid = "";
|
|
||||||
std::string passphrase = "";
|
|
||||||
std::string hostname = "";
|
|
||||||
std::string ipaddress = "";
|
|
||||||
std::string gw = "";
|
|
||||||
std::string netmask = "";
|
|
||||||
std::string dns = "";
|
|
||||||
std::string std_hostname = "watermeter";
|
|
||||||
|
|
||||||
static EventGroupHandle_t wifi_event_group;
|
|
||||||
|
|
||||||
|
|
||||||
#define BLINK_GPIO GPIO_NUM_33
|
|
||||||
|
|
||||||
|
|
||||||
std::vector<string> ZerlegeZeile(std::string input, std::string _delimiter = "")
|
|
||||||
{
|
|
||||||
std::vector<string> Output;
|
|
||||||
std::string delimiter = " =,";
|
|
||||||
if (_delimiter.length() > 0){
|
|
||||||
delimiter = _delimiter;
|
|
||||||
}
|
|
||||||
|
|
||||||
input = trim(input, delimiter);
|
|
||||||
size_t pos = findDelimiterPos(input, delimiter);
|
|
||||||
std::string token;
|
|
||||||
while (pos != std::string::npos) {
|
|
||||||
token = input.substr(0, pos);
|
|
||||||
token = trim(token, delimiter);
|
|
||||||
Output.push_back(token);
|
|
||||||
input.erase(0, pos + 1);
|
|
||||||
input = trim(input, delimiter);
|
|
||||||
pos = findDelimiterPos(input, delimiter);
|
|
||||||
}
|
|
||||||
Output.push_back(input);
|
|
||||||
|
|
||||||
return Output;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wifi_connect(){
|
|
||||||
wifi_config_t cfg = { };
|
|
||||||
strcpy((char*)cfg.sta.ssid, (const char*)ssid.c_str());
|
|
||||||
strcpy((char*)cfg.sta.password, (const char*)passphrase.c_str());
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK( esp_wifi_disconnect() );
|
|
||||||
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &cfg) );
|
|
||||||
ESP_ERROR_CHECK( esp_wifi_connect() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void blinkstatus(int dauer, int _anzahl)
|
|
||||||
{
|
|
||||||
gpio_reset_pin(BLINK_GPIO);
|
|
||||||
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
|
|
||||||
for (int i = 0; i < _anzahl; ++i)
|
|
||||||
{
|
|
||||||
gpio_set_level(BLINK_GPIO, 0);
|
|
||||||
vTaskDelay(dauer / portTICK_PERIOD_MS);
|
|
||||||
gpio_set_level(BLINK_GPIO, 1);
|
|
||||||
vTaskDelay(dauer / portTICK_PERIOD_MS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static esp_err_t event_handler(void *ctx, system_event_t *event)
|
|
||||||
{
|
|
||||||
switch(event->event_id) {
|
|
||||||
case SYSTEM_EVENT_STA_START:
|
|
||||||
blinkstatus(200, 1);
|
|
||||||
wifi_connect();
|
|
||||||
break;
|
|
||||||
case SYSTEM_EVENT_STA_GOT_IP:
|
|
||||||
xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
|
|
||||||
blinkstatus(1000, 3);
|
|
||||||
break;
|
|
||||||
case SYSTEM_EVENT_STA_DISCONNECTED:
|
|
||||||
blinkstatus(200, 5);
|
|
||||||
esp_wifi_connect();
|
|
||||||
xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return ESP_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initialise_wifi()
|
|
||||||
{
|
|
||||||
ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL) );
|
|
||||||
wifi_event_group = xEventGroupCreate();
|
|
||||||
|
|
||||||
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 , 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));
|
|
||||||
ipaddress = std::string(ip4addr_ntoa(&ip_info.ip));
|
|
||||||
netmask = std::string(ip4addr_ntoa(&ip_info.netmask));
|
|
||||||
gw = std::string(ip4addr_ntoa(&ip_info.gw));
|
|
||||||
printf("IPv4 : %s\n", ip4addr_ntoa(&ip_info.ip));
|
|
||||||
printf("HostName : %s\n", hostname.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void strinttoip4(std::string ip, int &a, int &b, int &c, int &d) {
|
|
||||||
std::stringstream s(ip);
|
|
||||||
char ch; //to temporarily store the '.'
|
|
||||||
s >> a >> ch >> b >> ch >> c >> ch >> d;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initialise_wifi_fixed_ip()
|
|
||||||
{
|
|
||||||
|
|
||||||
wifi_event_group = xEventGroupCreate();
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_netif_init());
|
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
|
||||||
|
|
||||||
esp_netif_t *my_sta = esp_netif_create_default_wifi_sta();
|
|
||||||
|
|
||||||
esp_netif_dhcpc_stop(my_sta);
|
|
||||||
|
|
||||||
esp_netif_ip_info_t ip_info;
|
|
||||||
|
|
||||||
int a, b, c, d;
|
|
||||||
|
|
||||||
strinttoip4(ipaddress, a, b, c, d);
|
|
||||||
IP4_ADDR(&ip_info.ip, a, b, c, d);
|
|
||||||
|
|
||||||
strinttoip4(gw, a, b, c, d);
|
|
||||||
IP4_ADDR(&ip_info.gw, a, b, c, d);
|
|
||||||
|
|
||||||
strinttoip4(netmask, a, b, c, d);
|
|
||||||
IP4_ADDR(&ip_info.netmask, a, b, c, d);
|
|
||||||
|
|
||||||
esp_netif_set_ip_info(my_sta, &ip_info);
|
|
||||||
|
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
|
||||||
|
|
||||||
if (dns.length() > 0) {
|
|
||||||
esp_netif_dns_info_t dns_info;
|
|
||||||
ip4_addr_t ip;
|
|
||||||
ip.addr = esp_ip4addr_aton(dns.c_str());
|
|
||||||
ip_addr_set_ip4_u32(&dns_info.ip, ip.addr);
|
|
||||||
ESP_ERROR_CHECK(esp_netif_set_dns_info(my_sta, ESP_NETIF_DNS_MAIN, &dns_info));
|
|
||||||
}
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL) );
|
|
||||||
|
|
||||||
wifi_config_t wifi_config = { };
|
|
||||||
strcpy((char*)wifi_config.sta.ssid, (const char*)ssid.c_str());
|
|
||||||
strcpy((char*)wifi_config.sta.password, (const char*)passphrase.c_str());
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_start() );
|
|
||||||
|
|
||||||
ESP_LOGI(MAIN_TAG, "wifi_init_sta finished.");
|
|
||||||
|
|
||||||
EventBits_t bits = xEventGroupWaitBits(wifi_event_group,CONNECTED_BIT,true,true,portMAX_DELAY);
|
|
||||||
|
|
||||||
if (bits & CONNECTED_BIT) {
|
|
||||||
ESP_LOGI(MAIN_TAG, "connected to ap SSID:%s password:%s",
|
|
||||||
ssid.c_str(), passphrase.c_str());
|
|
||||||
} else {
|
|
||||||
ESP_LOGI(MAIN_TAG, "Failed to connect to SSID:%s, password:%s",
|
|
||||||
ssid.c_str(), passphrase.c_str());
|
|
||||||
}
|
|
||||||
tcpip_adapter_ip_info_t ip_info2;
|
|
||||||
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info2));
|
|
||||||
ipaddress = std::string(ip4addr_ntoa(&ip_info2.ip));
|
|
||||||
netmask = std::string(ip4addr_ntoa(&ip_info2.netmask));
|
|
||||||
gw = std::string(ip4addr_ntoa(&ip_info2.gw));
|
|
||||||
|
|
||||||
// vEventGroupDelete(wifi_event_group);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ConnectToWLAN()
|
|
||||||
{
|
|
||||||
if (ipaddress.length() == 0 || gw.length() == 0 || netmask.length() == 0)
|
|
||||||
{
|
|
||||||
printf("Connect to WLAN with dyn. IP\n");
|
|
||||||
initialise_wifi();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Connect to WLAN with fixed IP\n");
|
|
||||||
initialise_wifi_fixed_ip();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ChangeHostName(std::string fn, std::string _newhostname)
|
|
||||||
{
|
|
||||||
if (_newhostname == hostname)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
string line = "";
|
|
||||||
std::vector<string> zerlegt;
|
|
||||||
|
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
std::vector<string> neuesfile;
|
|
||||||
|
|
||||||
FILE* pFile;
|
|
||||||
fn = FormatFileName(fn);
|
|
||||||
pFile = OpenFileAndWait(fn.c_str(), "r");
|
|
||||||
|
|
||||||
printf("file loaded\n");
|
|
||||||
|
|
||||||
if (pFile == NULL)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
char zw[1024];
|
|
||||||
fgets(zw, 1024, pFile);
|
|
||||||
line = std::string(zw);
|
|
||||||
|
|
||||||
while ((line.size() > 0) || !(feof(pFile)))
|
|
||||||
{
|
|
||||||
printf("%s", line.c_str());
|
|
||||||
zerlegt = ZerlegeZeile(line, "=");
|
|
||||||
zerlegt[0] = trim(zerlegt[0], " ");
|
|
||||||
|
|
||||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "HOSTNAME")){
|
|
||||||
line = "hostname = \"" + _newhostname + "\"\n";
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
neuesfile.push_back(line);
|
|
||||||
|
|
||||||
if (fgets(zw, 1024, pFile) == NULL)
|
|
||||||
{
|
|
||||||
line = "";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
line = std::string(zw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
|
||||||
{
|
|
||||||
line = "\nhostname = \"" + _newhostname + "\"\n";
|
|
||||||
neuesfile.push_back(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(pFile);
|
|
||||||
|
|
||||||
pFile = OpenFileAndWait(fn.c_str(), "w+");
|
|
||||||
|
|
||||||
for (int i = 0; i < neuesfile.size(); ++i)
|
|
||||||
{
|
|
||||||
printf(neuesfile[i].c_str());
|
|
||||||
fputs(neuesfile[i].c_str(), pFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(pFile);
|
|
||||||
|
|
||||||
printf("*** Update hostname done ***\n");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LoadWlanFromFile(std::string fn)
|
|
||||||
{
|
|
||||||
string line = "";
|
|
||||||
std::vector<string> zerlegt;
|
|
||||||
hostname = std_hostname;
|
|
||||||
|
|
||||||
FILE* pFile;
|
|
||||||
fn = FormatFileName(fn);
|
|
||||||
|
|
||||||
pFile = OpenFileAndWait(fn.c_str(), "r");
|
|
||||||
printf("file loaded\n");
|
|
||||||
|
|
||||||
if (pFile == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
char zw[1024];
|
|
||||||
fgets(zw, 1024, pFile);
|
|
||||||
line = std::string(zw);
|
|
||||||
|
|
||||||
while ((line.size() > 0) || !(feof(pFile)))
|
|
||||||
{
|
|
||||||
printf("%s", line.c_str());
|
|
||||||
zerlegt = ZerlegeZeile(line, "=");
|
|
||||||
zerlegt[0] = trim(zerlegt[0], " ");
|
|
||||||
for (int i = 2; i < zerlegt.size(); ++i)
|
|
||||||
zerlegt[1] = zerlegt[1] + zerlegt[i];
|
|
||||||
|
|
||||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "HOSTNAME")){
|
|
||||||
hostname = trim(zerlegt[1]);
|
|
||||||
if ((hostname[0] == '"') && (hostname[hostname.length()-1] == '"')){
|
|
||||||
hostname = hostname.substr(1, hostname.length()-2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "SSID")){
|
|
||||||
ssid = trim(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] == '"')){
|
|
||||||
passphrase = passphrase.substr(1, passphrase.length()-2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "IP")){
|
|
||||||
ipaddress = zerlegt[1];
|
|
||||||
if ((ipaddress[0] == '"') && (ipaddress[ipaddress.length()-1] == '"')){
|
|
||||||
ipaddress = ipaddress.substr(1, ipaddress.length()-2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "GATEWAY")){
|
|
||||||
gw = zerlegt[1];
|
|
||||||
if ((gw[0] == '"') && (gw[gw.length()-1] == '"')){
|
|
||||||
gw = gw.substr(1, gw.length()-2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "NETMASK")){
|
|
||||||
netmask = zerlegt[1];
|
|
||||||
if ((netmask[0] == '"') && (netmask[netmask.length()-1] == '"')){
|
|
||||||
netmask = netmask.substr(1, netmask.length()-2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "DNS")){
|
|
||||||
dns = zerlegt[1];
|
|
||||||
if ((dns[0] == '"') && (dns[dns.length()-1] == '"')){
|
|
||||||
dns = dns.substr(1, dns.length()-2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (fgets(zw, 1024, pFile) == NULL)
|
|
||||||
{
|
|
||||||
line = "";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
line = std::string(zw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(pFile);
|
|
||||||
|
|
||||||
// Check if Hostname was empty in .ini if yes set to std_hostname
|
|
||||||
if(hostname.length() <= 0){
|
|
||||||
hostname = std_hostname;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("\nWLan: %s, %s\n", ssid.c_str(), passphrase.c_str());
|
|
||||||
printf("Hostename: %s\n", hostname.c_str());
|
|
||||||
printf("Fixed IP: %s, Gateway %s, Netmask %s, DNS %s\n", ipaddress.c_str(), gw.c_str(), netmask.c_str(), dns.c_str());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadNetConfigFromFile(std::string fn, std::string &_ip, std::string &_gw, std::string &_netmask, std::string &_dns)
|
|
||||||
{
|
|
||||||
string line = "";
|
|
||||||
std::vector<string> zerlegt;
|
|
||||||
|
|
||||||
FILE* pFile;
|
|
||||||
fn = FormatFileName(fn);
|
|
||||||
pFile = OpenFileAndWait(fn.c_str(), "r");
|
|
||||||
|
|
||||||
printf("file loaded\n");
|
|
||||||
|
|
||||||
if (pFile == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
char zw[1024];
|
|
||||||
fgets(zw, 1024, pFile);
|
|
||||||
line = std::string(zw);
|
|
||||||
|
|
||||||
while ((line.size() > 0) || !(feof(pFile)))
|
|
||||||
{
|
|
||||||
printf("%s", line.c_str());
|
|
||||||
zerlegt = ZerlegeZeile(line, "=");
|
|
||||||
zerlegt[0] = trim(zerlegt[0], " ");
|
|
||||||
|
|
||||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "IP")){
|
|
||||||
_ip = zerlegt[1];
|
|
||||||
if ((_ip[0] == '"') && (_ip[_ip.length()-1] == '"')){
|
|
||||||
_ip = _ip.substr(1, _ip.length()-2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "GATEWAY")){
|
|
||||||
_gw = zerlegt[1];
|
|
||||||
if ((_gw[0] == '"') && (_gw[_gw.length()-1] == '"')){
|
|
||||||
_gw = _gw.substr(1, _gw.length()-2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "NETMASK")){
|
|
||||||
_netmask = zerlegt[1];
|
|
||||||
if ((_netmask[0] == '"') && (_netmask[_netmask.length()-1] == '"')){
|
|
||||||
_netmask = _netmask.substr(1, _netmask.length()-2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "DNS")){
|
|
||||||
_dns = zerlegt[1];
|
|
||||||
if ((_dns[0] == '"') && (_dns[_dns.length()-1] == '"')){
|
|
||||||
_dns = _dns.substr(1, _dns.length()-2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fgets(zw, 1024, pFile) == NULL)
|
|
||||||
{
|
|
||||||
line = "";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
line = std::string(zw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(pFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string getHostname(){
|
|
||||||
return hostname;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string getIPAddress(){
|
|
||||||
return ipaddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string getSSID(){
|
|
||||||
return ssid;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string getNetMask(){
|
|
||||||
return netmask;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string getGW(){
|
|
||||||
return gw;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#ifndef CONNECT_WLAN_H
|
|
||||||
#define CONNECT_WLAN_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include "driver/gpio.h"
|
|
||||||
|
|
||||||
const int CONNECTED_BIT = BIT0;
|
|
||||||
void ConnectToWLAN();
|
|
||||||
|
|
||||||
void LoadWlanFromFile(std::string fn);
|
|
||||||
|
|
||||||
bool ChangeHostName(std::string fn, std::string _newhostname);
|
|
||||||
|
|
||||||
std::string getHostname();
|
|
||||||
std::string getIPAddress();
|
|
||||||
std::string getSSID();
|
|
||||||
std::string getNetMask();
|
|
||||||
std::string getGW();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -4,6 +4,6 @@ list(APPEND EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/proto
|
|||||||
|
|
||||||
idf_component_register(SRCS ${app_sources}
|
idf_component_register(SRCS ${app_sources}
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
REQUIRES esp32-camera-master esp_http_server jomjol_logfile jomjol_image_proc nvs_flash)
|
REQUIRES esp32-camera-master esp_http_server jomjol_logfile jomjol_image_proc nvs_flash jomjol_fileserver_ota)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
#include "Helper.h"
|
#include "Helper.h"
|
||||||
#include "CImageBasis.h"
|
#include "CImageBasis.h"
|
||||||
|
|
||||||
|
#include "server_ota.h"
|
||||||
|
|
||||||
|
|
||||||
#define BOARD_ESP32CAM_AITHINKER
|
#define BOARD_ESP32CAM_AITHINKER
|
||||||
|
|
||||||
@@ -220,13 +222,15 @@ void CCamera::SetQualitySize(int qual, framesize_t resol)
|
|||||||
void CCamera::EnableAutoExposure(int flashdauer)
|
void CCamera::EnableAutoExposure(int flashdauer)
|
||||||
{
|
{
|
||||||
LEDOnOff(true);
|
LEDOnOff(true);
|
||||||
LightOnOff(true);
|
if (flashdauer > 0)
|
||||||
|
LightOnOff(true);
|
||||||
const TickType_t xDelay = flashdauer / portTICK_PERIOD_MS;
|
const TickType_t xDelay = flashdauer / portTICK_PERIOD_MS;
|
||||||
vTaskDelay( xDelay );
|
vTaskDelay( xDelay );
|
||||||
|
|
||||||
camera_fb_t * fb = esp_camera_fb_get();
|
camera_fb_t * fb = esp_camera_fb_get();
|
||||||
if (!fb) {
|
if (!fb) {
|
||||||
ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed");
|
ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed");
|
||||||
|
doReboot();
|
||||||
}
|
}
|
||||||
esp_camera_fb_return(fb);
|
esp_camera_fb_return(fb);
|
||||||
|
|
||||||
@@ -271,6 +275,8 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
|
|||||||
if (!fb) {
|
if (!fb) {
|
||||||
ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed");
|
ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed");
|
||||||
LEDOnOff(false);
|
LEDOnOff(false);
|
||||||
|
doReboot();
|
||||||
|
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,7 +360,11 @@ esp_err_t CCamera::CaptureToFile(std::string nm, int delay)
|
|||||||
camera_fb_t * fb = esp_camera_fb_get();
|
camera_fb_t * fb = esp_camera_fb_get();
|
||||||
if (!fb) {
|
if (!fb) {
|
||||||
ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed");
|
ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed");
|
||||||
|
ESP_LOGE(TAGCAMERACLASS, "Reboot ?????");
|
||||||
LEDOnOff(false);
|
LEDOnOff(false);
|
||||||
|
LightOnOff(false);
|
||||||
|
doReboot();
|
||||||
|
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
LEDOnOff(false);
|
LEDOnOff(false);
|
||||||
@@ -443,7 +453,10 @@ esp_err_t CCamera::CaptureToHTTP(httpd_req_t *req, int delay)
|
|||||||
fb = esp_camera_fb_get();
|
fb = esp_camera_fb_get();
|
||||||
if (!fb) {
|
if (!fb) {
|
||||||
ESP_LOGE(TAGCAMERACLASS, "Camera capture failed");
|
ESP_LOGE(TAGCAMERACLASS, "Camera capture failed");
|
||||||
|
LightOnOff(false);
|
||||||
httpd_resp_send_500(req);
|
httpd_resp_send_500(req);
|
||||||
|
// doReboot();
|
||||||
|
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
|
|||||||
|
|
||||||
idf_component_register(SRCS ${app_sources}
|
idf_component_register(SRCS ${app_sources}
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
REQUIRES jomjol_tfliteclass jomjol_helper jomjol_controlcamera jomjol_mqtt jomjol_fileserver_ota jomjol_image_proc connect_wlan)
|
REQUIRES jomjol_tfliteclass jomjol_helper jomjol_controlcamera jomjol_mqtt jomjol_fileserver_ota jomjol_image_proc jomjol_wlan)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "ClassFlowControll.h"
|
#include "ClassFlowControll.h"
|
||||||
|
|
||||||
#include "connect_wlan.h"
|
#include "connect_wlan.h"
|
||||||
|
#include "read_wlanini.h"
|
||||||
|
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
|
|
||||||
@@ -21,13 +22,16 @@ static const char* TAG = "flow_controll";
|
|||||||
std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _host){
|
std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _host){
|
||||||
std::string _classname = "";
|
std::string _classname = "";
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
|
// printf("_stepname: %s\n", _stepname.c_str());
|
||||||
if ((_stepname.compare("[MakeImage]") == 0) || (_stepname.compare(";[MakeImage]") == 0)){
|
if ((_stepname.compare("[MakeImage]") == 0) || (_stepname.compare(";[MakeImage]") == 0)){
|
||||||
_classname = "ClassFlowMakeImage";
|
_classname = "ClassFlowMakeImage";
|
||||||
}
|
}
|
||||||
if ((_stepname.compare("[Alignment]") == 0) || (_stepname.compare(";[Alignment]") == 0)){
|
if ((_stepname.compare("[Alignment]") == 0) || (_stepname.compare(";[Alignment]") == 0)){
|
||||||
_classname = "ClassFlowAlignment";
|
_classname = "ClassFlowAlignment";
|
||||||
}
|
}
|
||||||
if ((_stepname.compare("[Digits]") == 0) || (_stepname.compare(";[Digits]") == 0)){
|
if ((_stepname.compare(0, 7, "[Digits") == 0) || (_stepname.compare(0, 8, ";[Digits") == 0)) {
|
||||||
|
// if ((_stepname.compare("[Digits]") == 0) || (_stepname.compare(";[Digits]") == 0)){
|
||||||
|
// printf("Digits!!!\n");
|
||||||
_classname = "ClassFlowDigit";
|
_classname = "ClassFlowDigit";
|
||||||
}
|
}
|
||||||
if ((_stepname.compare("[Analog]") == 0) || (_stepname.compare(";[Analog]") == 0)){
|
if ((_stepname.compare("[Analog]") == 0) || (_stepname.compare(";[Analog]") == 0)){
|
||||||
@@ -109,7 +113,7 @@ ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
|
|||||||
cfc = new ClassFlowAnalog(&FlowControll);
|
cfc = new ClassFlowAnalog(&FlowControll);
|
||||||
flowanalog = (ClassFlowAnalog*) cfc;
|
flowanalog = (ClassFlowAnalog*) cfc;
|
||||||
}
|
}
|
||||||
if (toUpper(_type).compare("[DIGITS]") == 0)
|
if (toUpper(_type).compare(0, 7, "[DIGITS") == 0)
|
||||||
{
|
{
|
||||||
cfc = new ClassFlowDigit(&FlowControll);
|
cfc = new ClassFlowDigit(&FlowControll);
|
||||||
flowdigit = (ClassFlowDigit*) cfc;
|
flowdigit = (ClassFlowDigit*) cfc;
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ void ClassFlowDigit::SetInitialParameter(void)
|
|||||||
previousElement = NULL;
|
previousElement = NULL;
|
||||||
SaveAllFiles = false;
|
SaveAllFiles = false;
|
||||||
disabled = false;
|
disabled = false;
|
||||||
|
DecimalShift = 0;
|
||||||
|
DecimalShiftEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassFlowDigit::ClassFlowDigit() : ClassFlowImage(TAG)
|
ClassFlowDigit::ClassFlowDigit() : ClassFlowImage(TAG)
|
||||||
@@ -88,8 +89,25 @@ bool ClassFlowDigit::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
printf("aktparamgraph: %s\n", aktparamgraph.c_str());
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
if ((aktparamgraph.compare("[Digits]") != 0) && (aktparamgraph.compare(";[Digits]") != 0)) // Paragraph passt nich zu MakeImage
|
if ((aktparamgraph.compare("[Digits]") != 0) && (aktparamgraph.compare(";[Digits]") != 0)) // Paragraph passt nich zu MakeImage
|
||||||
return false;
|
return false;
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ((aktparamgraph.compare(0, 7, "[Digits") != 0) && (aktparamgraph.compare(0, 8, ";[Digits") != 0)) // Paragraph passt nich zu MakeImage
|
||||||
|
return false;
|
||||||
|
|
||||||
|
int _pospkt = aktparamgraph.find_first_of(".");
|
||||||
|
int _posklammerzu = aktparamgraph.find_first_of("]");
|
||||||
|
// printf("Pos: %d, %d\n", _pospkt, _posklammerzu);
|
||||||
|
if (_pospkt > -1)
|
||||||
|
NameDigit = aktparamgraph.substr(_pospkt+1, _posklammerzu - _pospkt-1);
|
||||||
|
else
|
||||||
|
NameDigit = "";
|
||||||
|
printf("Name Digit: %s\n", NameDigit.c_str());
|
||||||
|
|
||||||
if (aktparamgraph[0] == ';')
|
if (aktparamgraph[0] == ';')
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ protected:
|
|||||||
string cnnmodelfile;
|
string cnnmodelfile;
|
||||||
int modelxsize, modelysize;
|
int modelxsize, modelysize;
|
||||||
bool SaveAllFiles;
|
bool SaveAllFiles;
|
||||||
|
string NameDigit;
|
||||||
|
int DecimalShift;
|
||||||
|
bool DecimalShiftEnabled;
|
||||||
|
|
||||||
|
|
||||||
ClassFlowAlignment* flowpostalignment;
|
ClassFlowAlignment* flowpostalignment;
|
||||||
|
|
||||||
|
|||||||
@@ -158,14 +158,14 @@ bool ClassFlowMQTT::doFlow(string zwtime)
|
|||||||
{
|
{
|
||||||
resulterror = " ";
|
resulterror = " ";
|
||||||
}
|
}
|
||||||
MQTTPublish(topicError, resulterror);
|
MQTTPublish(topicError, resulterror, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topicRate.length() > 0) {
|
if (topicRate.length() > 0) {
|
||||||
MQTTPublish(topicRate, resultrate);
|
MQTTPublish(topicRate, resultrate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topicRate.length() > 0) {
|
if (topicTimeStamp.length() > 0) {
|
||||||
MQTTPublish(topicTimeStamp, resulttimestamp);
|
MQTTPublish(topicTimeStamp, resulttimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ static const char* TAG = "flow_make_image";
|
|||||||
esp_err_t ClassFlowMakeImage::camera_capture(){
|
esp_err_t ClassFlowMakeImage::camera_capture(){
|
||||||
string nm = namerawimage;
|
string nm = namerawimage;
|
||||||
Camera.CaptureToFile(nm);
|
Camera.CaptureToFile(nm);
|
||||||
|
time(&TimeImageTaken);
|
||||||
|
localtime(&TimeImageTaken);
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,7 +26,11 @@ void ClassFlowMakeImage::takePictureWithFlash(int flashdauer)
|
|||||||
rawImage->width = image_width;
|
rawImage->width = image_width;
|
||||||
rawImage->height = image_height;
|
rawImage->height = image_height;
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
printf("Flashdauer: %d\n", flashdauer);
|
||||||
Camera.CaptureToBasisImage(rawImage, flashdauer);
|
Camera.CaptureToBasisImage(rawImage, flashdauer);
|
||||||
|
time(&TimeImageTaken);
|
||||||
|
localtime(&TimeImageTaken);
|
||||||
|
|
||||||
if (SaveAllFiles) rawImage->SaveToFile(namerawimage);
|
if (SaveAllFiles) rawImage->SaveToFile(namerawimage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,6 +94,12 @@ bool ClassFlowMakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
SaveAllFiles = true;
|
SaveAllFiles = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((toUpper(zerlegt[0]) == "WAITBEFORETAKINGPICTURE") && (zerlegt.size() > 1))
|
||||||
|
{
|
||||||
|
waitbeforepicture = stoi(zerlegt[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((toUpper(zerlegt[0]) == "BRIGHTNESS") && (zerlegt.size() > 1))
|
if ((toUpper(zerlegt[0]) == "BRIGHTNESS") && (zerlegt.size() > 1))
|
||||||
{
|
{
|
||||||
_brightness = stoi(zerlegt[1]);
|
_brightness = stoi(zerlegt[1]);
|
||||||
@@ -118,9 +131,9 @@ bool ClassFlowMakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
rawImage->CreateEmptyImage(image_width, image_height, 3);
|
rawImage->CreateEmptyImage(image_width, image_height, 3);
|
||||||
|
|
||||||
waitbeforepicture_store = waitbeforepicture;
|
waitbeforepicture_store = waitbeforepicture;
|
||||||
if (FixedExposure)
|
if (FixedExposure && (waitbeforepicture > 0))
|
||||||
{
|
{
|
||||||
printf("Fixed Exposure enabled!\n");
|
// printf("Fixed Exposure enabled!\n");
|
||||||
int flashdauer = (int) (waitbeforepicture * 1000);
|
int flashdauer = (int) (waitbeforepicture * 1000);
|
||||||
Camera.EnableAutoExposure(flashdauer);
|
Camera.EnableAutoExposure(flashdauer);
|
||||||
waitbeforepicture = 0.2;
|
waitbeforepicture = 0.2;
|
||||||
@@ -169,6 +182,9 @@ bool ClassFlowMakeImage::doFlow(string zwtime)
|
|||||||
esp_err_t ClassFlowMakeImage::SendRawJPG(httpd_req_t *req)
|
esp_err_t ClassFlowMakeImage::SendRawJPG(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
int flashdauer = (int) (waitbeforepicture * 1000);
|
int flashdauer = (int) (waitbeforepicture * 1000);
|
||||||
|
time(&TimeImageTaken);
|
||||||
|
localtime(&TimeImageTaken);
|
||||||
|
|
||||||
return Camera.CaptureToHTTP(req, flashdauer);
|
return Camera.CaptureToHTTP(req, flashdauer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,6 +195,9 @@ ImageData* ClassFlowMakeImage::SendRawImage()
|
|||||||
ImageData *id;
|
ImageData *id;
|
||||||
int flashdauer = (int) (waitbeforepicture * 1000);
|
int flashdauer = (int) (waitbeforepicture * 1000);
|
||||||
Camera.CaptureToBasisImage(zw, flashdauer);
|
Camera.CaptureToBasisImage(zw, flashdauer);
|
||||||
|
time(&TimeImageTaken);
|
||||||
|
localtime(&TimeImageTaken);
|
||||||
|
|
||||||
id = zw->writeToMemoryAsJPG();
|
id = zw->writeToMemoryAsJPG();
|
||||||
delete zw;
|
delete zw;
|
||||||
return id;
|
return id;
|
||||||
|
|||||||
@@ -11,6 +11,13 @@
|
|||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "time_sntp.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define PREVALUE_TIME_FORMAT_OUTPUT "%Y-%m-%dT%H:%M:%S"
|
||||||
|
#define PREVALUE_TIME_FORMAT_INPUT "%d-%d-%dT%d:%d:%d"
|
||||||
|
|
||||||
|
|
||||||
string ClassFlowPostProcessing::GetPreValue()
|
string ClassFlowPostProcessing::GetPreValue()
|
||||||
{
|
{
|
||||||
std::string result;
|
std::string result;
|
||||||
@@ -63,7 +70,7 @@ bool ClassFlowPostProcessing::LoadPreValue(void)
|
|||||||
int yy, month, dd, hh, mm, ss;
|
int yy, month, dd, hh, mm, ss;
|
||||||
struct tm whenStart;
|
struct tm whenStart;
|
||||||
|
|
||||||
sscanf(zwtime.c_str(), "%d-%d-%dT%d:%d:%d", &yy, &month, &dd, &hh, &mm, &ss);
|
sscanf(zwtime.c_str(), PREVALUE_TIME_FORMAT_INPUT, &yy, &month, &dd, &hh, &mm, &ss);
|
||||||
whenStart.tm_year = yy - 1900;
|
whenStart.tm_year = yy - 1900;
|
||||||
whenStart.tm_mon = month - 1;
|
whenStart.tm_mon = month - 1;
|
||||||
whenStart.tm_mday = dd;
|
whenStart.tm_mday = dd;
|
||||||
@@ -72,11 +79,11 @@ bool ClassFlowPostProcessing::LoadPreValue(void)
|
|||||||
whenStart.tm_sec = ss;
|
whenStart.tm_sec = ss;
|
||||||
whenStart.tm_isdst = -1;
|
whenStart.tm_isdst = -1;
|
||||||
|
|
||||||
tStart = mktime(&whenStart);
|
lastvalue = mktime(&whenStart);
|
||||||
|
|
||||||
time(&lastvalue);
|
time(&tStart);
|
||||||
localtime(&lastvalue);
|
localtime(&tStart);
|
||||||
double difference = difftime(lastvalue, tStart);
|
double difference = difftime(tStart, lastvalue);
|
||||||
difference /= 60;
|
difference /= 60;
|
||||||
if (difference > PreValueAgeStartup)
|
if (difference > PreValueAgeStartup)
|
||||||
return false;
|
return false;
|
||||||
@@ -121,7 +128,7 @@ void ClassFlowPostProcessing::SavePreValue(float value, string zwtime)
|
|||||||
time(&rawtime);
|
time(&rawtime);
|
||||||
timeinfo = localtime(&rawtime);
|
timeinfo = localtime(&rawtime);
|
||||||
|
|
||||||
strftime(buffer, 80, "%Y-%m-%dT%H:%M:%S", timeinfo);
|
strftime(buffer, 80, PREVALUE_TIME_FORMAT_OUTPUT, timeinfo);
|
||||||
timeStamp = std::string(buffer);
|
timeStamp = std::string(buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -157,6 +164,15 @@ ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc)
|
|||||||
timeStamp = "";
|
timeStamp = "";
|
||||||
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
|
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
|
||||||
ListFlowControll = lfc;
|
ListFlowControll = lfc;
|
||||||
|
flowMakeImage = NULL;
|
||||||
|
|
||||||
|
for (int i = 0; i < ListFlowControll->size(); ++i)
|
||||||
|
{
|
||||||
|
if (((*ListFlowControll)[i])->name().compare("ClassFlowMakeImage") == 0)
|
||||||
|
{
|
||||||
|
flowMakeImage = (ClassFlowMakeImage*) (*ListFlowControll)[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -348,8 +364,16 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
|||||||
|
|
||||||
PreValueOkay = true;
|
PreValueOkay = true;
|
||||||
PreValue = Value;
|
PreValue = Value;
|
||||||
time(&lastvalue);
|
if (flowMakeImage)
|
||||||
localtime(&lastvalue);
|
{
|
||||||
|
lastvalue = flowMakeImage->getTimeImageTaken();
|
||||||
|
zwtime = ConvertTimeToString(lastvalue, PREVALUE_TIME_FORMAT_OUTPUT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
time(&lastvalue);
|
||||||
|
localtime(&lastvalue);
|
||||||
|
}
|
||||||
|
|
||||||
SavePreValue(Value, zwtime);
|
SavePreValue(Value, zwtime);
|
||||||
}
|
}
|
||||||
@@ -387,16 +411,30 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
|||||||
if (ErrorMessage && (ErrorMessageText.length() > 0))
|
if (ErrorMessage && (ErrorMessageText.length() > 0))
|
||||||
ReturnValue = ReturnValue + "\t" + ErrorMessageText;
|
ReturnValue = ReturnValue + "\t" + ErrorMessageText;
|
||||||
|
|
||||||
if (ErrorMessageText.length() == 0)
|
time_t currenttime;
|
||||||
|
if (flowMakeImage)
|
||||||
|
{
|
||||||
|
currenttime = flowMakeImage->getTimeImageTaken();
|
||||||
|
zwtime = ConvertTimeToString(currenttime, PREVALUE_TIME_FORMAT_OUTPUT);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
time_t currenttime;
|
|
||||||
time(¤ttime);
|
time(¤ttime);
|
||||||
localtime(¤ttime);
|
localtime(¤ttime);
|
||||||
double difference = difftime(currenttime, lastvalue); // in Sekunden
|
}
|
||||||
difference /= 60; // in Minuten
|
|
||||||
FlowRateAct = (Value - PreValue) / difference;
|
|
||||||
|
|
||||||
|
double difference = difftime(currenttime, lastvalue); // in Sekunden
|
||||||
|
difference /= 60; // in Minuten
|
||||||
|
FlowRateAct = (Value - PreValue) / difference;
|
||||||
|
lastvalue = currenttime;
|
||||||
|
// std::string _zw = "CalcRate: " + std::to_string(FlowRateAct) + " TimeDifference[min]: " + std::to_string(difference);
|
||||||
|
// _zw = _zw + " Value: " + std::to_string(Value) + " PreValue: " + std::to_string(PreValue);
|
||||||
|
// LogFile.WriteToFile(_zw);
|
||||||
|
|
||||||
|
if (ErrorMessageText.length() == 0)
|
||||||
|
{
|
||||||
PreValue = Value;
|
PreValue = Value;
|
||||||
|
ErrorMessageText = "no error";
|
||||||
SavePreValue(Value, zwtime);
|
SavePreValue(Value, zwtime);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "ClassFlow.h"
|
#include "ClassFlow.h"
|
||||||
|
#include "ClassFlowMakeImage.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ClassFlowPostProcessing :
|
class ClassFlowPostProcessing :
|
||||||
public ClassFlow
|
public ClassFlow
|
||||||
{
|
{
|
||||||
@@ -30,6 +33,8 @@ protected:
|
|||||||
string ErrorMessageText; // Fehlermeldung bei Consistency Check
|
string ErrorMessageText; // Fehlermeldung bei Consistency Check
|
||||||
string timeStamp;
|
string timeStamp;
|
||||||
|
|
||||||
|
ClassFlowMakeImage *flowMakeImage;
|
||||||
|
|
||||||
bool LoadPreValue(void);
|
bool LoadPreValue(void);
|
||||||
string ShiftDecimal(string in, int _decShift);
|
string ShiftDecimal(string in, int _decShift);
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ esp_mqtt_event_id_t esp_mmqtt_ID = MQTT_EVENT_ANY;
|
|||||||
bool mqtt_connected = false;
|
bool mqtt_connected = false;
|
||||||
esp_mqtt_client_handle_t client = NULL;
|
esp_mqtt_client_handle_t client = NULL;
|
||||||
|
|
||||||
void MQTTPublish(std::string _key, std::string _content){
|
void MQTTPublish(std::string _key, std::string _content, int retained_flag){
|
||||||
if (client && mqtt_connected) {
|
if (client && mqtt_connected) {
|
||||||
int msg_id;
|
int msg_id;
|
||||||
std::string zw;
|
std::string zw;
|
||||||
msg_id = esp_mqtt_client_publish(client, _key.c_str(), _content.c_str(), 0, 1, 0);
|
msg_id = esp_mqtt_client_publish(client, _key.c_str(), _content.c_str(), 0, 1, retained_flag);
|
||||||
zw = "sent publish successful in MQTTPublish, msg_id=" + std::to_string(msg_id) + ", " + _key + ", " + _content;
|
zw = "sent publish successful in MQTTPublish, msg_id=" + std::to_string(msg_id) + ", " + _key + ", " + _content;
|
||||||
if (debugdetail) LogFile.WriteToFile(zw);
|
if (debugdetail) LogFile.WriteToFile(zw);
|
||||||
ESP_LOGI(TAG, "sent publish successful in MQTTPublish, msg_id=%d, %s, %s", msg_id, _key.c_str(), _content.c_str());
|
ESP_LOGI(TAG, "sent publish successful in MQTTPublish, msg_id=%d, %s, %s", msg_id, _key.c_str(), _content.c_str());
|
||||||
@@ -74,6 +74,7 @@ void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, st
|
|||||||
.client_id = _clientid.c_str(),
|
.client_id = _clientid.c_str(),
|
||||||
.lwt_topic = _LWTContext.c_str(),
|
.lwt_topic = _LWTContext.c_str(),
|
||||||
.lwt_msg = _zwmessage.c_str(),
|
.lwt_msg = _zwmessage.c_str(),
|
||||||
|
.lwt_retain = 1,
|
||||||
.lwt_msg_len = _lzw,
|
.lwt_msg_len = _lzw,
|
||||||
.keepalive = _keepalive
|
.keepalive = _keepalive
|
||||||
};
|
};
|
||||||
@@ -88,5 +89,5 @@ void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, st
|
|||||||
esp_mqtt_client_register_event(client, esp_mmqtt_ID, mqtt_event_handler, client);
|
esp_mqtt_client_register_event(client, esp_mmqtt_ID, mqtt_event_handler, client);
|
||||||
esp_mqtt_client_start(client);
|
esp_mqtt_client_start(client);
|
||||||
|
|
||||||
MQTTPublish(_LWTContext, "");
|
MQTTPublish(_LWTContext, "", 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, st
|
|||||||
|
|
||||||
//void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user = "", std::string _password = "");
|
//void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user = "", std::string _password = "");
|
||||||
|
|
||||||
void MQTTPublish(std::string _key, std::string _content);
|
void MQTTPublish(std::string _key, std::string _content, int retained_flag = 0);
|
||||||
@@ -27,6 +27,17 @@ void time_sync_notification_cb(struct timeval *tv)
|
|||||||
ESP_LOGI(TAG, "Notification of a time synchronization event");
|
ESP_LOGI(TAG, "Notification of a time synchronization event");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ConvertTimeToString(time_t _time, const char * frm)
|
||||||
|
{
|
||||||
|
struct tm timeinfo;
|
||||||
|
char strftime_buf[64];
|
||||||
|
localtime_r(&_time, &timeinfo);
|
||||||
|
strftime(strftime_buf, sizeof(strftime_buf), frm, &timeinfo);
|
||||||
|
|
||||||
|
std::string result(strftime_buf);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
std::string gettimestring(const char * frm)
|
std::string gettimestring(const char * frm)
|
||||||
{
|
{
|
||||||
time_t now;
|
time_t now;
|
||||||
|
|||||||
@@ -15,5 +15,7 @@
|
|||||||
void setup_time(void);
|
void setup_time(void);
|
||||||
|
|
||||||
std::string gettimestring(const char * frm);
|
std::string gettimestring(const char * frm);
|
||||||
|
std::string ConvertTimeToString(time_t _time, const char * frm);
|
||||||
|
|
||||||
void setTimeZone(std::string _tzstring);
|
void setTimeZone(std::string _tzstring);
|
||||||
void reset_servername(std::string _servername);
|
void reset_servername(std::string _servername);
|
||||||
@@ -2,6 +2,6 @@ FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
|
|||||||
|
|
||||||
idf_component_register(SRCS ${app_sources}
|
idf_component_register(SRCS ${app_sources}
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
REQUIRES jomjol_helper)
|
REQUIRES nvs_flash jomjol_helper)
|
||||||
|
|
||||||
|
|
||||||
293
code/components/jomjol_wlan/connect_wlan.cpp
Normal file
293
code/components/jomjol_wlan/connect_wlan.cpp
Normal file
@@ -0,0 +1,293 @@
|
|||||||
|
#include "connect_wlan.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "freertos/task.h"
|
||||||
|
#include "freertos/event_groups.h"
|
||||||
|
#include "driver/gpio.h"
|
||||||
|
#include "esp_system.h"
|
||||||
|
#include "esp_wifi.h"
|
||||||
|
#include "esp_event.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "nvs_flash.h"
|
||||||
|
|
||||||
|
#include "lwip/err.h"
|
||||||
|
#include "lwip/sys.h"
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define EXAMPLE_ESP_MAXIMUM_RETRY 1000
|
||||||
|
|
||||||
|
/* FreeRTOS event group to signal when we are connected*/
|
||||||
|
static EventGroupHandle_t s_wifi_event_group;
|
||||||
|
|
||||||
|
/* The event group allows multiple bits for each event, but we only care about two events:
|
||||||
|
* - we are connected to the AP with an IP
|
||||||
|
* - we failed to connect after the maximum amount of retries */
|
||||||
|
#define WIFI_CONNECTED_BIT BIT0
|
||||||
|
#define WIFI_FAIL_BIT BIT1
|
||||||
|
|
||||||
|
static const char *TAG = "wifi station";
|
||||||
|
|
||||||
|
static int s_retry_num = 0;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
#define BLINK_GPIO GPIO_NUM_33
|
||||||
|
|
||||||
|
int BlinkDauer;
|
||||||
|
int BlinkAnzahl;
|
||||||
|
bool BlinkOff;
|
||||||
|
bool BlinkIsRunning = false;
|
||||||
|
|
||||||
|
std::string hostname = "";
|
||||||
|
std::string std_hostname = "watermeter";
|
||||||
|
std::string ipadress = "";
|
||||||
|
std::string ssid = "";
|
||||||
|
|
||||||
|
std::string getIPAddress()
|
||||||
|
{
|
||||||
|
return ipadress;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string getSSID()
|
||||||
|
{
|
||||||
|
return ssid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void task_doBlink(void *pvParameter)
|
||||||
|
{
|
||||||
|
ESP_LOGI("BLINK", "Blinken - start");
|
||||||
|
while (BlinkIsRunning)
|
||||||
|
{
|
||||||
|
// ESP_LOGI("BLINK", "Blinken - wait");
|
||||||
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
|
||||||
|
BlinkIsRunning = true;
|
||||||
|
|
||||||
|
// Init the GPIO
|
||||||
|
gpio_pad_select_gpio(BLINK_GPIO);
|
||||||
|
/* Set the GPIO as a push/pull output */
|
||||||
|
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
|
for (int i = 0; i < BlinkAnzahl; ++i)
|
||||||
|
{
|
||||||
|
if (BlinkAnzahl > 1)
|
||||||
|
{
|
||||||
|
gpio_set_level(BLINK_GPIO, 1);
|
||||||
|
vTaskDelay(BlinkDauer / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
gpio_set_level(BLINK_GPIO, 0);
|
||||||
|
vTaskDelay(BlinkDauer / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BlinkOff)
|
||||||
|
gpio_set_level(BLINK_GPIO, 1);
|
||||||
|
|
||||||
|
ESP_LOGI("BLINK", "Blinken - done");
|
||||||
|
BlinkIsRunning = false;
|
||||||
|
|
||||||
|
vTaskDelete(NULL); //Delete this task if it exits from the loop above
|
||||||
|
}
|
||||||
|
|
||||||
|
void LEDBlinkTask(int _dauer, int _anz, bool _off)
|
||||||
|
{
|
||||||
|
BlinkDauer = _dauer;
|
||||||
|
BlinkAnzahl = _anz;
|
||||||
|
BlinkOff = _off;
|
||||||
|
|
||||||
|
xTaskCreate(&task_doBlink, "task_doBlink", configMINIMAL_STACK_SIZE * 8, NULL, tskIDLE_PRIORITY+1, NULL);
|
||||||
|
}
|
||||||
|
/////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
static void event_handler(void* arg, esp_event_base_t event_base,
|
||||||
|
int32_t event_id, void* event_data)
|
||||||
|
{
|
||||||
|
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) {
|
||||||
|
LEDBlinkTask(200, 1, true);
|
||||||
|
esp_wifi_connect();
|
||||||
|
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
|
||||||
|
if (s_retry_num < EXAMPLE_ESP_MAXIMUM_RETRY) {
|
||||||
|
// LEDBlinkTask(200, 1, true);
|
||||||
|
esp_wifi_connect();
|
||||||
|
s_retry_num++;
|
||||||
|
ESP_LOGI(TAG, "retry to connect to the AP");
|
||||||
|
} else {
|
||||||
|
xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
|
||||||
|
}
|
||||||
|
ESP_LOGI(TAG,"connect to the AP fail");
|
||||||
|
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
|
||||||
|
ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data;
|
||||||
|
ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip));
|
||||||
|
ipadress = std::string(ip4addr_ntoa((const ip4_addr*) &event->ip_info.ip));
|
||||||
|
s_retry_num = 0;
|
||||||
|
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
|
||||||
|
LEDBlinkTask(1000, 5, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void strinttoip4(const char *ip, int &a, int &b, int &c, int &d) {
|
||||||
|
std::string zw = std::string(ip);
|
||||||
|
std::stringstream s(zw);
|
||||||
|
char ch; //to temporarily store the '.'
|
||||||
|
s >> a >> ch >> b >> ch >> c >> ch >> d;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wifi_init_sta(const char *_ssid, const char *_password, const char *_hostname, const char *_ipadr, const char *_gw, const char *_netmask, const char *_dns)
|
||||||
|
{
|
||||||
|
ssid = std::string(_ssid);
|
||||||
|
|
||||||
|
s_wifi_event_group = xEventGroupCreate();
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(esp_netif_init());
|
||||||
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
esp_netif_t *my_sta = esp_netif_create_default_wifi_sta();
|
||||||
|
|
||||||
|
if ((_ipadr != NULL) && (_gw != NULL) && (_netmask != NULL))
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "set IP %s, GW %s, Netmask %s manual", _ipadr, _gw, _netmask);
|
||||||
|
esp_netif_dhcpc_stop(my_sta);
|
||||||
|
|
||||||
|
esp_netif_ip_info_t ip_info;
|
||||||
|
int a, b, c, d;
|
||||||
|
strinttoip4(_ipadr, a, b, c, d);
|
||||||
|
IP4_ADDR(&ip_info.ip, a, b, c, d);
|
||||||
|
strinttoip4(_gw, a, b, c, d);
|
||||||
|
IP4_ADDR(&ip_info.gw, a, b, c, d);
|
||||||
|
strinttoip4(_netmask, a, b, c, d);
|
||||||
|
IP4_ADDR(&ip_info.netmask, a, b, c, d);
|
||||||
|
|
||||||
|
esp_netif_set_ip_info(my_sta, &ip_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
|
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||||
|
|
||||||
|
if ((_ipadr != NULL) && (_gw != NULL) && (_netmask != NULL))
|
||||||
|
{
|
||||||
|
if (_dns == NULL)
|
||||||
|
_dns = _gw;
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "set DNS manual");
|
||||||
|
esp_netif_dns_info_t dns_info;
|
||||||
|
ip4_addr_t ip;
|
||||||
|
ip.addr = esp_ip4addr_aton(_dns);
|
||||||
|
ip_addr_set_ip4_u32(&dns_info.ip, ip.addr);
|
||||||
|
ESP_ERROR_CHECK(esp_netif_set_dns_info(my_sta, ESP_NETIF_DNS_MAIN, &dns_info));
|
||||||
|
}
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
// esp_netif_create_default_wifi_sta();
|
||||||
|
|
||||||
|
// wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
|
// ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
////////////////////////////// esp-idf 4.2 //////////////////////////
|
||||||
|
esp_event_handler_instance_t instance_any_id;
|
||||||
|
esp_event_handler_instance_t instance_got_ip;
|
||||||
|
ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT,
|
||||||
|
ESP_EVENT_ANY_ID,
|
||||||
|
&event_handler,
|
||||||
|
NULL,
|
||||||
|
&instance_any_id));
|
||||||
|
ESP_ERROR_CHECK(esp_event_handler_instance_register(IP_EVENT,
|
||||||
|
IP_EVENT_STA_GOT_IP,
|
||||||
|
&event_handler,
|
||||||
|
NULL,
|
||||||
|
&instance_got_ip));
|
||||||
|
////////////////////////// ENDE esp-idf 4.2 ///////////////////////////
|
||||||
|
*/
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL));
|
||||||
|
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL));
|
||||||
|
|
||||||
|
wifi_config_t wifi_config = { };
|
||||||
|
|
||||||
|
strcpy((char*)wifi_config.sta.ssid, (const char*)_ssid);
|
||||||
|
strcpy((char*)wifi_config.sta.password, (const char*)_password);
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||||
|
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
|
||||||
|
ESP_ERROR_CHECK(esp_wifi_start() );
|
||||||
|
|
||||||
|
if (_hostname != NULL)
|
||||||
|
{
|
||||||
|
esp_err_t ret = tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA , _hostname);
|
||||||
|
hostname = std::string(_hostname);
|
||||||
|
if(ret != ESP_OK ){
|
||||||
|
ESP_LOGE(TAG,"failed to set hostname:%d",ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "wifi_init_sta finished.");
|
||||||
|
|
||||||
|
/* Waiting until either the connection is established (WIFI_CONNECTED_BIT) or connection failed for the maximum
|
||||||
|
* number of re-tries (WIFI_FAIL_BIT). The bits are set by event_handler() (see above) */
|
||||||
|
EventBits_t bits = xEventGroupWaitBits(s_wifi_event_group,
|
||||||
|
WIFI_CONNECTED_BIT | WIFI_FAIL_BIT,
|
||||||
|
pdFALSE,
|
||||||
|
pdFALSE,
|
||||||
|
portMAX_DELAY);
|
||||||
|
|
||||||
|
/* xEventGroupWaitBits() returns the bits before the call returned, hence we can test which event actually
|
||||||
|
* happened. */
|
||||||
|
if (bits & WIFI_CONNECTED_BIT) {
|
||||||
|
ESP_LOGI(TAG, "connected to ap SSID:%s password:%s",
|
||||||
|
_ssid, _password);
|
||||||
|
} else if (bits & WIFI_FAIL_BIT) {
|
||||||
|
ESP_LOGI(TAG, "Failed to connect to SSID:%s, password:%s",
|
||||||
|
_ssid, _password);
|
||||||
|
} else {
|
||||||
|
ESP_LOGE(TAG, "UNEXPECTED EVENT");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The event will not be processed after unregister */
|
||||||
|
/*
|
||||||
|
////////////////////////////// esp-idf 4.2 //////////////////////////
|
||||||
|
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, instance_got_ip));
|
||||||
|
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, instance_any_id));
|
||||||
|
////////////////////////// ENDE esp-idf 4.2 ///////////////////////////
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Deaktiveren, damit bei einen Verbindungsabbruch neu aufgebaut wird
|
||||||
|
ESP_ERROR_CHECK(esp_event_handler_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler));
|
||||||
|
ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler));
|
||||||
|
vEventGroupDelete(s_wifi_event_group);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
while (BlinkIsRunning)
|
||||||
|
{
|
||||||
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wifi_init_sta(const char *_ssid, const char *_password, const char *_hostname)
|
||||||
|
{
|
||||||
|
wifi_init_sta(_ssid, _password, _hostname, NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wifi_init_sta(const char *_ssid, const char *_password)
|
||||||
|
{
|
||||||
|
wifi_init_sta(_ssid, _password, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
16
code/components/jomjol_wlan/connect_wlan.h
Normal file
16
code/components/jomjol_wlan/connect_wlan.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#ifndef CONNECT_WLAN_H
|
||||||
|
#define CONNECT_WLAN_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
void wifi_init_sta(const char *_ssid, const char *_password, const char *_hostname, const char *_ipadr, const char *_gw, const char *_netmask, const char *_dns);
|
||||||
|
void wifi_init_sta(const char *_ssid, const char *_password, const char *_hostname);
|
||||||
|
void wifi_init_sta(const char *_ssid, const char *_password);
|
||||||
|
|
||||||
|
std::string getIPAddress();
|
||||||
|
std::string getSSID();
|
||||||
|
|
||||||
|
extern std::string hostname;
|
||||||
|
extern std::string std_hostname;
|
||||||
|
|
||||||
|
#endif
|
||||||
257
code/components/jomjol_wlan/read_wlanini.cpp
Normal file
257
code/components/jomjol_wlan/read_wlanini.cpp
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
#include "read_wlanini.h"
|
||||||
|
|
||||||
|
#include "Helper.h"
|
||||||
|
|
||||||
|
#include "connect_wlan.h"
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<string> ZerlegeZeile(std::string input, std::string _delimiter = "")
|
||||||
|
{
|
||||||
|
std::vector<string> Output;
|
||||||
|
std::string delimiter = " =,";
|
||||||
|
if (_delimiter.length() > 0){
|
||||||
|
delimiter = _delimiter;
|
||||||
|
}
|
||||||
|
|
||||||
|
input = trim(input, delimiter);
|
||||||
|
size_t pos = findDelimiterPos(input, delimiter);
|
||||||
|
std::string token;
|
||||||
|
while (pos != std::string::npos) {
|
||||||
|
token = input.substr(0, pos);
|
||||||
|
token = trim(token, delimiter);
|
||||||
|
Output.push_back(token);
|
||||||
|
input.erase(0, pos + 1);
|
||||||
|
input = trim(input, delimiter);
|
||||||
|
pos = findDelimiterPos(input, delimiter);
|
||||||
|
}
|
||||||
|
Output.push_back(input);
|
||||||
|
|
||||||
|
return Output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void LoadWlanFromFile(std::string fn, char *&_ssid, char *&_password, char *&_hostname, char *&_ipadr, char *&_gw, char *&_netmask, char *&_dns)
|
||||||
|
{
|
||||||
|
std::string ssid = "";
|
||||||
|
std::string passphrase = "";
|
||||||
|
std::string ipaddress = "";
|
||||||
|
std::string gw = "";
|
||||||
|
std::string netmask = "";
|
||||||
|
std::string dns = "";
|
||||||
|
|
||||||
|
std::string line = "";
|
||||||
|
std::vector<string> zerlegt;
|
||||||
|
hostname = std_hostname;
|
||||||
|
|
||||||
|
FILE* pFile;
|
||||||
|
fn = FormatFileName(fn);
|
||||||
|
|
||||||
|
pFile = OpenFileAndWait(fn.c_str(), "r");
|
||||||
|
printf("file loaded\n");
|
||||||
|
|
||||||
|
if (pFile == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
char zw[1024];
|
||||||
|
fgets(zw, 1024, pFile);
|
||||||
|
line = std::string(zw);
|
||||||
|
|
||||||
|
while ((line.size() > 0) || !(feof(pFile)))
|
||||||
|
{
|
||||||
|
// printf("%s", line.c_str());
|
||||||
|
zerlegt = ZerlegeZeile(line, "=");
|
||||||
|
zerlegt[0] = trim(zerlegt[0], " ");
|
||||||
|
for (int i = 2; i < zerlegt.size(); ++i)
|
||||||
|
zerlegt[1] = zerlegt[1] + zerlegt[i];
|
||||||
|
|
||||||
|
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "HOSTNAME")){
|
||||||
|
hostname = trim(zerlegt[1]);
|
||||||
|
if ((hostname[0] == '"') && (hostname[hostname.length()-1] == '"')){
|
||||||
|
hostname = hostname.substr(1, hostname.length()-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "SSID")){
|
||||||
|
ssid = trim(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] == '"')){
|
||||||
|
passphrase = passphrase.substr(1, passphrase.length()-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "IP")){
|
||||||
|
ipaddress = zerlegt[1];
|
||||||
|
if ((ipaddress[0] == '"') && (ipaddress[ipaddress.length()-1] == '"')){
|
||||||
|
ipaddress = ipaddress.substr(1, ipaddress.length()-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "GATEWAY")){
|
||||||
|
gw = zerlegt[1];
|
||||||
|
if ((gw[0] == '"') && (gw[gw.length()-1] == '"')){
|
||||||
|
gw = gw.substr(1, gw.length()-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "NETMASK")){
|
||||||
|
netmask = zerlegt[1];
|
||||||
|
if ((netmask[0] == '"') && (netmask[netmask.length()-1] == '"')){
|
||||||
|
netmask = netmask.substr(1, netmask.length()-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "DNS")){
|
||||||
|
dns = zerlegt[1];
|
||||||
|
if ((dns[0] == '"') && (dns[dns.length()-1] == '"')){
|
||||||
|
dns = dns.substr(1, dns.length()-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (fgets(zw, 1024, pFile) == NULL)
|
||||||
|
{
|
||||||
|
line = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
line = std::string(zw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(pFile);
|
||||||
|
|
||||||
|
// Check if Hostname was empty in .ini if yes set to std_hostname
|
||||||
|
if(hostname.length() >= 0){
|
||||||
|
hostname = std_hostname;
|
||||||
|
}
|
||||||
|
|
||||||
|
_hostname = new char[hostname.length() + 1];
|
||||||
|
strcpy(_hostname, hostname.c_str());
|
||||||
|
|
||||||
|
_ssid = new char[ssid.length() + 1];
|
||||||
|
strcpy(_ssid, ssid.c_str());
|
||||||
|
|
||||||
|
_password = new char[passphrase.length() + 1];
|
||||||
|
strcpy(_password, passphrase.c_str());
|
||||||
|
|
||||||
|
if (ipaddress.length() > 0)
|
||||||
|
{
|
||||||
|
_ipadr = new char[ipaddress.length() + 1];
|
||||||
|
strcpy(_ipadr, ipaddress.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_ipadr = NULL;
|
||||||
|
|
||||||
|
if (gw.length() > 0)
|
||||||
|
{
|
||||||
|
_gw = new char[gw.length() + 1];
|
||||||
|
strcpy(_gw, gw.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_gw = NULL;
|
||||||
|
|
||||||
|
if (netmask.length() > 0)
|
||||||
|
{
|
||||||
|
_netmask = new char[netmask.length() + 1];
|
||||||
|
strcpy(_netmask, netmask.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_netmask = NULL;
|
||||||
|
|
||||||
|
if (dns.length() > 0)
|
||||||
|
{
|
||||||
|
_dns = new char[dns.length() + 1];
|
||||||
|
strcpy(_dns, dns.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_dns = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool ChangeHostName(std::string fn, std::string _newhostname)
|
||||||
|
{
|
||||||
|
if (_newhostname == hostname)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
string line = "";
|
||||||
|
std::vector<string> zerlegt;
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
std::vector<string> neuesfile;
|
||||||
|
|
||||||
|
FILE* pFile;
|
||||||
|
fn = FormatFileName(fn);
|
||||||
|
pFile = OpenFileAndWait(fn.c_str(), "r");
|
||||||
|
|
||||||
|
printf("file loaded\n");
|
||||||
|
|
||||||
|
if (pFile == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
char zw[1024];
|
||||||
|
fgets(zw, 1024, pFile);
|
||||||
|
line = std::string(zw);
|
||||||
|
|
||||||
|
while ((line.size() > 0) || !(feof(pFile)))
|
||||||
|
{
|
||||||
|
printf("%s", line.c_str());
|
||||||
|
zerlegt = ZerlegeZeile(line, "=");
|
||||||
|
zerlegt[0] = trim(zerlegt[0], " ");
|
||||||
|
|
||||||
|
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "HOSTNAME")){
|
||||||
|
line = "hostname = \"" + _newhostname + "\"\n";
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
neuesfile.push_back(line);
|
||||||
|
|
||||||
|
if (fgets(zw, 1024, pFile) == NULL)
|
||||||
|
{
|
||||||
|
line = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
line = std::string(zw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
line = "\nhostname = \"" + _newhostname + "\"\n";
|
||||||
|
neuesfile.push_back(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(pFile);
|
||||||
|
|
||||||
|
pFile = OpenFileAndWait(fn.c_str(), "w+");
|
||||||
|
|
||||||
|
for (int i = 0; i < neuesfile.size(); ++i)
|
||||||
|
{
|
||||||
|
printf(neuesfile[i].c_str());
|
||||||
|
fputs(neuesfile[i].c_str(), pFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(pFile);
|
||||||
|
|
||||||
|
printf("*** Update hostname done ***\n");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
11
code/components/jomjol_wlan/read_wlanini.h
Normal file
11
code/components/jomjol_wlan/read_wlanini.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef READ_WLANINI_H
|
||||||
|
#define READ_WLANINI_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
void LoadWlanFromFile(std::string fn, char *&_ssid, char *&_password, char *&_hostname, char *&_ipadr, char *&_gw, char *&_netmask, char *&_dns);
|
||||||
|
|
||||||
|
bool ChangeHostName(std::string fn, std::string _newhostname);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
2
code/dependencies.lock
Normal file
2
code/dependencies.lock
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
manifest_hash: 45994dbfed009907994c31f6d279c5861a1eacbf219ce8b58e74e39b3393816a
|
||||||
|
version: 1.0.0
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "ClassLogFile.h"
|
#include "ClassLogFile.h"
|
||||||
|
|
||||||
#include "connect_wlan.h"
|
#include "connect_wlan.h"
|
||||||
|
#include "read_wlanini.h"
|
||||||
|
|
||||||
#include "server_tflite.h"
|
#include "server_tflite.h"
|
||||||
#include "server_file.h"
|
#include "server_file.h"
|
||||||
@@ -67,8 +68,10 @@ bool Init_NVS_SDCard()
|
|||||||
// does make a difference some boards, so we do that here.
|
// does make a difference some boards, so we do that here.
|
||||||
gpio_set_pull_mode(GPIO_NUM_15, GPIO_PULLUP_ONLY); // CMD, needed in 4- and 1- line modes
|
gpio_set_pull_mode(GPIO_NUM_15, GPIO_PULLUP_ONLY); // CMD, needed in 4- and 1- line modes
|
||||||
gpio_set_pull_mode(GPIO_NUM_2, GPIO_PULLUP_ONLY); // D0, needed in 4- and 1-line modes
|
gpio_set_pull_mode(GPIO_NUM_2, GPIO_PULLUP_ONLY); // D0, needed in 4- and 1-line modes
|
||||||
|
#ifndef __SD_USE_ONE_LINE_MODE__
|
||||||
gpio_set_pull_mode(GPIO_NUM_4, GPIO_PULLUP_ONLY); // D1, needed in 4-line mode only
|
gpio_set_pull_mode(GPIO_NUM_4, GPIO_PULLUP_ONLY); // D1, needed in 4-line mode only
|
||||||
gpio_set_pull_mode(GPIO_NUM_12, GPIO_PULLUP_ONLY); // D2, needed in 4-line mode only
|
gpio_set_pull_mode(GPIO_NUM_12, GPIO_PULLUP_ONLY); // D2, needed in 4-line mode only
|
||||||
|
#endif
|
||||||
gpio_set_pull_mode(GPIO_NUM_13, GPIO_PULLUP_ONLY); // D3, needed in 4- and 1-line modes
|
gpio_set_pull_mode(GPIO_NUM_13, GPIO_PULLUP_ONLY); // D3, needed in 4- and 1-line modes
|
||||||
|
|
||||||
// Options for mounting the filesystem.
|
// Options for mounting the filesystem.
|
||||||
@@ -104,6 +107,7 @@ bool Init_NVS_SDCard()
|
|||||||
|
|
||||||
// Init the GPIO
|
// Init the GPIO
|
||||||
// Flash ausschalten
|
// Flash ausschalten
|
||||||
|
|
||||||
gpio_pad_select_gpio(FLASH_GPIO);
|
gpio_pad_select_gpio(FLASH_GPIO);
|
||||||
gpio_set_direction(FLASH_GPIO, GPIO_MODE_OUTPUT);
|
gpio_set_direction(FLASH_GPIO, GPIO_MODE_OUTPUT);
|
||||||
gpio_set_level(FLASH_GPIO, 0);
|
gpio_set_level(FLASH_GPIO, 0);
|
||||||
@@ -147,9 +151,26 @@ extern "C" void app_main(void)
|
|||||||
|
|
||||||
CheckOTAUpdate();
|
CheckOTAUpdate();
|
||||||
|
|
||||||
LoadWlanFromFile("/sdcard/wlan.ini");
|
char *ssid = NULL, *passwd = NULL, *hostname = NULL, *ip = NULL, *gateway = NULL, *netmask = NULL, *dns = NULL;
|
||||||
ConnectToWLAN();
|
LoadWlanFromFile("/sdcard/wlan.ini", ssid, passwd, hostname, ip, gateway, netmask, dns);
|
||||||
printf("\nNetparameter: IP: %s - GW: %s - NetMask %s\n", getIPAddress().c_str(), getGW().c_str(), getNetMask().c_str());
|
|
||||||
|
if (ssid != NULL && passwd != NULL)
|
||||||
|
printf("\nWLan: %s, %s\n", ssid, passwd);
|
||||||
|
else
|
||||||
|
printf("No SSID and PASSWORD set!!!");
|
||||||
|
|
||||||
|
if (hostname != NULL)
|
||||||
|
printf("Hostename: %s\n", hostname);
|
||||||
|
else
|
||||||
|
printf("Hostname not set.\n");
|
||||||
|
|
||||||
|
if (ip != NULL && gateway != NULL && netmask != NULL)
|
||||||
|
printf("Fixed IP: %s, Gateway %s, Netmask %s\n", ip, gateway, netmask);
|
||||||
|
if (dns != NULL)
|
||||||
|
printf("DNS IP: %s\n", dns);
|
||||||
|
|
||||||
|
|
||||||
|
wifi_init_sta(ssid, passwd, hostname, ip, gateway, netmask, dns);
|
||||||
|
|
||||||
TickType_t xDelay;
|
TickType_t xDelay;
|
||||||
xDelay = 2000 / portTICK_PERIOD_MS;
|
xDelay = 2000 / portTICK_PERIOD_MS;
|
||||||
@@ -181,8 +202,10 @@ extern "C" void app_main(void)
|
|||||||
#ifdef __SD_USE_ONE_LINE_MODE__
|
#ifdef __SD_USE_ONE_LINE_MODE__
|
||||||
register_server_GPIO_uri(server);
|
register_server_GPIO_uri(server);
|
||||||
#endif
|
#endif
|
||||||
|
printf("vor reg server main\n");
|
||||||
|
|
||||||
register_server_main_uri(server, "/sdcard");
|
register_server_main_uri(server, "/sdcard");
|
||||||
|
|
||||||
|
printf("vor dotautostart\n");
|
||||||
TFliteDoAutoStart();
|
TFliteDoAutoStart();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ esp_err_t info_get_handler(httpd_req_t *req)
|
|||||||
if (_task.compare("Hostname") == 0)
|
if (_task.compare("Hostname") == 0)
|
||||||
{
|
{
|
||||||
std::string zw;
|
std::string zw;
|
||||||
zw = std::string(getHostname());
|
zw = std::string(hostname);
|
||||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||||
httpd_resp_sendstr_chunk(req, NULL);
|
httpd_resp_sendstr_chunk(req, NULL);
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="1e09bfb";
|
const char* GIT_REV="a000252";
|
||||||
const char* GIT_TAG="";
|
const char* GIT_TAG="";
|
||||||
const char* GIT_BRANCH="master";
|
const char* GIT_BRANCH="master";
|
||||||
const char* BUILD_TIME="2021-05-08 18:20";
|
const char* BUILD_TIME="2021-05-28 19:54";
|
||||||
@@ -13,7 +13,7 @@ extern "C"
|
|||||||
#include "Helper.h"
|
#include "Helper.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
const char* GIT_BASE_BRANCH = "master - v7.0.0 - 2020-05-08";
|
const char* GIT_BASE_BRANCH = "master - v7.1.0 - 2020-05-28";
|
||||||
|
|
||||||
|
|
||||||
const char* git_base_branch(void)
|
const char* git_base_branch(void)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ board_build.partitions = partitions.csv
|
|||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
jomjol_helper
|
jomjol_helper
|
||||||
connect_wlan
|
jomjol_wlan
|
||||||
jomjol_image_proc
|
jomjol_image_proc
|
||||||
jomjol_controlcamera
|
jomjol_controlcamera
|
||||||
jomjol_flowcontroll
|
jomjol_flowcontroll
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="1e09bfb";
|
const char* GIT_REV="a000252";
|
||||||
const char* GIT_TAG="";
|
const char* GIT_TAG="";
|
||||||
const char* GIT_BRANCH="master";
|
const char* GIT_BRANCH="master";
|
||||||
const char* BUILD_TIME="2021-05-08 18:20";
|
const char* BUILD_TIME="2021-05-28 19:53";
|
||||||
Binary file not shown.
Binary file not shown.
@@ -18,7 +18,7 @@ InitialMirror= false
|
|||||||
AlignmentAlgo = Default
|
AlignmentAlgo = Default
|
||||||
|
|
||||||
[Digits]
|
[Digits]
|
||||||
Model = /config/dig0850s1q.tflite
|
Model = /config/dig0870s3q.tflite
|
||||||
;LogImageLocation = /log/digit
|
;LogImageLocation = /log/digit
|
||||||
;LogfileRetentionInDays = 3
|
;LogfileRetentionInDays = 3
|
||||||
ModelInputSize = 20 32
|
ModelInputSize = 20 32
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
sd-card/config/dig0870s3q.tflite
Normal file
BIN
sd-card/config/dig0870s3q.tflite
Normal file
Binary file not shown.
Reference in New Issue
Block a user