From: Ole Artz Date: Tue, 7 Jun 2022 09:28:46 +0000 (+0200) Subject: LANTelnetToI2C_Board: upgrade the register numbering cause board extend the mdc dcdc... X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=f76d5b8266efcc35fc9847166ca927425856aa2d;p=avr.git LANTelnetToI2C_Board: upgrade the register numbering cause board extend the mdc dcdc powerboard functions and related the quickstart --- diff --git a/esp32/EthernetUART/LANTelnetToI2C_Board/LANTelnetToI2C_Board.ino b/esp32/EthernetUART/LANTelnetToI2C_Board/LANTelnetToI2C_Board.ino index 8363a5b..fe631d5 100644 --- a/esp32/EthernetUART/LANTelnetToI2C_Board/LANTelnetToI2C_Board.ino +++ b/esp32/EthernetUART/LANTelnetToI2C_Board/LANTelnetToI2C_Board.ino @@ -9,7 +9,7 @@ # ### ### # # ### author: O.Artz ### # # ### ### # -# ### UPDATE 2022-01-20 ### # +# ### UPDATE 2022-06-07 ### # # ### ### # ##################################################### @@ -126,6 +126,7 @@ String possible_units[] = {"mV", "mA", "mbar", "degC"}; String unit; void WiFiEvent(WiFiEvent_t event) { + // ensure the ethernet connection (status) switch (event) { case SYSTEM_EVENT_ETH_START: Serial.println("ETH Started"); @@ -177,7 +178,7 @@ void WiFiEvent(WiFiEvent_t event) { } void start_telnet() { - // for Telnet Server Connection + // start Telnet Server Connection pinMode(2, OUTPUT); // yellow LED pinMode(15, OUTPUT); // green LED Serial.begin(115200); @@ -200,6 +201,7 @@ void start_telnet() { } void setup() { + //initalize the board start_telnet(); // for I2C Connection Wire.begin(SDA, SCL); // Initiate the Wire library @@ -271,6 +273,7 @@ void restart_screen() { } void start_screen() { + // show ikf logo and initials of the programmer display.clearDisplay(); display.setTextSize(1); // Normal 1:1 pixel scale display.setTextColor(SSD1306_WHITE); // Draw white text @@ -291,6 +294,7 @@ void start_screen() { } void connection_screen() { + // show all connection relevant parameters display.clearDisplay(); display.setTextSize(1); // Normal 1:1 pixel scale display.setTextColor(SSD1306_WHITE); // Draw white text @@ -310,6 +314,7 @@ void connection_screen() { } void test_screen() { + // used as a test case display.clearDisplay(); display.setTextSize(1); // Normal 1:1 pixel scale display.setTextColor(SSD1306_WHITE); // Draw white text @@ -323,6 +328,7 @@ void test_screen() { } void show_CH(String unit) { + // show the position of the measured adc values by their label name and the acutally set unit globaly display.clearDisplay(); display.setTextSize(2); // Normal 1:1 pixel scale @@ -348,6 +354,7 @@ void show_CH(String unit) { } void show_VAL(int dadc0, int dadc1, int dadc2, int dadc3, String unit) { + // show the measured adc values and the global unit display.clearDisplay(); display.setTextSize(2); // Normal 1:1 pixel scale @@ -373,7 +380,7 @@ void show_VAL(int dadc0, int dadc1, int dadc2, int dadc3, String unit) { } void loop() { - // for Telnet Server Connection + // for recieving and transmitting by Telnet Server Connection uint8_t i; if (eth_connected == true) { // check if there are any new clients @@ -426,6 +433,7 @@ void loop() { } void set_offset(int16_t new_offset_val, int chan_offset_num) { + // to calibrate the channels with an offset value if (chan_offset_num == 0) { offset0 = new_offset_val; } else if (chan_offset_num == 1) { @@ -443,14 +451,17 @@ void set_offset(int16_t new_offset_val, int chan_offset_num) { } void set_voltage_divider_factor(float new_vol_div_fac) { + // to set the correct voltage divider factor vol_div_fac = new_vol_div_fac/1000.0; } void set_device_transformation_factor(float new_dev_trans_fac) { + // to transformate adc values in device values (units) dev_trans_fac = new_dev_trans_fac/1000.0; } void set_unit(uint8_t new_unit) { + // to change the unit w/o changing transformationfactor. only for visuals unit = possible_units[new_unit]; } @@ -628,8 +639,8 @@ void getdata(uint8_t buf) { // write if (rxbuf[0] == 'W') { - // ADCsettings - if (hex_to_int(rxbuf[5]) == 9) { + // ADC Settings + if (hex_to_int(rxbuf[5]) == 10) { // uint8_t val = // (hex_to_int(rxbuf[7])*16+hex_to_int(rxbuf[8]))&0xFF; new_gain = (hex_to_int(rxbuf[9])); @@ -637,6 +648,7 @@ void getdata(uint8_t buf) { send_answer_hex(&rxbuf[0], new_gain); } + // Device Settings if (hex_to_int(rxbuf[5]) == 11) { //units if (hex_to_int(rxbuf[4]) == 0) { @@ -675,7 +687,7 @@ void getdata(uint8_t buf) { // read if (rxbuf[0] == 'R'){ // read single ADC Channel - if (hex_to_int(rxbuf[5]) == 10) { + if (hex_to_int(rxbuf[5]) == 13) { uint16_t adc_val = 0xFFFF; // CH0 if (hex_to_int(rxbuf[4]) == 0) { diff --git a/esp32/EthernetUART/LANTelnetToI2C_Board/quickstart 4CH ADC_Ethernet Portable Board.pdf b/esp32/EthernetUART/LANTelnetToI2C_Board/quickstart 4CH ADC_Ethernet Portable Board.pdf index ec1532d..a51eb1c 100644 Binary files a/esp32/EthernetUART/LANTelnetToI2C_Board/quickstart 4CH ADC_Ethernet Portable Board.pdf and b/esp32/EthernetUART/LANTelnetToI2C_Board/quickstart 4CH ADC_Ethernet Portable Board.pdf differ