From 1154ff04f6e88389a2dd83665d24f4f420da7d4f Mon Sep 17 00:00:00 2001 From: Michael Clemens // DK1MI Date: Sun, 7 May 2023 05:43:25 +0000 Subject: [PATCH] =?UTF-8?q?=E2=80=9Ewt32pamon.ino=E2=80=9C=20=C3=A4ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wt32pamon.ino | 77 +++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 45 deletions(-) diff --git a/wt32pamon.ino b/wt32pamon.ino index 0a83baa..b242326 100644 --- a/wt32pamon.ino +++ b/wt32pamon.ino @@ -42,8 +42,8 @@ // Debug Level from 0 to 4 #define _ETHERNET_WEBSERVER_LOGLEVEL_ 3 -#define NO 0 -#define YES 1 +//#define NO 0 +//#define YES 1 #include #include "index.h" // Main Web page header file @@ -81,23 +81,20 @@ int IO4_REF = 4; WebServer server(80); // Select the IP address according to your local network -IPAddress myIP(192, 168, 88, 247); -IPAddress myGW(192, 168, 88, 1); -IPAddress mySN(255, 255, 255, 0); +//IPAddress myIP(192, 168, 88, 247); +//IPAddress myGW(192, 168, 88, 1); +//IPAddress mySN(255, 255, 255, 0); // Google DNS Server IP -IPAddress myDNS(8, 8, 8, 8); +//IPAddress myDNS(8, 8, 8, 8); int millivolt_to_dbm(int mv) { int last = 0; for (int i=0; i<3400; i++) { unsigned int stored_val = translation.getUInt(String(i).c_str(), 0); - //Serial.print(String(stored_val)); if (stored_val > 0) { - //Serial.print(String(stored_val)); if (i < mv) { - //Serial.print("bigger"); last = stored_val; } else { break; @@ -156,34 +153,20 @@ void handleNotFound() server.send(404, F("text/plain"), message); } -void handleFWD() { +void handleDATA() { read_directional_couplers(); - //String fwdValue = String(voltage_fwd); - //String fwdPower = String(millivolt_to_milliwatt(voltage_fwd)); - //String output = String(voltage_fwd) + "/" + String(fwd_power); - String output = String(fwd_power); - server.send(200, "text/plane", output); //Send ADC value only to client ajax request -} -void handleREF() { - read_directional_couplers(); - //String refValue = String(voltage_ref); - //String refPower = String(millivolt_to_milliwatt(voltage_ref)); - //String output = String(voltage_ref) + "/" + String(ref_power); - String output = String(ref_power); - server.send(200, "text/plane", output); //Send ADC value only to client ajax request -} - -void handleSWR(){ - read_directional_couplers(); - double swr = (1 + sqrt(ref_power/fwd_power)) / (1 - sqrt(ref_power/fwd_power)); - server.send(200, "text/plane", String(swr)); //Send ADC value only to client ajax reques -} - -void handleTEMP() { + // get temp int a = (temprature_sens_read() - 32) / 1.8; String tempValue = String(a); - server.send(200, "text/plane", tempValue); //Send ADC value only to client ajax request + + // calculate SWR + double swr = (1 + sqrt(ref_power/fwd_power)) / (1 - sqrt(ref_power/fwd_power)); + + String band = "13cm"; + + String output = String(fwd_power) + "," + String(voltage_fwd) + "," + String(ref_power) + "," + String(voltage_ref) + "," + String(swr) + "," + tempValue + "," + band; + server.send(200, "text/plane", output); //Send ADC value only to client ajax request } void handleCONFIG() { @@ -195,22 +178,26 @@ void handleCONFIG() { } conf_content = "\r\n"; + conf_content += ""; conf_content += "

Configuration

"; conf_content += "

"; - conf_content += "

Translation from mV to dBm

"; + conf_content += "

Translation Detector voltage /mV to RF-Power level /dBm

"; conf_content += conf_translate_table; conf_content += "

"; conf_content += "

General Configuration Items

"; conf_content += "

"; conf_content += conf_config_table; - conf_content += "

"; + conf_content += "

"; conf_content += ""; server.send(200, "text/html", conf_content); } void build_translate_table() { conf_translate_table = "
"; - conf_translate_table += ""; + conf_translate_table += "
"; conf_translate_table += ""; for (int i=0; i<3400; i++) { @@ -221,18 +208,18 @@ void build_translate_table() { conf_translate_table += ""; } } - conf_translate_table += ""; + conf_translate_table += ""; conf_translate_table += "
millivolt (mV)decibel-milliwatts (dBm)Action
"; conf_translate_table += String(stored_val); conf_translate_table += ""; - conf_translate_table += ""; + conf_translate_table += ""; conf_translate_table += "
"; handleCONFIG(); } void build_config_table() { conf_config_table = "
"; - conf_config_table += ""; + conf_config_table += "
"; conf_config_table += ""; for (int i=0; i
KeyValueAction