Compare commits

...

53 Commits

Author SHA1 Message Date
jomjol
20b054472e Update 2021-04-05 10:17:54 +02:00
jomjol
21a70c5655 Merge pull request #175 from jomjol/rolling
Update to v6.6.1
2021-04-05 10:12:59 +02:00
jomjol
08270f5d6d Update to v6.6.1 2021-04-05 10:12:21 +02:00
jomjol
9923be2f1d Merge pull request #171 from jomjol/master
Sync Rolling
2021-03-28 20:12:17 +02:00
jomjol
5df57c95d4 Update to v6.6.0 2021-03-28 20:11:22 +02:00
jomjol
d8c91466d0 Merge pull request #170 from jomjol/rolling
Update to v6.6.0
2021-03-28 20:08:46 +02:00
jomjol
37b2e370fe Prepare v6.6.0 2021-03-28 20:08:02 +02:00
jomjol
98dfba0640 Rolling 20210327 2021-03-27 17:16:54 +01:00
jomjol
574c9084c2 Merge pull request #166 from jomjol/master
Sync Rolling
2021-03-25 21:01:25 +01:00
jomjol
9862ae8e7a Update to v6.5.0 2021-03-25 20:58:44 +01:00
jomjol
7bc4e63209 Merge pull request #165 from jomjol/rolling
Update to v6.5.0
2021-03-25 20:51:30 +01:00
jomjol
ad40150cfa Update 2021-03-25 20:50:10 +01:00
jomjol
970530d99f Update Rolling to v6.5.0 2021-03-25 20:48:19 +01:00
jomjol
c6ae989b82 Update Restart Hostname 2021-03-21 20:56:30 +01:00
jomjol
a0ebf354b1 Create focus_adjustment.jpg 2021-03-21 19:52:23 +01:00
jomjol
97ecbc792e Create focus_adjustment.jpg 2021-03-21 19:50:01 +01:00
jomjol
5934a59489 Update 2021-03-21 19:41:34 +01:00
jomjol
ee18046581 Rolling 20210321 2021-03-21 19:24:20 +01:00
jomjol
1e4e38c02f Merge pull request #158 from jomjol/master
Update rolling to v6.4.0
2021-03-21 12:56:08 +01:00
jomjol
7a3038eceb Update FeatureRequest.md 2021-03-21 12:49:23 +01:00
jomjol
7d2f86b72e Update README.md 2021-03-21 12:45:52 +01:00
jomjol
3aaa319505 Update README.md 2021-03-21 12:45:03 +01:00
jomjol
f4075f0a51 Create FeatureRequest.md 2021-03-21 12:39:28 +01:00
jomjol
59643a8d52 Update README.md 2021-03-21 11:44:46 +01:00
jomjol
baf2a880e4 Merge pull request #157 from jomjol/master
Align Rolling to v6.4.0
2021-03-20 09:49:22 +01:00
jomjol
d71e8320c7 Update to v6.4.0 2021-03-20 09:47:50 +01:00
jomjol
3b3d924f40 final update 2021-03-16 21:14:09 +01:00
jomjol
60701bc007 Merge branch 'rolling' into master 2021-03-16 21:10:07 +01:00
jomjol
5ca3e184e0 Prepare v6.3.1 2021-03-16 21:02:27 +01:00
jomjol
2903d1a0a6 Update 2021-03-14 12:59:14 +01:00
jomjol
5f0f1802a4 Merge pull request #150 from jomjol/rolling
Rolling
2021-03-14 12:55:44 +01:00
jomjol
5be56d9b00 Prepare for 6.3.0 2021-03-14 12:52:23 +01:00
jomjol
d3fd1b5045 Rollling 20210313 2021-03-13 17:48:12 +01:00
jomjol
4615e87483 Merge pull request #147 from jomjol/rolling
Rolling
2021-03-10 21:16:41 +01:00
jomjol
fb9b72deea v6.2.2 2021-03-10 21:15:47 +01:00
jomjol
5cc873a6bb Merge pull request #141 from jomjol/master
Synch Master to Rolling
2021-03-09 21:11:05 +01:00
jomjol
26745496a5 Update to 6.2.1 2021-03-09 21:09:59 +01:00
jomjol
4537725852 Update Firmware 2021-03-08 20:32:58 +01:00
jomjol
676bda22ae Merge pull request #138 from jomjol/rolling
Update to v6.2.0
2021-03-08 20:28:46 +01:00
jomjol
87028e5f35 Merge branch 'master' into rolling 2021-03-08 20:28:16 +01:00
jomjol
912083d20f Prepare for Update to v6.2.0 2021-03-08 20:26:52 +01:00
jomjol
4b6044dade Rolling 2021-03-06 2021-03-06 21:20:02 +01:00
jomjol
871d3b537d rolling 2021-03-06 2021-03-06 20:10:31 +01:00
jomjol
01f8a514a1 Revert 2021-03-01 07:24:17 +01:00
jomjol
7dbd77d2a4 Revert "Update rolling"
This reverts commit 94dde53c21.
2021-03-01 07:16:15 +01:00
jomjol
94dde53c21 Update rolling 2021-02-28 18:40:55 +01:00
jomjol
e47eaa3ac3 Merge pull request #128 from jomjol/rolling-camera-speedup
Rolling camera speedup
2021-02-27 13:16:38 +01:00
jomjol
4060299204 update 2021-02-27 13:15:49 +01:00
jomjol
70a99927cd update 2021-02-27 13:15:03 +01:00
jomjol
688cee9463 Update 2021-02-27 12:51:50 +01:00
jomjol
9dbad050fd Rolling 2021-02-03 21:26:00 +01:00
jomjol
87202115d0 Update Rolling 2021-01-23 22:30:19 +01:00
jomjol
abc4cb444a Merge pull request #96 from jomjol/master
Rolling to v6.1.0
2021-01-20 19:53:35 +01:00
53 changed files with 1597 additions and 533 deletions

1
.gitignore vendored
View File

@@ -2,7 +2,6 @@
.pio/
.vscode/
.code-workspace
.helper/
/sd-card/htm./.vscode/
/code/build

View File

@@ -1,6 +1,130 @@
# Versions
##### 5.0.0 Setup Modus - (2020-12-06)
* Implementation of initial setup modus for fresh installation
* Code restructuring (full compatibility between pure ESP-IDF and Platformio w/ espressif)
##### 4.1.1 Configuration editor - (2020-12-02)
* Bug fixing: internal improvement of file handling (reduce not responding)
##### 4.1.0 Configuration editor - (2020-11-30)
* Implementation of configuration editor (including basic and expert mode)
* Adjustable time zone to adjust to local time setting (incl. daylight saving time)
* MQTT: additional topic for error reporting
* standardized access to current logfile via `http://IP-ADRESS/logfileact`
* Update digital CNN to v7.2.0, analog CNN to 6.3.0
* Bug fixing: truncation error, CheckDigitConsistency & PreValue implementation
##### 4.0.0 Tflite Core - (2020-11-15)
* Implementation of rolling log-files
* Update Tflite-Core to master@20201108 (v2.4)
* Bug-fixing for reducing reboots
##### 3.1.0 MQTT-Client - (2020-10-26)
* Update digital CNN to v6.5.0 and HTML (Info to hostname, IP, ssid)
* New implementation of "checkDigitConsistency" also for digits
* MQTT-Adapter: user and password for sign in MQTT-Broker
##### 3.0.0 MQTT-Client (2020-10-14)
* Implementation of MQTT Client
* Improved Version Control
* bug-fixing
##### 2.2.1 Version Control (2020-09-27)
* Bug-Fixing (hostname in wlan.ini and error handling inside flow)
##### 2.2.0 Version Control (2020-09-27)
* Integrated automated versioning system (menu: SYSTEM --> INFO)
* Update Build-System to PlatformIO - Espressif 32 v2.0.0 (ESP-IDF 4.1)
##### 2.1.0 Decimal Shift, Chrome & Edge (2020-09-25)
* Implementation of Decimal Shift
* Update default CNN for digits to v6.4.0
* Improvement HTML
* Support for Chrome and Edge
* Reduce logging to minimum - extended logging on demand
* Implementation of hostname in wlan.ini (`hostname = "HOSTNAME")`
* Bug fixing, code corrections
##### 2.0.0 Layout update (2020-09-12)
* Update to **new and modern layout**
* Support for Chrome improved
* Improved robustness: improved error handling in auto flow reduces spontaneous reboots
* File server: Option for "DELETE ALL"
* WLan: support of spaces in SSID and password
* Reference Image: Option for mirror image, option for image update on the fly
* additional parameter in `wasserzaehler.html?noerror=true` to suppress an potential error message
* bug fixing
##### 1.1.3 (2020-09-09)
* **Bug in configuration of analog ROIs corrected** - correction in v.1.0.2 did not work properly
* Improved update page for the web server (`/html` can be updated via a zip-file, which is provided in `/firmware/html.zip`)
* Improved Chrome support
##### 1.1.0 (2020-09-06)
* Implementation of "delete complete directory"
**Attention: beside the `firmware.bin`, also the content of `/html` needs to be updated!**
##### 1.0.2 (2020-09-06)
* Bug in configuration of analog ROIs corrected
* minor bug correction
##### 1.0.1 (2020-09-05)
* preValue.ini Bug corrected
* minor bug correction
##### 1.0.0 (2020-09-04)
* **First usable version** - compatible to previous project (https://github.com/jomjol/water-meter-system-complete)
* NEW:
* no docker container for CNN calculation necessary
* web based configuration editor on board
##### 0.1.0 (2020-08-07)
* Initial Version

72
FeatureRequest.md Normal file
View File

@@ -0,0 +1,72 @@
## Feature Requests
**There are a lot of ideas for further improvements, but only limited capacity on side of the developer.** Therefore I have created this page as a collection of ideas.
1. Who ever has a new idea can put it here, so it that it is not forgotten.
2. Who ever has time, capacity and passion to support, can take any of the ideas and implement them.
I will support and help where ever I can!
____
#### #4 Initial Shifting and Rotation
* https://github.com/jomjol/AI-on-the-edge-device/issues/123
Implementation of a shifting additional to the initial rotation of the raw camera input
To do:
* Implementation of shifting
* Extension of configuration
* Adaption of the html configuration to implement shifting
#### #3 Allow grouping of digits to multiple reading values
* https://github.com/jomjol/AI-on-the-edge-device/issues/123
Implementation of two different independent readouts in one setup
To do:
* Extend the configuration, setting and processing flow for two independend readouts
https://github.com/jomjol/AI-on-the-edge-device/issues/123
____
#### #2 MQTT-controll with callback
* https://github.com/jomjol/AI-on-the-edge-device/issues/105
Extend the MQTT client to also enable callbacks for configuration setting
To do:
* implement callback for receiving information and override `config.ini` settings
* change configuration management to handle online updates (currently changes need a restart)
* think about the startup, as there the default config is loaded
____
#### #1 Optional GPIO for external flash/lighting
* https://github.com/jomjol/AI-on-the-edge-device/issues/133
Implementation of an an extrnal flash / lightning through GPIOs.
* available GPIOs: 12 & 13 (currently in use for html switching)
To do:
* Implementation of a software module for external light source (e.g. WS8132 LED controller, ...)
* Update of the camera module to use the external light instead of the internal flash light
* Adopt the configuration algorithm with a configurable light source

177
README.md
View File

@@ -41,6 +41,43 @@ If you would like to support the developer with a cup of coffee you can do that
##### 6.6.1 Image Processing in Memory - (2021-04-05)
* NEW 6.6.1: failed SD card initialization indicated by fast blinking LED at startup
* Improved SD-card handling (increase compatibility with more type of cards)
##### 6.5.0 Image Processing in Memory - (2021-03-25)
* Upgrade digital CNN to v8.2.0 (added new type of digits)
* Supporting alignment structures in ROI definition
* Bug fixing: definition of hostname in `config.ini`
##### 6.4.0 Image Processing in Memory - (2021-03-20)
* Additional alignment marks for settings the ROIs (analog and digit)
* Upgrade analog CNN to v7.0.0 (added new type of pointer)
##### 6.3.1 Image Processing in Memory - (2021-03-16)
* NEW: 6.3.1: bug fixing in initial edit reference image and `config.ini` (Spelling error in `InitialRotate`)
* Initial setup mode: bug fixing, error correction
* Bug-fixing
##### 6.2.2 Image Processing in Memory - (2021-03-10)
* NEW 6.2.2: bug fixing
* NEW 6.2.1: Changed brightness and contrast to default if not enabled (resolves to bright images)
* Determination of fixed illumination settings during startup - speed up of 5s in each run
* Update digital CNN to v8.1.1 (additional digital images trained)
* Extended error message in MQTT error message
* Image brightness is now adjustable
* Bug fixing: minor topics
##### 6.1.0 Image Processing in Memory - (2021-01-20)
* Disabling of analog / digital counters in configuration
@@ -55,151 +92,43 @@ If you would like to support the developer with a cup of coffee you can do that
* **Major change**: image processing fully in memory - no need of SD card buffer anymore
* Need to limit camera resolution to VGA (due to memory limits)
* MQTT: Last Will Testament (LWT) implemented: "connection lost" in case of connection lost to `TopicError`
* Disabled `CheckDigitIncreaseConsistency` in default configuration - must now be explicit enabled if needed
* Update digital CNN to v7.2.1 (additional digital images trained)
* Setting of arbitrary time server in `config.ini`
* Option for fixed IP-, DNS-Settings in `wlan.ini`
* Increased stability (internal image and camera handling)
* Bug fixing: edit digits, handling PreValue, html-bugs
## Additional ideas
There are some ideas and feature request, which are not followed currently - mainly due to capacity reasons on side of the developer. They are collected here: [FeatureRequest.md](FeatureRequest.md)
------
## History
##### 5.0.0 Setup Modus - (2020-12-06)
* Implementation of initial setup modus for fresh installation
* Code restructuring (full compatibility between pure ESP-IDF and Platformio w/ espressif)
##### 4.1.1 Configuration editor - (2020-12-02)
* Bug fixing: internal improvement of file handling (reduce not responding)
##### 4.1.0 Configuration editor - (2020-11-30)
* Implementation of configuration editor (including basic and expert mode)
* Adjustable time zone to adjust to local time setting (incl. daylight saving time)
* MQTT: additional topic for error reporting
* standardized access to current logfile via `http://IP-ADRESS/logfileact`
* Update digital CNN to v7.2.0, analog CNN to 6.3.0
* Bug fixing: truncation error, CheckDigitConsistency & PreValue implementation
##### 4.0.0 Tflite Core - (2020-11-15)
* Implementation of rolling log-files
* Update Tflite-Core to master@20201108 (v2.4)
* Bug-fixing for reducing reboots
##### 3.1.0 MQTT-Client - (2020-10-26)
* Update digital CNN to v6.5.0 and HTML (Info to hostname, IP, ssid)
* New implementation of "checkDigitConsistency" also for digits
* MQTT-Adapter: user and password for sign in MQTT-Broker
##### 3.0.0 MQTT-Client (2020-10-14)
* Implementation of MQTT Client
* Improved Version Control
* bug-fixing
##### 2.2.1 Version Control - (2020-09-27)
##### 2.2.1 Version Control (2020-09-27)
* Bug-Fixing (hostname in wlan.ini and error handling inside flow)
##### 2.1.0 Decimal Shift, Chrome & Edge - (2020-09-25)
##### 2.2.0 Version Control (2020-09-27)
##### 2.0.0 Layout update - (2020-09-12)
* Integrated automated versioning system (menu: SYSTEM --> INFO)
* Update Build-System to PlatformIO - Espressif 32 v2.0.0 (ESP-IDF 4.1)
##### 2.1.0 Decimal Shift, Chrome & Edge (2020-09-25)
* Implementation of Decimal Shift
* Update default CNN for digits to v6.4.0
* Improvement HTML
* Support for Chrome and Edge
* Reduce logging to minimum - extended logging on demand
* Implementation of hostname in wlan.ini (`hostname = "HOSTNAME")`
* Bug fixing, code corrections
##### 2.0.0 Layout update (2020-09-12)
* Update to **new and modern layout**
* Support for Chrome improved
* Improved robustness: improved error handling in auto flow reduces spontaneous reboots
* File server: Option for "DELETE ALL"
* WLan: support of spaces in SSID and password
* Reference Image: Option for mirror image, option for image update on the fly
* additional parameter in `wasserzaehler.html?noerror=true` to suppress an potential error message
* bug fixing
##### 1.1.3 (2020-09-09)
* **Bug in configuration of analog ROIs corrected** - correction in v.1.0.2 did not work properly
* Improved update page for the web server (`/html` can be updated via a zip-file, which is provided in `/firmware/html.zip`)
* Improved Chrome support
##### 1.1.0 (2020-09-06)
* Implementation of "delete complete directory"
**Attention: beside the `firmware.bin`, also the content of `/html` needs to be updated!**
##### 1.0.2 (2020-09-06)
* Bug in configuration of analog ROIs corrected
* minor bug correction
##### 1.0.1 (2020-09-05)
* preValue.ini Bug corrected
* minor bug correction
##### 1.0.0 (2020-09-04)
* **First usable version** - compatible to previous project (https://github.com/jomjol/water-meter-system-complete)
* NEW:
* no docker container for CNN calculation necessary
* web based configuration editor on board
##### 0.1.0 (2020-08-07)
* Initial Version
##### 1.1.3 Initial Version - (2020-09-09)
#### [Full Changelog](Changelog.md)

1
code/.helper/makezip.bat Normal file
View File

@@ -0,0 +1 @@
powershell Compress-Archive "C:\Users\Muell\Documents\Programmieren\GitHub\AI-on-the-edge-device\sd-card\html\*.*" "C:\Users\Muell\Documents\Programmieren\GitHub\AI-on-the-edge-device\firmware\html.zip"

View File

@@ -0,0 +1,539 @@
#include "connect_wlan.h"
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_wifi.h"
#include "esp_log.h"
#include <fstream>
#include <vector>
#include <sstream>
#include "Helper.h"
static const char *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";
#define BLINK_GPIO GPIO_NUM_33
static EventGroupHandle_t s_wifi_event_group;
#define WIFI_CONNECTED_BIT BIT0
#define WIFI_FAIL_BIT BIT1
static int s_retry_num = 0;
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 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);
}
}
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;
}
static void event_handler_neu(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) {
blinkstatus(200, 1);
esp_wifi_connect();
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
blinkstatus(200, 5);
esp_wifi_connect();
s_retry_num++;
ESP_LOGI(TAG, "retry to connect to the AP");
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
blinkstatus(1000, 3);
ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data;
ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip));
s_retry_num = 0;
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
}
}
void initialise_wifi()
{
s_wifi_event_group = xEventGroupCreate();
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_create_default_wifi_sta();
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
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_neu,
NULL,
&instance_any_id));
ESP_ERROR_CHECK(esp_event_handler_instance_register(IP_EVENT,
IP_EVENT_STA_GOT_IP,
&event_handler_neu,
NULL,
&instance_got_ip));
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(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.c_str(), passphrase.c_str());
} else if (bits & WIFI_FAIL_BIT) {
ESP_LOGI(TAG, "Failed to connect to SSID:%s, password:%s",
ssid.c_str(), passphrase.c_str());
} else {
ESP_LOGE(TAG, "UNEXPECTED EVENT");
}
// The event will not be processed after unregister
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));
vEventGroupDelete(s_wifi_event_group);
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 initialise_wifi_fixed_ip2()
{
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();
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_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_neu,
NULL,
&instance_any_id));
ESP_ERROR_CHECK(esp_event_handler_instance_register(IP_EVENT,
IP_EVENT_STA_GOT_IP,
&event_handler_neu,
NULL,
&instance_got_ip));
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(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.c_str(), passphrase.c_str());
} else if (bits & WIFI_FAIL_BIT) {
ESP_LOGI(TAG, "Failed to connect to SSID:%s, password:%s",
ssid.c_str(), passphrase.c_str());
} else {
ESP_LOGE(TAG, "UNEXPECTED EVENT");
}
// The event will not be processed after unregister
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));
vEventGroupDelete(s_wifi_event_group);
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));
}
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_ip2();
}
}
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 = "hostname = \"" + _newhostname + "\"\n";
neuesfile.push_back(line);
}
fclose(pFile);
pFile = OpenFileAndWait(fn.c_str(), "w+");
for (int i = 0; i < neuesfile.size(); ++i)
{
fputs(neuesfile[i].c_str(), pFile);
}
fclose(pFile);
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[i] = zerlegt[i-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");
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;
}

View File

@@ -0,0 +1,21 @@
//#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

View File

@@ -23,14 +23,13 @@
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 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;
@@ -76,6 +75,8 @@ void wifi_connect(){
ESP_ERROR_CHECK( esp_wifi_connect() );
}
void blinkstatus(int dauer, int _anzahl)
{
gpio_reset_pin(BLINK_GPIO);
@@ -111,13 +112,11 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
return ESP_OK;
}
void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _hostname)
void initialise_wifi()
{
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();
@@ -147,14 +146,9 @@ void strinttoip4(std::string ip, int &a, int &b, int &c, int &d) {
s >> a >> ch >> b >> ch >> c >> ch >> d;
}
void initialise_wifi_fixed_ip(std::string _ip, std::string _gw, std::string _netmask, std::string _ssid, std::string _passphrase, std::string _hostname, std::string _dns)
void initialise_wifi_fixed_ip()
{
ssid = _ssid;
passphrase = _passphrase;
hostname = _hostname;
dns = _dns;
wifi_event_group = xEventGroupCreate();
ESP_ERROR_CHECK(esp_netif_init());
@@ -168,13 +162,13 @@ void initialise_wifi_fixed_ip(std::string _ip, std::string _gw, std::string _net
int a, b, c, d;
strinttoip4(_ip, 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);
strinttoip4(gw, a, b, c, d);
IP4_ADDR(&ip_info.gw, a, b, c, d);
strinttoip4(_netmask, 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);
@@ -221,6 +215,23 @@ void initialise_wifi_fixed_ip(std::string _ip, std::string _gw, std::string _net
}
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)
@@ -281,25 +292,28 @@ bool ChangeHostName(std::string fn, std::string _newhostname)
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, std::string &_ssid, std::string &_passphrase, std::string &_hostname)
void LoadWlanFromFile(std::string fn)
{
string line = "";
std::vector<string> zerlegt;
_hostname = std_hostname;
hostname = std_hostname;
FILE* pFile;
fn = FormatFileName(fn);
pFile = OpenFileAndWait(fn.c_str(), "r");
pFile = OpenFileAndWait(fn.c_str(), "r");
printf("file loaded\n");
if (pFile == NULL)
@@ -318,26 +332,55 @@ void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphra
zerlegt[i] = zerlegt[i-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);
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);
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);
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 = "";
@@ -351,9 +394,14 @@ void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphra
fclose(pFile);
// Check if Hostname was empty in .ini if yes set to std_hostname
if(_hostname.length() <= 0){
_hostname = 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)

View File

@@ -5,13 +5,9 @@
#include "driver/gpio.h"
const int CONNECTED_BIT = BIT0;
void ConnectToWLAN();
void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _hostname);
void initialise_wifi_fixed_ip(std::string _ip, std::string _gw, std::string _netmask, std::string _ssid, std::string _passphrase, std::string _hostname, std::string _dns = "");
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase, std::string &_hostname);
void LoadNetConfigFromFile(std::string fn, std::string &_ip, std::string &_gw, std::string &_netmask, std::string &_dns);
void LoadWlanFromFile(std::string fn);
bool ChangeHostName(std::string fn, std::string _newhostname);

View File

@@ -750,7 +750,7 @@ static void IRAM_ATTR dma_filter_buffer(size_t buf_idx)
if(s_state->sensor.pixformat == PIXFORMAT_JPEG) {
uint32_t sig = *((uint32_t *)s_state->fb->buf) & 0xFFFFFF;
if(sig != 0xffd8ff) {
ets_printf("bh 0x%08x\n", sig);
ESP_LOGD(TAG,"unexpected JPEG signature 0x%08x\n", sig);
s_state->fb->bad = 1;
return;
}

View File

@@ -7,6 +7,7 @@
*
*/
#include <stdbool.h>
#include <string.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include "sccb.h"
@@ -42,6 +43,7 @@ int SCCB_Init(int pin_sda, int pin_scl)
ESP_LOGI(TAG, "pin_sda %d pin_scl %d\n", pin_sda, pin_scl);
//log_i("SCCB_Init start");
i2c_config_t conf;
memset(&conf, 0, sizeof(i2c_config_t));
conf.mode = I2C_MODE_MASTER;
conf.sda_io_num = pin_sda;
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;

View File

@@ -6,7 +6,7 @@
// 1. Board setup (Uncomment):
// #define BOARD_WROVER_KIT
#define BOARD_ESP32CAM_AITHINKER
// #define BOARD_ESP32CAM_AITHINKER
/**
* 2. Kconfig setup

View File

@@ -136,6 +136,42 @@ static size_t jpg_encode_stream(void * arg, size_t index, const void* data, size
return len;
}
bool CCamera::SetBrightnessContrastSaturation(int _brightness, int _contrast, int _saturation)
{
bool result = false;
sensor_t * s = esp_camera_sensor_get();
if (_brightness > -100)
_brightness = min(2, max(-2, _brightness));
if (_contrast > -100)
_contrast = min(2, max(-2, _contrast));
// _saturation = min(2, max(-2, _saturation));
// s->set_saturation(s, _saturation);
if (_contrast > -100)
s->set_contrast(s, _contrast);
if (_brightness > -100)
s->set_brightness(s, _brightness);
if ((_brightness != brightness) && (_brightness > -100))
result = true;
if ((_contrast != contrast) && (_contrast > -100))
result = true;
if ((_saturation != saturation) && (_saturation > -100))
result = true;
if (_brightness > -100)
brightness = _brightness;
if (_contrast > -100)
contrast = _contrast;
if (_saturation > -100)
saturation = _saturation;
if (result && isFixedExposure)
EnableAutoExposure(waitbeforepicture_org);
return result;
}
void CCamera::SetQualitySize(int qual, framesize_t resol)
{
@@ -181,6 +217,31 @@ void CCamera::SetQualitySize(int qual, framesize_t resol)
}
void CCamera::EnableAutoExposure(int flashdauer)
{
LEDOnOff(true);
LightOnOff(true);
const TickType_t xDelay = flashdauer / portTICK_PERIOD_MS;
vTaskDelay( xDelay );
camera_fb_t * fb = esp_camera_fb_get();
if (!fb) {
ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed");
}
esp_camera_fb_return(fb);
sensor_t * s = esp_camera_sensor_get();
s->set_gain_ctrl(s, 0);
s->set_exposure_ctrl(s, 0);
LEDOnOff(false);
LightOnOff(false);
isFixedExposure = true;
waitbeforepicture_org = flashdauer;
}
esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
{
@@ -223,7 +284,7 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After fb_get");
#endif
LEDOnOff(false);
LEDOnOff(false);
if (delay > 0)
LightOnOff(false);
@@ -513,6 +574,10 @@ CCamera::CCamera()
#ifdef DEBUG_DETAIL_ON
printf("CreateClassCamera\n");
#endif
brightness = -5;
contrast = -5;
saturation = -5;
isFixedExposure = false;
}
esp_err_t CCamera::InitCam()

View File

@@ -23,6 +23,9 @@ class CCamera {
protected:
int ActualQuality;
framesize_t ActualResolution;
int brightness, contrast, saturation;
bool isFixedExposure;
int waitbeforepicture_org;
public:
int image_height, image_width;
@@ -34,8 +37,12 @@ class CCamera {
void LEDOnOff(bool status);
esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
void SetQualitySize(int qual, framesize_t resol);
bool SetBrightnessContrastSaturation(int _brightness, int _contrast, int _saturation);
void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol);
void EnableAutoExposure(int flashdauer);
framesize_t TextToFramesize(const char * text);
esp_err_t CaptureToFile(std::string nm, int delay = 0);

View File

@@ -9,4 +9,5 @@ static const char *TAGPARTOTA = "server_ota";
void register_server_ota_sdcard_uri(httpd_handle_t server);
void CheckOTAUpdate();
void doReboot();
void hard_restart();

View File

@@ -39,7 +39,8 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _
for (int i = 0; i < FlowControll.size(); ++i)
if (FlowControll[i]->name().compare(_classname) == 0){
FlowControll[i]->doFlow("");
if (!(FlowControll[i]->name().compare("ClassFlowMakeImage") == 0)) // falls es ein MakeImage ist, braucht das Bild nicht extra aufgenommen zu werden, dass passiert bei html-Abfrage automatisch
FlowControll[i]->doFlow("");
result = FlowControll[i]->getHTMLSingleStep(_host);
}
@@ -381,6 +382,9 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
{
// reboot notwendig damit die neue wlan.ini auch benutzt wird !!!
fclose(pfile);
printf("do reboot\n");
esp_restart();
hard_restart();
doReboot();
}
}

View File

@@ -34,6 +34,7 @@ void ClassFlowMakeImage::SetInitialParameter(void)
ImageSize = FRAMESIZE_VGA;
SaveAllFiles = false;
disabled = false;
FixedExposure = false;
namerawimage = "/sdcard/img_tmp/raw.jpg";
}
@@ -48,6 +49,9 @@ bool ClassFlowMakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
std::vector<string> zerlegt;
aktparamgraph = trim(aktparamgraph);
int _brightness = -100;
int _contrast = -100;
int _saturation = -100;
if (aktparamgraph.size() == 0)
if (!this->GetNextParagraph(pfile, aktparamgraph))
@@ -79,14 +83,48 @@ bool ClassFlowMakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
SaveAllFiles = true;
}
if ((toUpper(zerlegt[0]) == "BRIGHTNESS") && (zerlegt.size() > 1))
{
_brightness = stoi(zerlegt[1]);
}
if ((toUpper(zerlegt[0]) == "CONTRAST") && (zerlegt.size() > 1))
{
_contrast = stoi(zerlegt[1]);
}
if ((toUpper(zerlegt[0]) == "SATURATION") && (zerlegt.size() > 1))
{
_saturation = stoi(zerlegt[1]);
}
if ((toUpper(zerlegt[0]) == "FIXEDEXPOSURE") && (zerlegt.size() > 1))
{
if (toUpper(zerlegt[1]) == "TRUE")
FixedExposure = true;
}
}
Camera.SetBrightnessContrastSaturation(_brightness, _contrast, _saturation);
Camera.SetQualitySize(ImageQuality, ImageSize);
image_width = Camera.image_width;
image_height = Camera.image_height;
rawImage = new CImageBasis();
rawImage->CreateEmptyImage(image_width, image_height, 3);
waitbeforepicture_store = waitbeforepicture;
if (FixedExposure)
{
printf("Fixed Exposure enabled!\n");
int flashdauer = (int) (waitbeforepicture * 1000);
Camera.EnableAutoExposure(flashdauer);
waitbeforepicture = 0.2;
// flashdauer = (int) (waitbeforepicture * 1000);
// takePictureWithFlash(flashdauer);
// rawImage->SaveToFile("/sdcard/init2.jpg");
}
return true;
}
@@ -101,7 +139,7 @@ bool ClassFlowMakeImage::doFlow(string zwtime)
{
string logPath = CreateLogFolder(zwtime);
int flashdauer = (int) waitbeforepicture * 1000;
int flashdauer = (int) (waitbeforepicture * 1000);
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("ClassFlowMakeImage::doFlow - Before takePictureWithFlash");
@@ -126,7 +164,7 @@ bool ClassFlowMakeImage::doFlow(string zwtime)
esp_err_t ClassFlowMakeImage::SendRawJPG(httpd_req_t *req)
{
int flashdauer = (int) waitbeforepicture * 1000;
int flashdauer = (int) (waitbeforepicture * 1000);
return Camera.CaptureToHTTP(req, flashdauer);
}
@@ -135,7 +173,7 @@ ImageData* ClassFlowMakeImage::SendRawImage()
{
CImageBasis *zw = new CImageBasis(rawImage);
ImageData *id;
int flashdauer = (int) waitbeforepicture * 1000;
int flashdauer = (int) (waitbeforepicture * 1000);
Camera.CaptureToBasisImage(zw, flashdauer);
id = zw->writeToMemoryAsJPG();
delete zw;

View File

@@ -15,6 +15,7 @@ class ClassFlowMakeImage :
{
protected:
float waitbeforepicture;
float waitbeforepicture_store;
framesize_t ImageSize;
bool isImageSize;
int ImageQuality;
@@ -22,6 +23,8 @@ protected:
string namerawimage;
int image_height, image_width;
bool SaveAllFiles;
bool FixedExposure;
void CopyFile(string input, string output);
@@ -29,6 +32,7 @@ protected:
esp_err_t camera_capture();
void takePictureWithFlash(int flashdauer);
void SetInitialParameter(void);
public:

View File

@@ -361,14 +361,14 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
if ((!AllowNegativeRates) && (Value < PreValue))
{
ErrorMessageText = ErrorMessageText + "Negative Rate - Returned old value - read value: " + zwvalue + " - raw value: " + ReturnRawValue;
ErrorMessageText = ErrorMessageText + "Negative Rate - Returned old value - read value: " + zwvalue + " - raw value: " + ReturnRawValue + " - checked value: " + std::to_string(Value) + " ";
Value = PreValue;
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
}
if (useMaxRateValue && (abs(Value - PreValue) > MaxRateValue))
{
ErrorMessageText = ErrorMessageText + "Rate too high - Returned old value - read value: " + zwvalue + " ";
ErrorMessageText = ErrorMessageText + "Rate too high - Returned old value - read value: " + zwvalue + " - checked value: " + RundeOutput(Value, AnzahlAnalog - DecimalShift) + " ";
Value = PreValue;
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
}

View File

@@ -140,7 +140,10 @@ bool CTfLiteClass::LoadInputImageBasis(CImageBasis *rs)
void CTfLiteClass::MakeAllocate()
{
static tflite::AllOpsResolver resolver;
// printf(LogFile.getESPHeapInfo().c_str()); printf("\n");
this->interpreter = new tflite::MicroInterpreter(this->model, resolver, this->tensor_arena, this->kTensorArenaSize, this->error_reporter);
// printf(LogFile.getESPHeapInfo().c_str()); printf("\n");
TfLiteStatus allocate_status = this->interpreter->AllocateTensors();
if (allocate_status != kTfLiteOk) {
@@ -229,7 +232,7 @@ CTfLiteClass::CTfLiteClass()
this->interpreter = nullptr;
this->input = nullptr;
this->output = nullptr;
this->kTensorArenaSize = 150 * 1024; /// laut testfile: 108000 - bisher 600
this->kTensorArenaSize = 200 * 1024; /// laut testfile: 108000 - bisher 600
this->tensor_arena = new uint8_t[kTensorArenaSize];
}

View File

@@ -403,11 +403,33 @@ esp_err_t handler_editflow(httpd_req_t *req)
if (_task.compare("test_take") == 0)
{
std::string _host = "";
std::string _bri = "";
std::string _con = "";
std::string _sat = "";
int bri = -100;
int sat = -100;
int con = -100;
if (httpd_query_key_value(_query, "host", _valuechar, 30) == ESP_OK) {
_host = std::string(_valuechar);
}
if (httpd_query_key_value(_query, "bri", _valuechar, 30) == ESP_OK) {
_bri = std::string(_valuechar);
bri = stoi(_bri);
}
if (httpd_query_key_value(_query, "con", _valuechar, 30) == ESP_OK) {
_con = std::string(_valuechar);
con = stoi(_con);
}
if (httpd_query_key_value(_query, "sat", _valuechar, 30) == ESP_OK) {
_sat = std::string(_valuechar);
sat = stoi(_sat);
}
// printf("Parameter host: "); printf(_host.c_str()); printf("\n");
// string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str());
bool changed = Camera.SetBrightnessContrastSaturation(bri, con, sat);
std::string zw = tfliteflow.doSingleStep("[MakeImage]", _host);
httpd_resp_sendstr_chunk(req, zw.c_str());
}
@@ -559,9 +581,12 @@ void task_autodoFlow(void *pvParameter)
LogFile.WriteToFile(zwtemp);
printf("CPU Temperature: %.2f\n", cputmp);
fr_delta_ms = (esp_timer_get_time() - fr_start) / 1000;
const TickType_t xDelay = (auto_intervall - fr_delta_ms) / portTICK_PERIOD_MS;
printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
vTaskDelay( xDelay );
if (auto_intervall > fr_delta_ms)
{
const TickType_t xDelay = (auto_intervall - fr_delta_ms) / portTICK_PERIOD_MS;
printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
vTaskDelay( xDelay );
}
}
vTaskDelete(NULL); //Delete this task if it exits from the loop above
xHandletask_autodoFlow = NULL;

View File

@@ -25,51 +25,111 @@
#include "ClassControllCamera.h"
#include "server_main.h"
#include "server_camera.h"
#define __SD_USE_ONE_LINE_MODE__
#ifdef __SD_USE_ONE_LINE_MODE__
#include "server_GPIO.h"
#endif
#define BLINK_GPIO GPIO_NUM_33
static const char *TAGMAIN = "connect_wlan_main";
#define FLASH_GPIO GPIO_NUM_4
void Init_NVS_SDCard()
bool Init_NVS_SDCard()
{
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
////////////////////////////////////////////////
ESP_LOGI(TAGMAIN, "Initializing SD card");
ESP_LOGI(TAG, "Using SDMMC peripheral");
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
host.flags = SDMMC_HOST_FLAG_1BIT;
// sdmmc_host_t host = SDMMC_HOST_SLOT_1();
// host.flags = SDMMC_HOST_FLAG_1BIT;
// This initializes the slot without card detect (CD) and write protect (WP) signals.
// Modify slot_config.gpio_cd and slot_config.gpio_wp if your board has these signals.
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
slot_config.width = 1; // 1 line SD mode
esp_vfs_fat_sdmmc_mount_config_t mount_config = { };
mount_config.format_if_mount_failed = false;
mount_config.max_files = 5;
gpio_set_pull_mode((gpio_num_t) 15, GPIO_PULLUP_ONLY); // CMD, needed in 4- and 1- line modes
gpio_set_pull_mode((gpio_num_t) 2, GPIO_PULLUP_ONLY); // D0, needed in 4- and 1-line modes
// To use 1-line SD mode, uncomment the following line:
#ifdef __SD_USE_ONE_LINE_MODE__
slot_config.width = 1;
#endif
// GPIOs 15, 2, 4, 12, 13 should have external 10k pull-ups.
// Internal pull-ups are not sufficient. However, enabling internal pull-ups
// 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_2, GPIO_PULLUP_ONLY); // D0, needed in 4- and 1-line modes
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_13, GPIO_PULLUP_ONLY); // D3, needed in 4- and 1-line modes
// Options for mounting the filesystem.
// If format_if_mount_failed is set to true, SD card will be partitioned and
// formatted in case when mounting fails.
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
.format_if_mount_failed = false,
.max_files = 5,
.allocation_unit_size = 16 * 1024
};
// Use settings defined above to initialize SD card and mount FAT filesystem.
// Note: esp_vfs_fat_sdmmc_mount is an all-in-one convenience function.
// Please check its source code and implement error recovery when developing
// production applications.
sdmmc_card_t* card;
ret = esp_vfs_fat_sdmmc_mount("/sdcard", &host, &slot_config, &mount_config, &card);
if (ret != ESP_OK) {
if (ret == ESP_FAIL) {
ESP_LOGE(TAGMAIN, "Failed to mount filesystem. If you want the card to be formatted, set format_if_mount_failed = true.");
ESP_LOGE(TAG, "Failed to mount filesystem. "
"If you want the card to be formatted, set format_if_mount_failed = true.");
} else {
ESP_LOGE(TAGMAIN, "Failed to initialize the card (%d). Make sure SD card lines have pull-up resistors in place.", ret);
ESP_LOGE(TAG, "Failed to initialize the card (%s). "
"Make sure SD card lines have pull-up resistors in place.", esp_err_to_name(ret));
}
return;
return false;
}
// Card has been initialized, print its properties
sdmmc_card_print_info(stdout, card);
// Init the GPIO
// Flash ausschalten
gpio_pad_select_gpio(FLASH_GPIO);
gpio_set_direction(FLASH_GPIO, GPIO_MODE_OUTPUT);
gpio_set_level(FLASH_GPIO, 0);
return true;
}
void task_NoSDBlink(void *pvParameter)
{
gpio_pad_select_gpio(BLINK_GPIO);
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
TickType_t xDelay;
xDelay = 100 / portTICK_PERIOD_MS;
printf("SD-Card could not be inialized - STOP THE PROGRAMM HERE\n");
while (1)
{
gpio_set_level(BLINK_GPIO, 1);
vTaskDelay( xDelay );
gpio_set_level(BLINK_GPIO, 0);
vTaskDelay( xDelay );
}
vTaskDelete(NULL); //Delete this task if it exits from the loop above
}
extern "C" void app_main(void)
@@ -79,41 +139,18 @@ extern "C" void app_main(void)
Camera.InitCam();
Camera.LightOnOff(false);
Init_NVS_SDCard();
// LogFile.WriteToFile("Startsequence 02");
if (!Init_NVS_SDCard())
{
xTaskCreate(&task_NoSDBlink, "task_NoSDBlink", configMINIMAL_STACK_SIZE * 64, NULL, tskIDLE_PRIORITY+1, NULL);
return;
};
CheckOTAUpdate();
// LogFile.WriteToFile("Startsequence 03");
std::string ssid = "";
std::string password = "";
std::string hostname = "";
std::string ip = "";
std::string gw = "";
std::string netmask = "";
std::string dns = "";
// LoadWlanFromFile("/sdcard/wlan.ini", ssid, password, hostname, ip, gw, netmask, dns);
LoadWlanFromFile("/sdcard/wlan.ini", ssid, password, hostname);
LoadNetConfigFromFile("/sdcard/wlan.ini", ip, gw, netmask, dns);
// LogFile.WriteToFile("Startsequence 04");
printf("To use WLan: %s, %s\n", ssid.c_str(), password.c_str());
printf("To set Hostename: %s\n", hostname.c_str());
printf("Fixed IP: %s, Gateway %s, Netmask %s, DNS %s\n", ip.c_str(), gw.c_str(), netmask.c_str(), dns.c_str());
if (ip.length() == 0 || gw.length() == 0 || netmask.length() == 0)
{
initialise_wifi(ssid, password, hostname);
}
else
{
initialise_wifi_fixed_ip(ip, gw, netmask, ssid, password, hostname, dns);
}
printf("Netparameter: IP: %s - GW: %s - NetMask %s\n", getIPAddress().c_str(), getGW().c_str(), getNetMask().c_str());
LoadWlanFromFile("/sdcard/wlan.ini");
ConnectToWLAN();
printf("\nNetparameter: IP: %s - GW: %s - NetMask %s\n", getIPAddress().c_str(), getGW().c_str(), getNetMask().c_str());
// LogFile.WriteToFile("Startsequence 05");
TickType_t xDelay;
xDelay = 2000 / portTICK_PERIOD_MS;
printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
@@ -140,7 +177,11 @@ extern "C" void app_main(void)
register_server_tflite_uri(server);
register_server_file_uri(server, "/sdcard");
register_server_ota_sdcard_uri(server);
#ifdef __SD_USE_ONE_LINE_MODE__
register_server_GPIO_uri(server);
#endif
register_server_main_uri(server, "/sdcard");
TFliteDoAutoStart();

View File

@@ -209,6 +209,7 @@ esp_err_t hello_main_handler(httpd_req_t *req)
return res;
/* Respond with an empty chunk to signal HTTP response completion */
// httpd_resp_sendstr(req, "");
httpd_resp_send_chunk(req, NULL, 0);
#ifdef DEBUG_DETAIL_ON

View File

@@ -1,4 +1,4 @@
const char* GIT_REV="46cfe45";
const char* GIT_REV="21a70c5";
const char* GIT_TAG="";
const char* GIT_BRANCH="master";
const char* BUILD_TIME="2021-01-20 19:47";
const char* BUILD_TIME="2021-04-05 10:14";

View File

@@ -13,7 +13,7 @@ extern "C"
#include "Helper.h"
#include <fstream>
const char* GIT_BASE_BRANCH = "master - v6.1.0 - 2020-01-20";
const char* GIT_BASE_BRANCH = "master - v6.6.1 - 2020-04-05";
const char* git_base_branch(void)

View File

@@ -15,14 +15,13 @@ src_dir = main
[env:esp32cam]
platform = espressif32@2.1.0
;platform = espressif32
board = esp32cam
framework = espidf
;board_build.partitions = partitions_singleapp.csv
board_build.partitions = partitions.csv
lib_deps =
jomjol_helper
connect_wlan

View File

@@ -173,95 +173,7 @@ CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1
CONFIG_BT_RESERVE_DRAM=0
# end of Bluetooth
CONFIG_BLE_MESH=y
CONFIG_BLE_MESH_HCI_5_0=y
# CONFIG_BLE_MESH_ALLOC_FROM_PSRAM_FIRST is not set
# CONFIG_BLE_MESH_FAST_PROV is not set
# CONFIG_BLE_MESH_NODE is not set
# CONFIG_BLE_MESH_PROVISIONER is not set
CONFIG_BLE_MESH_PROV=y
CONFIG_BLE_MESH_PB_ADV=y
# CONFIG_BLE_MESH_PB_GATT is not set
CONFIG_BLE_MESH_PROXY=y
# CONFIG_BLE_MESH_GATT_PROXY_CLIENT is not set
CONFIG_BLE_MESH_NET_BUF_POOL_USAGE=y
# CONFIG_BLE_MESH_SETTINGS is not set
CONFIG_BLE_MESH_SUBNET_COUNT=3
CONFIG_BLE_MESH_APP_KEY_COUNT=3
CONFIG_BLE_MESH_MODEL_KEY_COUNT=3
CONFIG_BLE_MESH_MODEL_GROUP_COUNT=3
CONFIG_BLE_MESH_LABEL_COUNT=3
CONFIG_BLE_MESH_CRPL=10
CONFIG_BLE_MESH_MSG_CACHE_SIZE=10
CONFIG_BLE_MESH_ADV_BUF_COUNT=60
# CONFIG_BLE_MESH_SUPPORT_BLE_ADV is not set
CONFIG_BLE_MESH_IVU_DIVIDER=4
CONFIG_BLE_MESH_TX_SEG_MSG_COUNT=1
CONFIG_BLE_MESH_RX_SEG_MSG_COUNT=1
CONFIG_BLE_MESH_RX_SDU_MAX=384
CONFIG_BLE_MESH_TX_SEG_MAX=32
# CONFIG_BLE_MESH_FRIEND is not set
# CONFIG_BLE_MESH_NO_LOG is not set
#
# BLE Mesh STACK DEBUG LOG LEVEL
#
# CONFIG_BLE_MESH_TRACE_LEVEL_NONE is not set
# CONFIG_BLE_MESH_TRACE_LEVEL_ERROR is not set
CONFIG_BLE_MESH_TRACE_LEVEL_WARNING=y
# CONFIG_BLE_MESH_TRACE_LEVEL_INFO is not set
# CONFIG_BLE_MESH_TRACE_LEVEL_DEBUG is not set
# CONFIG_BLE_MESH_TRACE_LEVEL_VERBOSE is not set
CONFIG_BLE_MESH_STACK_TRACE_LEVEL=2
# end of BLE Mesh STACK DEBUG LOG LEVEL
#
# BLE Mesh NET BUF DEBUG LOG LEVEL
#
# CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_NONE is not set
# CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_ERROR is not set
CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_WARNING=y
# CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_INFO is not set
# CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_DEBUG is not set
# CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL_VERBOSE is not set
CONFIG_BLE_MESH_NET_BUF_TRACE_LEVEL=2
# end of BLE Mesh NET BUF DEBUG LOG LEVEL
CONFIG_BLE_MESH_CLIENT_MSG_TIMEOUT=4000
#
# Support for BLE Mesh Client Models
#
# CONFIG_BLE_MESH_CFG_CLI is not set
# CONFIG_BLE_MESH_HEALTH_CLI is not set
# CONFIG_BLE_MESH_GENERIC_ONOFF_CLI is not set
# CONFIG_BLE_MESH_GENERIC_LEVEL_CLI is not set
# CONFIG_BLE_MESH_GENERIC_DEF_TRANS_TIME_CLI is not set
# CONFIG_BLE_MESH_GENERIC_POWER_ONOFF_CLI is not set
# CONFIG_BLE_MESH_GENERIC_POWER_LEVEL_CLI is not set
# CONFIG_BLE_MESH_GENERIC_BATTERY_CLI is not set
# CONFIG_BLE_MESH_GENERIC_LOCATION_CLI is not set
# CONFIG_BLE_MESH_GENERIC_PROPERTY_CLI is not set
# CONFIG_BLE_MESH_SENSOR_CLI is not set
# CONFIG_BLE_MESH_TIME_CLI is not set
# CONFIG_BLE_MESH_SCENE_CLI is not set
# CONFIG_BLE_MESH_SCHEDULER_CLI is not set
# CONFIG_BLE_MESH_LIGHT_LIGHTNESS_CLI is not set
# CONFIG_BLE_MESH_LIGHT_CTL_CLI is not set
# CONFIG_BLE_MESH_LIGHT_HSL_CLI is not set
# CONFIG_BLE_MESH_LIGHT_XYL_CLI is not set
# CONFIG_BLE_MESH_LIGHT_LC_CLI is not set
# end of Support for BLE Mesh Client Models
# CONFIG_BLE_MESH_IV_UPDATE_TEST is not set
#
# BLE Mesh specific test option
#
# CONFIG_BLE_MESH_SELF_TEST is not set
# CONFIG_BLE_MESH_SHELL is not set
# CONFIG_BLE_MESH_DEBUG is not set
# end of BLE Mesh specific test option
# CONFIG_BLE_MESH is not set
#
# CoAP Configuration

View File

@@ -1,11 +0,0 @@
This directory is intended for PlatformIO Unit Testing and project tests.
Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.
More information about PlatformIO Unit Testing:
- https://docs.platformio.org/page/plus/unit-testing.html

View File

@@ -1,4 +1,4 @@
const char* GIT_REV="46cfe45";
const char* GIT_REV="21a70c5";
const char* GIT_TAG="";
const char* GIT_BRANCH="master";
const char* BUILD_TIME="2021-01-20 19:47";
const char* BUILD_TIME="2021-04-05 10:14";

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
images/focus_adjustment.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 KiB

Binary file not shown.

View File

@@ -4,18 +4,20 @@
WaitBeforeTakingPicture = 5
ImageQuality = 5
ImageSize = VGA
;Brightness = -2
FixedExposure = false
[Alignment]
InitalRotate=180
InitialRotate=180
/config/ref0.jpg 119 273
/config/ref1.jpg 456 138
SearchFieldX = 20
SearchFieldY = 20
InitialMirror= false
AlignmentAlgo = Default
[Digits]
Model = /config/dig0721s1.tflite
Model = /config/dig0820s2q.tflite
;LogImageLocation = /log/digit
;LogfileRetentionInDays = 3
ModelInputSize = 20 32
@@ -24,7 +26,7 @@ digit2 355 120 37 67
digit3 404 120 37 67
[Analog]
Model = /config/ana0630s2.tflite
Model = /config/ana0700s1lq.tflite
;LogImageLocation = /log/analog
;LogfileRetentionInDays = 3
ModelInputSize = 32 32

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,3 +0,0 @@
[1204/185120.033:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
[0102/122131.430:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
[0118/210038.095:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)

View File

@@ -85,13 +85,14 @@ select {
<table>
<tr>
<td colspan="2"><input class="button" type="submit" name="saveroi" onclick="SaveToConfig()" value="Save to Config.ini"></td>
<td colspan="2"><input class="button" type="submit" name="saveroi" onclick="SaveToConfig()" value="Save all to Config.ini"></td>
</tr>
</table>
<script type="text/javascript" src="./gethost.js"></script>
<script type="text/javascript" src="./readconfig.js"></script>
<script type="text/javascript" src="./readconfigcommon.js"></script>
<script type="text/javascript" src="./readconfigcommon.js"></script>
<script language="JavaScript">
var canvas = document.getElementById('canvas'),
@@ -101,7 +102,8 @@ select {
drag = false,
aktindex = 0,
refInfo,
enhanceCon = false;
enhanceCon = false,
param;
basepath = "http://192.168.178.26";
basepath = "";
@@ -111,60 +113,60 @@ function ChangeSelection(){
}
function SaveToConfig(){
refInfo["name"] = document.getElementById("name").value;
refInfo["x"] = document.getElementById("refx").value;
refInfo["y"] = document.getElementById("refy").value;
refInfo["dx"] = document.getElementById("refdx").value;
refInfo["dy"] = document.getElementById("refdy").value;
UpdateConfig(refInfo, aktindex, enhanceCon, basepath);
/*
refInfo[aktindex]["name"] = document.getElementById("name").value;
refInfo[aktindex]["x"] = document.getElementById("refx").value;
refInfo[aktindex]["y"] = document.getElementById("refy").value;
refInfo[aktindex]["dx"] = document.getElementById("refdx").value;
refInfo[aktindex]["dy"] = document.getElementById("refdy").value;
*/
UpdateConfigReference(refInfo, basepath);
}
function EnhanceContrast(){
refInfo["name"] = document.getElementById("name").value;
refInfo["x"] = document.getElementById("refx").value;
refInfo["y"] = document.getElementById("refy").value;
refInfo["dx"] = document.getElementById("refdx").value;
refInfo["dy"] = document.getElementById("refdy").value;
refInfo[aktindex]["name"] = document.getElementById("name").value;
refInfo[aktindex]["x"] = document.getElementById("refx").value;
refInfo[aktindex]["y"] = document.getElementById("refy").value;
refInfo[aktindex]["dx"] = document.getElementById("refdx").value;
refInfo[aktindex]["dy"] = document.getElementById("refdy").value;
enhanceCon = true;
MakeContrastImageZW(refInfo, enhanceCon, basepath);
var url = basepath + "/fileserver" + "/img_tmp/ref_zw.jpg?" + Date.now();
document.getElementById("img_ref").src = url;
var url = basepath + "/fileserver" + "/img_tmp/ref_zw_org.jpg?" + Date.now();
document.getElementById("img_ref_org").src = url;
MakeContrastImageZW(refInfo[aktindex], enhanceCon, basepath);
UpdateReference();
// var url = basepath + "/fileserver" + "/img_tmp/ref_zw.jpg?" + Date.now();
// document.getElementById("img_ref").src = url;
// var url = basepath + "/fileserver" + "/img_tmp/ref_zw_org.jpg?" + Date.now();
// document.getElementById("img_ref_org").src = url;
}
function UpdateReference(){
refInfo = GetCoordinates(aktindex, basepath);
document.getElementById("img_ref").onload = function () {
document.getElementById("refdx").value = this.width;
document.getElementById("refdy").value = this.height;
refInfo["dx"] = this.width;
refInfo["dy"] = this.height;
refInfo[aktindex]["dx"] = this.width;
refInfo[aktindex]["dy"] = this.height;
rect.w = document.getElementById("refdx").value;
rect.h = document.getElementById("refdy").value;
draw();
}
var url = basepath + "/fileserver" + "/img_tmp/ref_zw_org.jpg?" + Date.now();
document.getElementById("img_ref_org").src = url;
var url = basepath + "/fileserver" + "/img_tmp/ref_zw.jpg?" + Date.now();
_filenameurl = refInfo[aktindex]["name"].replace("/config/", "/img_tmp/");
var url = basepath + "/fileserver" + _filenameurl + "?" + Date.now();
document.getElementById("img_ref").src = url;
document.getElementById("name").value = refInfo["name"];
document.getElementById("refx").value = refInfo["x"];
document.getElementById("refy").value = refInfo["y"];
_filenameurl = _filenameurl.replace(".jpg", "_org.jpg");
var url = basepath + "/fileserver" + _filenameurl + "?" + Date.now();
document.getElementById("img_ref_org").src = url;
document.getElementById("name").value = refInfo[aktindex]["name"];
document.getElementById("refx").value = refInfo[aktindex]["x"];
document.getElementById("refy").value = refInfo[aktindex]["y"];
rect.startX = document.getElementById("refx").value;
rect.startY = document.getElementById("refy").value;
document.getElementById("enhancecontrast").disabled = true;
draw();
}
function ParseIni(_basepath) {
loadConfig(_basepath);
ParseConfig();
UpdateReference();
}
function dataURLtoBlob(dataurl) {
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
@@ -205,13 +207,21 @@ function dataURLtoBlob(dataurl) {
function init() {
function init() {
basepath = getbasepath();
loadConfig(basepath);
ParseConfig();
canvas.addEventListener('mousedown', mouseDown, false);
canvas.addEventListener('mouseup', mouseUp, false);
canvas.addEventListener('mousemove', mouseMove, false);
loadCanvas(basepath + "/fileserver/config/reference.jpg");
ParseIni(basepath);
CopyReferenceToImgTmp(basepath);
refInfo = GetReferencesInfo();
UpdateReference();
drawImage();
}
function drawImage(){
@@ -226,17 +236,13 @@ function dataURLtoBlob(dataurl) {
function CutOutReference(){
refInfo["x"] = document.getElementById("refx").value;
refInfo["y"] = document.getElementById("refy").value;
refInfo["dx"] = document.getElementById("refdx").value;
refInfo["dy"] = document.getElementById("refdy").value;
MakeRefZW(refInfo, basepath);
var url = basepath + "/fileserver" + "/img_tmp/ref_zw.jpg?" + Date.now();
document.getElementById("img_ref_org").src = url;
var url = basepath + "/fileserver" + "/img_tmp/ref_zw_org.jpg?" + Date.now();
document.getElementById("img_ref").src = url;
refInfo[aktindex]["x"] = document.getElementById("refx").value;
refInfo[aktindex]["y"] = document.getElementById("refy").value;
refInfo[aktindex]["dx"] = document.getElementById("refdx").value;
refInfo[aktindex]["dy"] = document.getElementById("refdy").value;
MakeRefZW(refInfo[aktindex], basepath);
UpdateReference();
document.getElementById("enhancecontrast").disabled = false;
draw();
}
function drawGrid(){

View File

@@ -363,7 +363,15 @@ function ParseIni(_basepath) {
var y0 = parseInt(rect.startY) - parseInt(lw/2);
var dx = parseInt(rect.w) + parseInt(lw);
var dy = parseInt(rect.h) + parseInt(lw);
context.strokeRect(x0, y0, dx, dy);
context.strokeRect(x0, y0, dx, dy);
context.lineWidth = 1;
context.beginPath();
context.arc(x0+dx/2, y0+dy/2, dx/2, 0, 2 * Math.PI);
context.moveTo(x0+dx/2, y0);
context.lineTo(x0+dx/2, y0+dy);
context.moveTo(x0, y0+dy/2);
context.lineTo(x0+dx, y0+dy/2);
context.stroke();
ROIInfo[aktindex]["x"] = rect.startX;
ROIInfo[aktindex]["y"] = rect.startY;
ROIInfo[aktindex]["dx"] = rect.w;

View File

@@ -61,7 +61,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="MakeImage_LogImageLocation_enabled" value="1" onclick = 'document.getElementById("MakeImage_LogImageLocation_value1").disabled = !document.getElementById("MakeImage_LogImageLocation_value1").disabled' unchecked >
<input type="checkbox" id="MakeImage_LogImageLocation_enabled" value="1" onclick = 'InvertEnableItem("MakeImage", "LogImageLocation")' unchecked >
</td>
<td width="200px">
<class id="MakeImage_LogImageLocation_text" style="color:black;">LogImageLocation</class>
@@ -75,7 +75,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<td"><input type="checkbox" id="MakeImage_LogfileRetentionInDays_enabled" value="1" onclick = 'document.getElementById("MakeImage_LogfileRetentionInDays_value1").disabled = !document.getElementById("MakeImage_LogfileRetentionInDays_value1").disabled' unchecked ></td>
<td"><input type="checkbox" id="MakeImage_LogfileRetentionInDays_enabled" value="1" onclick = 'InvertEnableItem("MakeImage", "LogfileRetentionInDays")' unchecked ></td>
</td>
<td>
<class id="MakeImage_LogfileRetentionInDays_text" style="color:black;">LogfileRetentionInDays</class>
@@ -130,6 +130,67 @@ textarea {
Picture size camera (default = "VGA")
</td>
</tr>
<tr class="expert" id="Brightness_ex3">
<td width="20px" style="padding-left: 40px;">
</td>
<td>
<class id="MakeImage_Brightness_text" style="color:black;">Brightness</class>
</td>
<td>
<input type="number" id="MakeImage_Brightness_value1" size="13" min="-2" max="2">
</td>
<td style="font-size: 80%;">
Image Brightness (-2 .. 2 - default = "0")
</td>
</tr>
<tr class="expert" id="MakeImage_FixedExposure_ex10">
<td width="20px" style="padding-left: 40px;">
</td>
<td width="200px">
<class id="MakeImage_FixedExposure_text" style="color:black;">FixedExposure</class>
</td>
<td>
<select id="MakeImage_FixedExposure_value1">
<option value="0" selected>true</option>
<option value="1" >false</option>
</select>
</td>
<td style="font-size: 80%;">
Fixes the illumination setting of camera at the startup and uses this later --> individual round is faster
</td>
</tr>
<!--
<tr class="expert" id="Contrast_ex3">
<td width="20px" style="padding-left: 40px;">
</td>
<td>
<class id="MakeImage_Contrast_text" style="color:black;">Contrast</class>
</td>
<td>
<input type="number" id="MakeImage_Contrast_value1" size="13" min="-2" max="2">
</td>
<td style="font-size: 80%;">
Image Contrast (-2 .. 2 - default = "0")
</td>
</tr>
<tr class="expert" id="Saturation_ex3">
<td width="20px" style="padding-left: 40px;">
</td>
<td>
<class id="MakeImage_Saturation_text" style="color:black;">Saturation</class>
</td>
<td>
<input type="number" id="MakeImage_Saturation_value1" size="13" min="-2" max="2">
</td>
<td style="font-size: 80%;">
Image Saturation (-2 .. 2 - default = "0")
</td>
</tr>
-->
<tr class="expert" id="ex4">
<td colspan="4" style="padding-left: 20px;"><h4>Alignment</h4></td>
@@ -162,7 +223,7 @@ textarea {
</tr>
<tr class="expert" id="AlignmentAlgo_ex8">
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="Alignment_AlignmentAlgo_enabled" value="1" onclick = 'document.getElementById("Alignment_AlignmentAlgo_value1").disabled = !document.getElementById("Alignment_AlignmentAlgo_value1").disabled' unchecked >
<input type="checkbox" id="Alignment_AlignmentAlgo_enabled" value="1" onclick = 'InvertEnableItem("Alignment", "AlignmentAlgo")' unchecked >
</td>
<td>
<class id="Alignment_AlignmentAlgo_text" style="color:black;">AlignmentAlgo</class>
@@ -199,7 +260,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="Digits_LogImageLocation_enabled" value="1" onclick = 'document.getElementById("Digits_LogImageLocation_value1").disabled = !document.getElementById("Digits_LogImageLocation_value1").disabled' unchecked >
<input type="checkbox" id="Digits_LogImageLocation_enabled" value="1" onclick = 'InvertEnableItem("Digits", "LogImageLocation")' unchecked >
</td>
<td>
<class id="Digits_LogImageLocation_text" style="color:black;">LogImageLocation</class>
@@ -213,7 +274,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<td"><input type="checkbox" id="Digits_LogfileRetentionInDays_enabled" value="1" onclick = 'document.getElementById("Digits_LogfileRetentionInDays_value1").disabled = !document.getElementById("Digits_LogfileRetentionInDays_value1").disabled' unchecked ></td>
<td"><input type="checkbox" id="Digits_LogfileRetentionInDays_enabled" value="1" onclick = 'InvertEnableItem("Digits", "LogfileRetentionInDays")' unchecked ></td>
</td>
<td>
<class id="Digits_LogfileRetentionInDays_text" style="color:black;">LogfileRetentionInDays</class>
@@ -252,7 +313,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="Analog_LogImageLocation_enabled" value="1" onclick = 'document.getElementById("Analog_LogImageLocation_value1").disabled = !document.getElementById("Analog_LogImageLocation_value1").disabled' unchecked >
<input type="checkbox" id="Analog_LogImageLocation_enabled" value="1" onclick = 'InvertEnableItem("Analog", "LogImageLocation")' unchecked >
</td>
<td> <class id="Analog_LogImageLocation_text" style="color:black;">LogImageLocation</class> </td>
<td> <input type="text" name="name" id="Analog_LogImageLocation_value1"> </td>
@@ -260,7 +321,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<td"><input type="checkbox" id="Analog_LogfileRetentionInDays_enabled" value="1" onclick = 'document.getElementById("Analog_LogfileRetentionInDays_value1").disabled = !document.getElementById("Analog_LogfileRetentionInDays_value1").disabled' unchecked ></td>
<td"><input type="checkbox" id="Analog_LogfileRetentionInDays_enabled" value="1" onclick = 'InvertEnableItem("Analog", "LogfileRetentionInDays")' unchecked ></td>
</td>
<td> <class id="Analog_LogfileRetentionInDays_text" style="color:black;">LogfileRetentionInDays</class> </td>
<td> <input type="number" id="Analog_LogfileRetentionInDays_value1" min="0" step="1"> </td>
@@ -269,7 +330,7 @@ textarea {
<tr class="expert" id="Analog_ExtendedResolution_ex10">
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="Analog_ExtendedResolution_enabled" value="1" onclick = 'document.getElementById("Analog_ExtendedResolution_value1").disabled = !document.getElementById("Analog_ExtendedResolution_value1").disabled' unchecked >
<input type="checkbox" id="Analog_ExtendedResolution_enabled" value="1" onclick = 'InvertEnableItem("Analog", "ExtendedResolution")' unchecked >
</td>
<td width="200px">
<class id="Analog_ExtendedResolution_text" style="color:black;">ExtendedResolution</class>
@@ -303,7 +364,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="PostProcessing_DecimalShift_enabled" value="1" onclick = 'document.getElementById("PostProcessing_DecimalShift_value1").disabled = !document.getElementById("PostProcessing_DecimalShift_value1").disabled' unchecked >
<input type="checkbox" id="PostProcessing_DecimalShift_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "DecimalShift")' unchecked >
</td>
<td width="200px">
<class id="PostProcessing_DecimalShift_text" style="color:black;">DecimalShift</class>
@@ -317,7 +378,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="PostProcessing_PreValueUse_enabled" value="1" onclick = 'document.getElementById("PostProcessing_PreValueUse_value1").disabled = !document.getElementById("PostProcessing_PreValueUse_value1").disabled' unchecked >
<input type="checkbox" id="PostProcessing_PreValueUse_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "PreValueUse")' unchecked >
</td>
<td width="200px">
<class id="PostProcessing_PreValueUse_text" style="color:black;">PreValueUse</class>
@@ -334,7 +395,7 @@ textarea {
</tr>
<tr class="expert" id="ex11">
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="PostProcessing_PreValueAgeStartup_enabled" value="1" onclick = 'document.getElementById("PostProcessing_PreValueAgeStartup_value1").disabled = !document.getElementById("PostProcessing_PreValueAgeStartup_value1").disabled' unchecked >
<input type="checkbox" id="PostProcessing_PreValueAgeStartup_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "PreValueAgeStartup")' unchecked >
</td>
<td width="200px">
<class id="PostProcessing_PreValueAgeStartup_text" style="color:black;">PreValueAgeStartup</class>
@@ -348,7 +409,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="PostProcessing_AllowNegativeRates_enabled" value="1" onclick = 'document.getElementById("PostProcessing_AllowNegativeRates_value1").disabled = !document.getElementById("PostProcessing_AllowNegativeRates_value1").disabled' unchecked >
<input type="checkbox" id="PostProcessing_AllowNegativeRates_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "AllowNegativeRates")' unchecked >
</td>
<td width="200px">
<class id="PostProcessing_AllowNegativeRates_text" style="color:black;">AllowNegativeRates</class>
@@ -365,7 +426,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="PostProcessing_MaxRateValue_enabled" value="1" onclick = 'document.getElementById("PostProcessing_MaxRateValue_value1").disabled = !document.getElementById("PostProcessing_MaxRateValue_value1").disabled' unchecked >
<input type="checkbox" id="PostProcessing_MaxRateValue_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "MaxRateValue")' unchecked >
</td>
<td width="200px">
<class id="PostProcessing_MaxRateValue_text" style="color:black;">MaxRateValue</class>
@@ -379,7 +440,7 @@ textarea {
</tr>
<tr class="expert" id="ex12">
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="PostProcessing_ErrorMessage_enabled" value="1" onclick = 'document.getElementById("PostProcessing_ErrorMessage_value1").disabled = !document.getElementById("PostProcessing_ErrorMessage_value1").disabled' unchecked >
<input type="checkbox" id="PostProcessing_ErrorMessage_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "ErrorMessage")' unchecked >
</td>
<td width="200px">
<class id="PostProcessing_ErrorMessage_text" style="color:black;">ErrorMessage</class>
@@ -396,7 +457,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="PostProcessing_CheckDigitIncreaseConsistency_enabled" value="1" onclick = 'document.getElementById("PostProcessing_CheckDigitIncreaseConsistency_value1").disabled = !document.getElementById("PostProcessing_CheckDigitIncreaseConsistency_value1").disabled' unchecked >
<input type="checkbox" id="PostProcessing_CheckDigitIncreaseConsistency_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "CheckDigitIncreaseConsistency")' unchecked >
</td>
<td width="200px">
<class id="PostProcessing_CheckDigitIncreaseConsistency_text" style="color:black;">CheckDigitIncreaseConsistency</class>
@@ -417,7 +478,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="MQTT_Uri_enabled" value="1" onclick = 'document.getElementById("MQTT_Uri_value1").disabled = !document.getElementById("MQTT_Uri_value1").disabled' unchecked >
<input type="checkbox" id="MQTT_Uri_enabled" value="1" onclick = 'InvertEnableItem("MQTT", "Uri")' unchecked >
</td>
<td width="200px">
<class id="MQTT_Uri_text" style="color:black;">Uri</class>
@@ -426,12 +487,12 @@ textarea {
<input type="text" id="MQTT_Uri_value1">
</td>
<td style="font-size: 80%;">
URI to the MQTT broker including port: http:\\IP-ADRESS:port
URI to the MQTT broker including port e.g.: mqtt://IP-Address:Port
</td>
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="MQTT_Topic_enabled" value="1" onclick = 'document.getElementById("MQTT_Topic_value1").disabled = !document.getElementById("MQTT_Topic_value1").disabled' unchecked >
<input type="checkbox" id="MQTT_Topic_enabled" value="1" onclick = 'InvertEnableItem("MQTT", "Topic")' unchecked >
</td>
<td width="200px">
<class id="MQTT_Topic_text" style="color:black;">Topic</class>
@@ -445,7 +506,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="MQTT_TopicError_enabled" value="1" onclick = 'document.getElementById("MQTT_TopicError_value1").disabled = !document.getElementById("MQTT_TopicError_value1").disabled' unchecked >
<input type="checkbox" id="MQTT_TopicError_enabled" value="1" onclick = 'InvertEnableItem("MQTT", "TopicError")' unchecked >
</td>
<td width="200px">
<class id="MQTT_TopicError_text" style="color:black;">TopicError</class>
@@ -459,7 +520,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="MQTT_ClientID_enabled" value="1" onclick = 'document.getElementById("MQTT_ClientID_value1").disabled = !document.getElementById("MQTT_ClientID_value1").disabled' unchecked >
<input type="checkbox" id="MQTT_ClientID_enabled" value="1" onclick = 'InvertEnableItem("MQTT", "ClientID")' unchecked >
</td>
<td width="200px">
<class id="MQTT_ClientID_text" style="color:black;">ClientID</class>
@@ -473,7 +534,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="MQTT_user_enabled" value="1" onclick = 'document.getElementById("MQTT_user_value1").disabled = !document.getElementById("MQTT_user_value1").disabled' unchecked >
<input type="checkbox" id="MQTT_user_enabled" value="1" onclick = 'InvertEnableItem("MQTT", "user")' unchecked >
</td>
<td width="200px">
<class id="MQTT_user_text" style="color:black;">user</class>
@@ -482,12 +543,12 @@ textarea {
<input type="text" id="MQTT_user_value1">
</td>
<td style="font-size: 80%;">
user for MQTT authenficiation
user for MQTT authentication
</td>
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="MQTT_password_enabled" value="1" onclick = 'document.getElementById("MQTT_password_value1").disabled = !document.getElementById("MQTT_password_value1").disabled' unchecked >
<input type="checkbox" id="MQTT_password_enabled" value="1" onclick = 'InvertEnableItem("MQTT", "password")' unchecked >
</td>
<td width="200px">
<class id="MQTT_password_text" style="color:black;">password</class>
@@ -496,7 +557,7 @@ textarea {
<input type="text" id="MQTT_password_value1">
</td>
<td style="font-size: 80%;">
password for MQTT authenficiation
password for MQTT authentication
</td>
</tr>
@@ -505,7 +566,6 @@ textarea {
</tr>
<tr class="expert" id="ex13">
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="AutoTimer_AutoStart_enabled" value="1" onclick = 'document.getElementById("AutoTimer_AutoStart_value1").disabled = !document.getElementById("AutoTimer_AutoStart_value1").disabled' unchecked >
</td>
<td width="200px">
<class id="AutoTimer_AutoStart_text" style="color:black;">AutoStart</class>
@@ -522,7 +582,6 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="AutoTimer_Intervall_enabled" value="1" onclick = 'document.getElementById("AutoTimer_Intervall_value1").disabled = !document.getElementById("AutoTimerg_Intervall_value1").disabled' unchecked >
</td>
<td width="200px">
<class id="AutoTimer_Intervall_text" style="color:black;">Intervall</class>
@@ -540,7 +599,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="Debug_Logfile_enabled" value="1" onclick = 'document.getElementById("Debug_Logfile_value1").disabled = !document.getElementById("Debug_Logfile_value1").disabled' unchecked >
<input type="checkbox" id="Debug_Logfile_enabled" value="1" onclick = 'InvertEnableItem("Debug", "Logfile")' unchecked >
</td>
<td width="200px">
<class id="Debug_Logfile_text" style="color:black;">Logfile</class>
@@ -557,7 +616,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<td"><input type="checkbox" id="Debug_LogfileRetentionInDays_enabled" value="1" onclick = 'document.getElementById("Debug_LogfileRetentionInDays_value1").disabled = !document.getElementById("Debug_LogfileRetentionInDays_value1").disabled' unchecked ></td>
<td"><input type="checkbox" id="Debug_LogfileRetentionInDays_enabled" value="1" onclick = 'InvertEnableItem("Debug", "LogfileRetentionInDays")' unchecked ></td>
</td>
<td>
<class id="Debug_LogfileRetentionInDays_text" style="color:black;">LogfileRetentionInDays</class>
@@ -575,7 +634,7 @@ textarea {
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<td"><input type="checkbox" id="System_TimeZone_enabled" value="1" onclick = 'document.getElementById("System_TimeZone_value1").disabled = !document.getElementById("System_TimeZone_value1").disabled' unchecked ></td>
<td"><input type="checkbox" id="System_TimeZone_enabled" value="1" onclick = 'InvertEnableItem("System", "TimeZone")' unchecked ></td>
</td>
<td>
<class id="System_TimeZone_text" style="color:black;">TimeZone</class>
@@ -589,7 +648,7 @@ textarea {
</tr>
<tr class="expert" id="ex16">
<td width="20px" style="padding-left: 40px;">
<td"><input type="checkbox" id="System_TimeServer_enabled" value="1" onclick = 'document.getElementById("System_TimeServer_value1").disabled = !document.getElementById("System_TimeServer_value1").disabled' unchecked ></td>
<td"><input type="checkbox" id="System_TimeServer_enabled" value="1" onclick = 'InvertEnableItem("System", "TimeServer")' unchecked ></td>
</td>
<td>
<class id="System_TimeServer_text" style="color:black;">TimeServer</class>
@@ -603,7 +662,7 @@ textarea {
</tr>
<tr class="expert" id="System_Hostname">
<td width="20px" style="padding-left: 40px;">
<td"><input type="checkbox" id="System_Hostname_enabled" value="1" onclick = 'document.getElementById("System_Hostname_value1").disabled = !document.getElementById("System_Hostname_value1").disabled' unchecked ></td>
<td"><input type="checkbox" id="System_Hostname_enabled" value="1" onclick = 'InvertEnableItem("System", "Hostname")' unchecked ></td>
</td>
<td>
<class id="System_Hostname_text" style="color:black;">Hostname</class>
@@ -707,6 +766,33 @@ function WriteParameter(_param, _category, _cat, _name, _optional, _select = fal
EnDisableItem(_category[_cat]["enabled"], _param, _category, _cat, _name, _optional);
}
function InvertEnableItem(_cat, _param)
{
_zw = _cat + "_" + _param + "_enabled";
_isOn = document.getElementById(_zw).checked;
_color = "color:lightgrey;";
if (_isOn) {
_color = "color:black;";
}
_zw = _cat + "_" + _param + "_text";
document.getElementById(_zw).disabled = !_isOn;
document.getElementById(_zw).style = _color;
if (param[_cat][_param]["anzParam"] == 2) {
_color = "width: 30px;" + _color;
}
for (var j = 1; j <= param[_cat][_param]["anzParam"]; ++j) {
document.getElementById(_cat+"_"+_param+"_value"+j).disabled = !_isOn;
document.getElementById(_cat+"_"+_param+"_value"+j).style=_color;
}
}
function EnDisableItem(_status, _param, _category, _cat, _name, _optional)
{
_status = _param[_cat][_name]["found"] && _category[_cat]["enabled"];
@@ -767,7 +853,11 @@ function UpdateInput() {
WriteParameter(param, category, "MakeImage", "LogfileRetentionInDays", true);
WriteParameter(param, category, "MakeImage", "WaitBeforeTakingPicture", false);
WriteParameter(param, category, "MakeImage", "ImageQuality", false);
WriteParameter(param, category, "MakeImage", "Brightness", false);
// WriteParameter(param, category, "MakeImage", "Contrast", false);
// WriteParameter(param, category, "MakeImage", "Saturation", false);
WriteParameter(param, category, "MakeImage", "ImageSize", false, true, true);
WriteParameter(param, category, "MakeImage", "FixedExposure", false, true, true);
WriteParameter(param, category, "Alignment", "SearchFieldX", false);
WriteParameter(param, category, "Alignment", "SearchFieldY", false);
@@ -799,8 +889,8 @@ function UpdateInput() {
WriteParameter(param, category, "MQTT", "user", true);
WriteParameter(param, category, "MQTT", "password", true);
WriteParameter(param, category, "AutoTimer", "AutoStart", true, true);
WriteParameter(param, category, "AutoTimer", "Intervall", true);
WriteParameter(param, category, "AutoTimer", "AutoStart", false, true);
WriteParameter(param, category, "AutoTimer", "Intervall", false);
WriteParameter(param, category, "Debug", "Logfile", true, true);
WriteParameter(param, category, "Debug", "LogfileRetentionInDays", true);
@@ -820,7 +910,11 @@ function ReadParameterAll()
ReadParameter(param, "MakeImage", "LogfileRetentionInDays", true);
ReadParameter(param, "MakeImage", "WaitBeforeTakingPicture", false);
ReadParameter(param, "MakeImage", "ImageQuality", false);
ReadParameter(param, "MakeImage", "Brightness", false);
// ReadParameter(param, "MakeImage", "Contrast", false);
// ReadParameter(param, "MakeImage", "Saturation", false);
ReadParameter(param, "MakeImage", "ImageSize", false, true);
ReadParameter(param, "MakeImage", "FixedExposure", false, true);
ReadParameter(param, "Alignment", "SearchFieldX", false);
ReadParameter(param, "Alignment", "SearchFieldY", false);
@@ -852,8 +946,8 @@ function ReadParameterAll()
ReadParameter(param, "MQTT", "user", true);
ReadParameter(param, "MQTT", "password", true);
ReadParameter(param, "AutoTimer", "AutoStart", true, true);
ReadParameter(param, "AutoTimer", "Intervall", true);
ReadParameter(param, "AutoTimer", "AutoStart", false, true);
ReadParameter(param, "AutoTimer", "Intervall", false);
ReadParameter(param, "Debug", "Logfile", true, true);
ReadParameter(param, "Debug", "LogfileRetentionInDays", true);

View File

@@ -354,7 +354,9 @@ function draw() {
var y0 = parseInt(rect.startY) - parseInt(lw/2);
var dx = parseInt(rect.w) + parseInt(lw);
var dy = parseInt(rect.h) + parseInt(lw);
context.strokeRect(x0, y0, dx, dy);
context.strokeRect(x0, y0, dx, dy);
context.lineWidth = 1;
context.strokeRect(x0+dx*0.2, y0+dy*0.2, dx*0.6, dy*0.6);
ROIInfo[aktindex]["x"] = rect.startX;
ROIInfo[aktindex]["y"] = rect.startY;
ROIInfo[aktindex]["dx"] = rect.w;

View File

@@ -29,23 +29,21 @@ p {font-size: 1em;}
</p>
<p>
This is the first time you the digitizer. You have been automatically routed to the <b>initial setup procedure</b>.
This procedure should adjust the setting to your local counter. Basically you can customize your settings in five steps.
<br>
In the final step the inital setup will be disabled and it will restart to the normal mode.
This is the first time you started the digitizer after the initial installation. You have been automatically routed to the <b>initial setup procedure</b>.
Here you adjust the setting to your local counter within five steps. In the final step the inital setup will be disabled and it will restart to the normal mode.
<br>
<br>
Just use the buttons "Next" and "Previous" to nagivate through the process.
You can navigate forward and backward during the setup with the buttons "Next" and "Previous". Do not forget to save in each step.
<br>
</p>
<p>
Follow the instructions:
This is an overview over the five steps:
</p>
<p>
<ol>
<li>Create reference image <br>
Basis for the position references and the marking of the digits and counters.</li>
Base for the position referencing and the identification of the digits and counters.</li>
<li>Define two unique references <br>
Used to align the individual camera shot and identify the absolut positions</li>
<li>Define the digits <br>
@@ -53,7 +51,7 @@ p {font-size: 1em;}
<li>Define the analog counters <br>
Analog counters to be identified</li>
<li>General settings <br>
Most can stay to the default value - also MQTT connection can be specified here</li>
Most settings can be used with default value at the beginning. MQTT connection can be specified here</li>
</ol>
<p>

View File

@@ -34,9 +34,9 @@ p {font-size: 1em;}
<br>
Once you have pushed below button, the setup modus will be left and the digitizer start to normal operation mode.
<br>
After a view seconds you can reload this page again and will go to normal operation mode.
After a view seconds you can reload this page. It will take two to four minutes, until you get the first reading.
<br>
All settings can be changed later on as well in the configuration menue.
All settings can be changed as well in the configuration menue in normal operation mode.
</p>
<p>

View File

@@ -34,7 +34,7 @@ table {
<body style="font-family: arial; padding: 0px 10px;">
<h2>Create Reference out of Raw Image</h2>
<table>
<tr>
<td><input class="button" type="button" value="Show Actual Reference" onclick="showReference()"></td>
@@ -42,17 +42,32 @@ table {
<td><input class="button" type="submit" id="take" onclick="doTake()" value="Take Image"></td>
</tr>
<tr>
<td style="padding-top: 10px"><label for="mirror">Mirror Image:</label></td>
<td style="padding-top: 10px"><input type="checkbox" id="mirror" name="mirror" value="1" onchange="drawRotated()"></td>
<td style="padding-top: 10px"><label for="mirror" id="labelmirror">Mirror Image:</label></td>
<td style="padding-top: 10px"><input type="checkbox" id="mirror" name="mirror" value="1" onchange="drawRotated()"></td>
</tr>
<tr>
<td><label for="mirror">Pre-rotate Angle:</label></td>
<td><input type="number" id="prerotateangle" name="prerotateangle" value=0 min="-360" max="360" onchange="drawRotated()">Degrees</td>
<td>
<class id="MakeImage_Brightness_text" style="color:black;">Brightness: </class>
<input type="number" id="MakeImage_Brightness_value1" size="13" value=0 min="-2" max="2" style="float: right; clear: both;">
</td>
</tr>
<tr>
<td><label for="mirror">Fine Alignment:</label></td>
<td><input type="number" id="finerotate" name="finerotate" value=0.0 min="-1" max="1" step="0.2" onchange="drawRotated()">Degrees</td>
</tr>
<!--
<td>
<class id="MakeImage_Contrast_text" style="color:black;">Contrast</class>
<input type="number" id="MakeImage_Contrast_value1" size="13" value=0 min="-2" max="2" style="float: right; clear: both;">
</td>
<td>
<class id="MakeImage_Saturation_text" style="color:black;">Saturation</class>
<input type="number" id="MakeImage_Saturation_value1" size="13" value=0 min="-2" max="2" style="float: right; clear: both;">
</td>
-->
</tr>
</table>
<table>
@@ -68,6 +83,9 @@ table {
<script type="text/javascript" src="./gethost.js"></script>
<script type="text/javascript" src="./readconfig.js"></script>
<script type="text/javascript" src="./readconfigcommon.js"></script>
<script type="text/javascript" src="./readconfigparam.js"></script>
<script language="JavaScript">
var canvas = document.getElementById('canvas'),
@@ -75,10 +93,21 @@ table {
imageObj = new Image()
basepath = "http://192.168.178.26";
isActReference = false;
param;
function doTake(){
function doTake(){
var xhttp = new XMLHttpRequest();
url = basepath + "/editflow.html?task=test_take";
if (param["MakeImage"]["Brightness"].found && param["MakeImage"]["Brightness"].enabled)
{
_brightness = document.getElementById("MakeImage_Brightness_value1").value;
// _contrast = document.getElementById("MakeImage_Contrast_value1").value;
// _saturation = document.getElementById("MakeImage_Saturation_value1").value;
url = basepath + "/editflow.html?task=test_take&bri=" + _brightness;
}
else
{
url = basepath + "/editflow.html?task=test_take";
}
if (basepath.length > 0){
url = url + "&host=" + basepath;
}
@@ -89,35 +118,64 @@ table {
function loadRawImage(){
url = basepath + "/img_tmp/raw.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);
document.getElementById("finerotate").value = 0;
document.getElementById("prerotateangle").value = getPreRotate();
document.getElementById("mirror").checked = getMirror();
document.getElementById("finerotate").disabled = false;
document.getElementById("prerotateangle").disabled = false;
document.getElementById("updatereferenceimage").disabled = false;
document.getElementById("take").disabled = false;
document.getElementById("mirror").disabled = false;
if (param["Alignment"]["InitialMirror"].found)
document.getElementById("mirror").disabled = false;
else
{
document.getElementById("labelmirror").style = "color:lightgrey;";
}
if (param["MakeImage"]["Brightness"].found && param["MakeImage"]["Brightness"].enabled)
document.getElementById("MakeImage_Brightness_value1").disabled = false;
else
{
document.getElementById("MakeImage_Brightness_value1").type = "hidden";
document.getElementById("MakeImage_Brightness_text").style.visibility = "hidden";
}
// if (param["MakeImage"]["Saturation"].found)
// document.getElementById("MakeImage_Saturation_value1").disabled = false;
// if (param["MakeImage"]["Contrast"].found)
// document.getElementById("MakeImage_Contrast_value1").disabled = false;
// document.getElementById("ButtonRotate").disabled = false;
isActReference = false;
loadCanvas(url);
drawRotated();
}
function showReference(){
function showReference(_param){
url = basepath + "/fileserver/config/reference.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);;
document.getElementById("finerotate").value = 0;
document.getElementById("prerotateangle").value = 0;
document.getElementById("prerotateangle").value = _param["Alignment"]["InitialRotate"].value1;
if (_param["Alignment"]["InitialMirror"].found && (_param["Alignment"]["InitialMirror"].value1 == "true"))
document.getElementById("mirror").checked = true;
document.getElementById("finerotate").disabled = true;
document.getElementById("prerotateangle").disabled = true;
document.getElementById("updatereferenceimage").disabled = true;
document.getElementById("take").disabled = true;
document.getElementById("MakeImage_Brightness_value1").disabled = true;
// document.getElementById("MakeImage_Saturation_value1").disabled = true;
// document.getElementById("MakeImage_Contrast_value1").disabled = true;
document.getElementById("mirror").disabled = false;
if (!(param["MakeImage"]["Brightness"].found))
{
document.getElementById("MakeImage_Brightness_value1").type = "hidden";
document.getElementById("MakeImage_Brightness_text").style.visibility = "hidden";
}
document.getElementById("mirror").disabled = true;
isActReference = true;
loadCanvas(url);
ParseConfig();
drawRotated();
drawRotated(false, true);
}
function dataURLtoBlob(dataurl) {
@@ -131,11 +189,26 @@ table {
function SaveReference(){
if (confirm("Are you sure you want to update the reference image?")) {
setPreRotate(document.getElementById("prerotateangle").value);
setMirror(document.getElementById("mirror").checked);
UpdateConfigFileReferenceChange(basepath);
param["Alignment"]["InitialRotate"].value1 = document.getElementById("prerotateangle").value;
if ((param["Alignment"]["InitialMirror"].found == true) && (document.getElementById("mirror").checked))
param["Alignment"]["InitialMirror"].value1 = "true";
else
param["Alignment"]["InitialMirror"].value1 = "false";
if (param["MakeImage"]["Brightness"].found && param["MakeImage"]["Brightness"].enabled)
{
ReadParameter(param, "MakeImage", "Brightness", false);
// ReadParameter(param, "MakeImage", "Contrast", false);
// ReadParameter(param, "MakeImage", "Saturation", false);
}
var canvas = document.getElementById("canvas");
drawRotated(false);
var textToSave = setConfigParameters(param);
FileDeleteOnServer("/config/config.ini", basepath);
FileSendContent(textToSave, "/config/config.ini", basepath);
SaveCanvasToImage(canvas, "/config/reference.jpg", true, basepath);
showReference();
UpdatePage();
@@ -174,10 +247,75 @@ table {
basepath = getbasepath();
loadConfig(basepath);
ParseConfig();
showReference();
param = getConfigParameters();
UpdateInput();
showReference(param);
}
function drawRotated(_grid = true){
function UpdateInput() {
WriteParameter(param, category, "MakeImage", "Brightness", false);
// WriteParameter(param, category, "MakeImage", "Contrast", false);
// WriteParameter(param, category, "MakeImage", "Saturation", false);
}
function ReadParameter(_param, _cat, _name, _optional, _select = false){
if (_param[_cat][_name]["found"]){
if (_optional) {
_param[_cat][_name]["enabled"] = document.getElementById(_cat+"_"+_name+"_enabled").checked;
}
if (_select) {
var sel = document.getElementById(_cat+"_"+_name+"_value1");
_param[_cat][_name]["value1"] = sel.options[sel.selectedIndex].text;
}
else {
for (var j = 1; j <= _param[_cat][_name]["anzParam"]; ++j) {
_param[_cat][_name]["value"+j] = document.getElementById(_cat+"_"+_name+"_value"+j).value;
}
}
}
}
function WriteParameter(_param, _category, _cat, _name, _optional, _select = false, _anzpara = 1){
if (_param[_cat][_name]["found"]){
if (_optional) {
document.getElementById(_cat+"_"+_name+"_enabled").checked = _param[_cat][_name]["enabled"];
for (var j = 1; j <= _anzpara; ++j) {
document.getElementById(_cat+"_"+_name+"_value"+j).disabled = !_param[_cat][_name]["enabled"];
}
}
document.getElementById(_cat+"_"+_name+"_text").style="color:black;"
if (_select) {
var textToFind = _param[_cat][_name]["value1"];
var dd = document.getElementById(_cat+"_"+_name+"_value1");
for (var i = 0; i < dd.options.length; i++) {
if (dd.options[i].text.toLowerCase() === textToFind.toLowerCase()) {
dd.selectedIndex = i;
break;
}
}
}
else {
for (var j = 1; j <= _anzpara; ++j) {
document.getElementById(_cat+"_"+_name+"_value"+j).value = _param[_cat][_name]["value"+j];
}
}
}
else {
if (_optional) {
document.getElementById(_cat+"_"+_name+"_enabled").disabled = true;
for (var j = 1; j <= _anzpara; ++j) {
document.getElementById(_cat+"_"+_name+"_value"+j).disabled = true;
}
}
document.getElementById(_cat+"_"+_name+"_text").style="color:lightgrey;"
}
}
function drawRotated(_grid = true, _isreference = false){
finerot= parseFloat(document.getElementById("finerotate").value);
prerot = parseFloat(document.getElementById("prerotateangle").value);
mirror = document.getElementById("mirror").checked;
@@ -199,18 +337,26 @@ table {
context.clearRect(0,0,imageObj.width,imageObj.height);
context.save();
if (isActReference)
{
context.drawImage(imageObj,0,0);
}
else
{
if (mirror) {
context.scale(-1, 1);
context.translate(-imageObj.width/2,imageObj.height/2);
context.rotate(-degrees*Math.PI/180);
context.drawImage(imageObj, imageObj.width/2,-imageObj.height/2, -imageObj.width, imageObj.height);
}
else {
context.translate(imageObj.width/2,imageObj.height/2);
context.rotate(degrees*Math.PI/180);
context.drawImage(imageObj,-imageObj.width/2,-imageObj.height/2);
}
}
if (mirror) {
context.scale(-1, 1);
context.translate(-imageObj.width/2,imageObj.height/2);
context.rotate(-degrees*Math.PI/180);
context.drawImage(imageObj, imageObj.width/2,-imageObj.height/2, -imageObj.width, imageObj.height);
}
else {
context.translate(imageObj.width/2,imageObj.height/2);
context.rotate(degrees*Math.PI/180);
context.drawImage(imageObj,-imageObj.width/2,-imageObj.height/2);
}
context.restore();
if (_grid == true && !isActReference){

View File

@@ -22,11 +22,11 @@ p {font-size: 1em;}
<body style="font-family: arial">
<h4>Reference Image</h4>
The reference image is needed to define the digits, counters and references for alignment.
The reference image is the base to define the digits, counters and references positions.
<p>
The last taken raw image from the camera is taken. Use the Button "Create New Reference" to make your own reference.<br>
Most important feature is a straight alignment of the image. Use the Pre roate Angle and the fine alignment to fine tune the rotation of the image<br>
Finish the step by pushing <b>"Update Reference Image"</b>.
Firstly you see the default image. Use the Button "Create New Reference" to start to create your own reference image.<br>
Most important feature is a straight alignment of the image. Use the Pre-rotate angle and the fine alignment to adjust the rotation of the image<br>
Store the reference image by pushing <b>"Update Reference Image"</b>.
</p>
</body>

View File

@@ -8,8 +8,8 @@ function getbasepath(){
if ((host == "127.0.0.1") || (host == "localhost"))
{
// host = "http://192.168.2.118"; // jomjol interner test
host = "http://192.168.178.26"; // jomjol interner test
// host = "http://192.168.178.22"; // jomjol interner Real
// host = "http://192.168.178.26"; // jomjol interner test
host = "http://192.168.178.26"; // jomjol interner Real
// host = "."; // jomjol interner localhost
}

View File

@@ -14,7 +14,9 @@ var digitsEnabled = false;
var posDigitsHeader;
function MakeRefZW(zw, _basepath){
url = _basepath + "/editflow.html?task=cutref&in=/config/reference.jpg&out=/img_tmp/ref_zw_org.jpg&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
_filetarget = zw["name"].replace("/config/", "/img_tmp/");
_filetarget = _filetarget.replace(".jpg", "_org.jpg");
url = _basepath + "/editflow.html?task=cutref&in=/config/reference.jpg&out="+_filetarget+"&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
var xhttp = new XMLHttpRequest();
try {
xhttp.open("GET", url, false);
@@ -22,18 +24,30 @@ function MakeRefZW(zw, _basepath){
catch (error)
{
// alert("Deleting Config.ini failed");
}
FileCopyOnServer("/img_tmp/ref_zw_org.jpg", "/img_tmp/ref_zw.jpg", _basepath);
}
_filetarget2 = zw["name"].replace("/config/", "/img_tmp/");
// _filetarget2 = _filetarget2.replace(".jpg", "_org.jpg");
FileCopyOnServer(_filetarget, _filetarget2, _basepath);
}
function GetCoordinates(index, _basepath){
FileCopyOnServer(ref[index]["name"], "/img_tmp/ref_zw.jpg", _basepath);
function CopyReferenceToImgTmp(_basepath)
{
for (index = 0; index < 2; ++index)
{
_filenamevon = ref[index]["name"];
_filenamenach = _filenamevon.replace("/config/", "/img_tmp/");
FileDeleteOnServer(_filenamenach, _basepath);
FileCopyOnServer(_filenamevon, _filenamenach, _basepath);
_filenamevon = _filenamevon.replace(".jpg", "_org.jpg");
_filenamenach = _filenamenach.replace(".jpg", "_org.jpg");
FileDeleteOnServer(_filenamenach, _basepath);
FileCopyOnServer(_filenamevon, _filenamenach, _basepath);
}
}
FileDeleteOnServer("/img_tmp/ref_zw_org.jpg", _basepath);
var namezw = ref[index]["name"].replace(".jpg", "_org.jpg");
FileCopyOnServer(namezw, "/img_tmp/ref_zw_org.jpg", _basepath);
return ref[index];
function GetReferencesInfo(){
return ref;
}
function ParseConfigAlignment(_aktline){
@@ -321,21 +335,31 @@ function UpdateConfigFileReferenceChange(_basepath){
SaveConfigToServer(_basepath);
}
function UpdateConfig(zw, _index, _enhance, _basepath){
var zeile = zw["name"] + " " + zw["x"] + " " + zw["y"];
var _pos = ref[_index]["pos_ref"];
config_split[_pos] = zeile;
function UpdateConfigReference(zw, _basepath){
for (var index = 0; index < 2; ++index)
{
var zeile = zw[index]["name"] + " " + zw[index]["x"] + " " + zw[index]["y"];
var _pos = zw[index]["pos_ref"];
config_split[_pos] = zeile;
_filenamenach = ref[index]["name"];
_filenamevon = _filenamenach.replace("/config/", "/img_tmp/");
FileDeleteOnServer(_filenamenach, _basepath);
FileCopyOnServer(_filenamevon, _filenamenach, _basepath);
_filenamenach = _filenamenach.replace(".jpg", "_org.jpg");
_filenamevon = _filenamevon.replace(".jpg", "_org.jpg");
FileDeleteOnServer(_filenamenach, _basepath);
FileCopyOnServer(_filenamevon, _filenamenach, _basepath);
}
SaveConfigToServer(_basepath);
var namezw = zw["name"];
FileCopyOnServer("/img_tmp/ref_zw.jpg", namezw, _basepath);
var namezw = zw["name"].replace(".jpg", "_org.jpg");
FileCopyOnServer("/img_tmp/ref_zw_org.jpg", namezw, _basepath);
}
function MakeContrastImageZW(zw, _enhance, _basepath){
url = _basepath + "/editflow.html?task=cutref&in=/config/reference.jpg&out=/img_tmp/ref_zw.jpg" + "&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
_filename = zw["name"].replace("/config/", "/img_tmp/");
url = _basepath + "/editflow.html?task=cutref&in=/config/reference.jpg&out=" + _filename + "&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
if (_enhance == true){
url = url + "&enhance=true";
}

View File

@@ -172,6 +172,7 @@ function loadConfig(_basepath) {
xhttp.open("GET", url, false);
xhttp.send();
config_gesamt = xhttp.responseText;
config_gesamt = config_gesamt.replace("InitalRotate", "InitialRotate"); // Korrigiere Schreibfehler in config.ini !!!!!
}
catch (error)
{

View File

@@ -23,14 +23,20 @@ function ParseConfig() {
ParamAddValue(param, catname, "LogImageLocation");
ParamAddValue(param, catname, "WaitBeforeTakingPicture");
ParamAddValue(param, catname, "LogfileRetentionInDays");
ParamAddValue(param, catname, "Brightness");
ParamAddValue(param, catname, "Contrast");
ParamAddValue(param, catname, "Saturation");
ParamAddValue(param, catname, "ImageQuality");
ParamAddValue(param, catname, "ImageSize");
ParamAddValue(param, catname, "FixedExposure");
var catname = "Alignment";
category[catname] = new Object();
category[catname]["enabled"] = false;
category[catname]["found"] = false;
param[catname] = new Object();
ParamAddValue(param, catname, "InitialRotate");
ParamAddValue(param, catname, "InitialMirror");
ParamAddValue(param, catname, "SearchFieldX");
ParamAddValue(param, catname, "SearchFieldY");
ParamAddValue(param, catname, "AlignmentAlgo");
@@ -184,7 +190,7 @@ function getConfigParameters() {
return param;
}
function setConfigParameters(_param, _category) {
function setConfigParameters(_param, _category = "") {
for (var cat in _param) {
for (var name in _param[cat]) {
param[cat][name]["found"] = _param[cat][name]["found"];

View File

@@ -1,40 +0,0 @@
<!DOCTYPE html>
<html style="width: fit-content">
<head>
<title>jomjol - AI on the edge</title>
<style>
div {
text-align:center;
width:995px;
height: 600px;
}
.iframe_work {
display:inline-block;
margin: 0px auto;
width:70%;
height: 100%;
}
.iframe_info {
display:inline-block;
margin: 0px auto;
width:20%;
height: 100%;
}
</style>
</head>
<body style="font-family: arial">
<div>
<iframe class="iframe_work" name="iframe_work" id="iframe_work" src="/wasserzaehler_roi.html" allowfullscreen></iframe>
<iframe class="iframe_info" name="iframe_info" id="iframe_info" src="/wasserzaehler_roi.html" allowfullscreen></iframe>
</div>
</body>
</html>

View File

@@ -1 +1 @@
5.1.0
6.4.1