Forum Replies Created

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • in reply to: E220-900T30D No Interrupt #31085
    William
    Moderator

      Have article ready; do you want it uploaded here or somewhere else?

      William

      in reply to: E220-900T30D No Interrupt #30960
      William
      Moderator

        Have E220-Remote_Switch project working; posted to Espressif, ESP32.com, link to project code on Github and a Demo video of E220-Remote-Switch project.

        E220-Remote-Switch Post link

        Respectfully,
        William

        in reply to: E220-900T30D No Interrupt #30937
        William
        Moderator

          Confused with simple Fixed Transmission, Sender example reults.

          Modules configuration was done using Ebyte software application.

          First, used the “Normal connections” to program E220 module, then used “Fully connected” to execute sketch. Sending of message from either Sender or Receiver only produces word “Success”; on module sending message. Message does not appear as the sent word “test”; does not appear on either serial monitor.

          Both Sender and Receiver crash when trying to exeute sketch with “Normal connections”.

          Please explain diffence between the pin connections listed as comments at top of sketch and the pins used in esp32 constructor.

          Both Send and Receiver reported wrong configuration values from what was programmed with Ebyte programming software.

          Best Regards,
          William

          • This reply was modified 5 months, 1 week ago by William. Reason: Clarifcation of early morning post
          in reply to: E220-900T30D No Interrupt #30910
          William
          Moderator

            Function switchOne not sending struct Message members to Sender:

            `void switchOne(int data) {

            if (data == 1) {
            int data = 1;
            Serial.println(“\nBattery Switch is ON”);
            Serial.println(“ESP32 waking from Deep Sleep\n”);
            }

            if (data == 2) {
            int data = 2;
            Serial.println(“\nBattery power switched OFF”);
            Serial.println(“ESP32 going to Deep Sleep\n”);
            }

            Serial.println(“Hi, I’m going to send message!”);

            e220ttl.setMode(MODE_0_NORMAL);
            delay(delayTime);

            get_time();

            Message message;

            //initialize struct members
            message.switchState = data;

            //Initialize the dateTime
            String dateTimeStr = get_time();
            if (!dateTimeStr.isEmpty()) {
            strncpy(message.dateTime, dateTimeStr.c_str(), MAX_dateTime_LENGTH – 1);
            message.dateTime[MAX_dateTime_LENGTH – 1] = ‘\0’; // Ensure null-termination
            }

            Serial.print(“switchState: “); Serial.println(message.switchState);
            Serial.print(“dateTime: “); Serial.println(message.dateTime);

            // Send message
            ResponseStatus rs = e220ttl.sendFixedMessage(0, DESTINATION_ADDL, CHANNEL, &message, sizeof(Message));
            // Check If there is some problem of succesfully send
            Serial.println(rs.getResponseDescription());
            }

            Additionally WOR message is transmitted successfully; Receiver does not respond. Checked pullup resistors; all 3.3V opposite of the 3.3V rail, referenced to ground.

            M0 = 21, M1 = 19, TXD = 17, RXD = 16, AUX = 15 Vcc = 3.3V, and GND = Ground. Pin connections verifed by continuity tests. Modules programmed by Ebyte, RF software. Receiver ADDL 2, Channel 66, Tran Fixed, WOR period 2000ms, Power 30dbm. Sender same except ADDL 3.

            7/6/2024 E220 Project code

            Regards,
            William

            • This reply was modified 5 months, 1 week ago by William. Reason: Correcting text
            in reply to: E220 remote Switch project crash #30865
            William
            Moderator

              @echo9

              String linkAddress = “xxx.xxx.xxx.xxx:80” is left over and for future addition; once I have WOR working. LinkAddress was for port forwarding and a placeholder on an HTML page. When coding I work just on the local area network; no need for port forwarding.

              I have resolved the crashing that I linked to earlier. Issue is being unable to wake ESP32 from deep Sleep.

              @Renzo Mischianti

              “In fixed transmission you must use as destination address the address set in the config of the device that just receive the message.”

              Ebyte RF config software, e220-900T30D Factory default frequency, 868 — user manual
              Receiver: ADDL = 3 Sender: ADDL = 2
              Channel = 66 Channel = 66
              Mode = Fixed Mode = Fixed
              WOR Period = 2000ms WOR Period = 2000ms
              Power = 30 dbm Power = 30 dbm
              Rec. #define Destination_ADDL 2 Sender #define DESTINATION_ADDL 3

              William

              • This reply was modified 5 months, 3 weeks ago by William.
              in reply to: E220 remote Switch project crash #30824
              William
              Moderator

                Made multiple changes; crash issue has been resolved.

                Have question; is the Receiver destination address the same as the configuration address, or is it the destination addresses of the sender module of the configuration address?

                Issue persists where Receiver does not wake up. Have set AUX_PIN as interrupt and enabled ext 0 wakeup and level to 0.

                Powering both Sender and Receiver by 5V, 5 Amp switching power supply.

                When using WOR does TX of E220 to to TXD2 of the ESP32?

                Kind Regards,
                William

                • This reply was modified 6 months ago by William.
                Attachments:
                You must be logged in to view attached files.
                in reply to: RTC_DATA_ATTR Failure #30765
                William
                Moderator

                  5/29/2024 Update: Have been working on the “complex code.” Now have an issue with deep Sleep interrupt; where starting with a press of the reset button on the Receiver response is corect in the Serial Monitor. First url request on Receiver is correct. Interrupt works correctly. “After interrupt:” does print to the Serial Monitor after the first url request. Going on with more url requests; interrupt does not work correctly. Have spent much time trying to get this code to work correctly.

                  Putting together a short 2-3 minute video of the Arduino IDE, Serial Monitor of this code showing url request being made and the Receiver code responses. Will upload video in the morning.

                  GitHub update from today

                  William

                  • This reply was modified 6 months, 3 weeks ago by William.
                  in reply to: RTC_DATA_ATTR Failure #30718
                  William
                  Moderator

                    Update 5/12/2024:

                    Github repository has been updated. Receiver is now able to go to deep sleep; however have not been able to wake up deep sleeping receiver, unable to further test RTC_DATA_ATTR_failure.

                    Github Project Repository

                    This project code does not use Ticker.

                    William

                    • This reply was modified 7 months, 1 week ago by William.
                    in reply to: RTC_DATA_ATTR Failure #30709
                    William
                    Moderator

                      Hi Renzo,

                      Thank you for having a look at the code. Yes, the code is complex.
                      Took another look at my Gist file; found I missed making these corrections: lines: 150 redefination Lora E220, 299, 301, 303 e32ttl should be e220ttl. Testing now…

                      Ticker library is used to get a one minute timer to take from the start code unit the INA226 alerts for a low battery.

                      Could be an interrupt conflick; there are (if memory serves me correctly, three interrupts).

                      William

                      • This reply was modified 7 months, 1 week ago by William.
                      • This reply was modified 7 months, 1 week ago by William. Reason: Additional. Corrections
                      in reply to: v3 Shield Parts List #30336
                      William
                      Moderator

                        Please, provide link to updated parts list.

                        Best Regards,
                        William

                        in reply to: TimeStamp not working #30261
                        William
                        Moderator

                          Thank you Renzo; have it working now.

                          New project is a remote battery monitor with NTP timestamp transmitter to E220 receiver. Have nearly all of the project compeled; except for a “Timeout!!” message on Serial Monitor I did not code, sketch continues to run. Is this a warning from the E220 library? Message occurs between a httpClient function and logBattery function. Have removed all delays; no change.

                          Project logs timestamp, adc reading, and voltage to LittleFS. Going to try and find out how long battery lasts compared to the number of requests made using an automated method of generating GET requests.. conditonal statement determine how often request are made to AsycWebServer. Server switches on live video camera for a predetermined period using a once Ticker timer method.

                          Plan to use a voltage divider of 1 meg ohm and 2 meg ohm; need to aquire the parts. Getting together a shopping list for your shields too. Thanks for creating the shields and your community support!

                          Regards,
                          William

                          • This reply was modified 8 months, 2 weeks ago by William.
                          Attachments:
                          You must be logged in to view attached files.
                          in reply to: WOR Mode1 and Mode 2 current? #30234
                          William
                          Moderator

                            I am seeing one steady and three fast changing currents; meter was inserted in +5 volt supply for the E220-900T30D:

                            11.6 mA Mode 0? ESP32 awake
                            79-69 µA Mode 1? ESP32 deep sleep
                            60-59 µA Mode 2? ESP32 wakeup message
                            1.01 – .26 µA Mode 3? ESP32 deep sleep

                            WOR Cycle is set to WOR_4000_111.

                            Have I made correct observations of Modes?

                            William

                            • This reply was modified 8 months, 2 weeks ago by William. Reason: Changed Mode 2 ESP32 Description
                            in reply to: Ebyte E32 Part 8 article modified for E220 library #30130
                            William
                            Moderator

                              Video E220-900T30D sleep current reading

                              Appears to be three values displayed in sequence; in the uA current range, what is the meter showing? ESP32 was in deep sleep.

                              I have been asked what my video is showing. Also, highest reading increases over time; why?

                              WOR is at default 2000 mS. Current is taken between ESP32 Vin and E220-900T30D device Vcc.

                              William

                              • This reply was modified 8 months, 4 weeks ago by William.
                              • This reply was modified 8 months, 4 weeks ago by William.
                              • This reply was modified 8 months, 4 weeks ago by William.
                              • This reply was modified 8 months, 4 weeks ago by William.
                              • This reply was modified 8 months, 4 weeks ago by William.
                              in reply to: Ebyte E32 Part 8 article modified for E220 library #30083
                              William
                              Moderator

                                Trying to measure current in sleep mode of the E220-900T30D. Current in uA multimeter range is varying from ~1.09 uA to 55 uA while in sleep mode.

                                Video capture of deep sleep uA multimeter readings.

                                What can account for these varying readings?

                                William

                                • This reply was modified 8 months, 4 weeks ago by William.
                                • This reply was modified 8 months, 4 weeks ago by William.
                                in reply to: Ebyte E32 Part 8 article modified for E220 library #30036
                                William
                                Moderator

                                  Comparing E220 library examples I sucessfully modified my exsisting sketches for the nRF24L01+ transceivers.

                                  Thank you for reminder to look at the examples!

                                  E220 transceiver remote switch

                                  Receiver

                                  
                                  //E220_Transceiver_Videofeed_Receiver.ino
                                  //William Lucid 3/11/2024 @ 17:17 EDT
                                  
                                  	
                                  /*
                                   * EBYTE LoRa E32
                                   * Stay in sleep mode and wait a wake up WOR message
                                   *
                                   * You must configure the address with 0 3 23 with WOR receiver enable
                                   * and pay attention that WOR period must be the same of sender
                                   *
                                   *
                                   * https://mischianti.org
                                   *
                                   * E32        ----- esp32
                                   * M0         ----- 19 (or 3.3v)
                                   * M1         ----- 21 (or GND)
                                   * RX         ----- TX2 (PullUP)
                                   * TX         ----- RX2 (PullUP)
                                   * AUX        ----- 15  (PullUP)
                                   * VCC        ----- 3.3v/5v
                                   * GND        ----- GND
                                   *
                                   */
                                   
                                  // with this DESTINATION_ADDL 2 you must set
                                  // WOR SENDER configuration to the other device and
                                  // WOR RECEIVER to this device
                                  #define DESTINATION_ADDL 2
                                   
                                  // If you want use RSSI uncomment //#define ENABLE_RSSI true
                                  // and use relative configuration with RSSI enabled
                                  //#define ENABLE_RSSI true
                                   
                                  #include "Arduino.h"
                                  #include "LoRa_E220.h"
                                  #include <WiFi.h>
                                   
                                  #include "soc/rtc_cntl_reg.h"
                                  #include "soc/rtc.h"
                                  #include "driver/rtc_io.h"
                                  
                                  #define AUX GPIO_NUM_15
                                  
                                  #define relayPin 17
                                  
                                  struct Message {
                                   int switchState;
                                  } message;
                                   
                                  #define FPM_SLEEP_MAX_TIME           0xFFFFFFF
                                  void callback() {
                                    Serial.println("Callback");
                                    Serial.flush();
                                  }
                                  
                                  void print_wakeup_reason() {
                                    esp_sleep_wakeup_cause_t wakeup_reason;
                                  
                                    wakeup_reason = esp_sleep_get_wakeup_cause();
                                  
                                    switch (wakeup_reason) {
                                      case ESP_SLEEP_WAKEUP_EXT0: Serial.println("Wakeup caused by external signal using RTC_IO"); break;
                                      case ESP_SLEEP_WAKEUP_EXT1: Serial.println("Wakeup caused by external signal using RTC_CNTL"); break;
                                      case ESP_SLEEP_WAKEUP_TIMER: Serial.println("Wakeup caused by timer"); break;
                                      case ESP_SLEEP_WAKEUP_TOUCHPAD: Serial.println("Wakeup caused by touchpad"); break;
                                      case ESP_SLEEP_WAKEUP_ULP: Serial.println("Wakeup caused by ULP program"); break;
                                      default: Serial.printf("Wakeup was not caused by deep sleep: %d\n", wakeup_reason); break;
                                    }
                                  }
                                  
                                  int data;
                                  
                                  RTC_DATA_ATTR int bootCount = 0;
                                  
                                  bool interruptExecuted = false;
                                  
                                  void IRAM_ATTR wakeUp() {
                                  	 // Do not use Serial on interrupt callback
                                  	 interruptExecuted = true;
                                  	 detachInterrupt(AUX);
                                  }
                                  
                                  void printParameters(struct Configuration configuration);
                                   
                                  // ---------- esp32 pins --------------
                                  LoRa_E220 e220ttl(&Serial2, 15, 21, 19); //  RX AUX M0 M1
                                   
                                  //LoRa_E32 e220ttl(&Serial2, 22, 4, 18, 21, 19, UART_BPS_RATE_9600); //  esp32 RX <-- e22 TX, esp32 TX --> e22 RX AUX M0 M1
                                  // -------------------------------------
                                   
                                  //The setup function is called once at startup of the sketch
                                  void setup()
                                  {
                                    Serial.begin(9600);
                                    while (!Serial) {
                                        ; // wait for serial port to connect. Needed for native USB
                                    }
                                    delay(100);
                                  
                                    e220ttl.begin();
                                  
                                    e220ttl.setMode(MODE_2_WOR_RECEIVER);
                                  
                                    delay(1000);
                                    Serial.println();
                                    Serial.println("Start deep sleep!");
                                    delay(100);
                                    attachInterrupt(AUX, wakeUp, FALLING);
                                  
                                    esp_sleep_wakeup_cause_t wakeup_reason;
                                  
                                    wakeup_reason = esp_sleep_get_wakeup_cause();
                                  
                                    if (ESP_SLEEP_WAKEUP_EXT0 == wakeup_reason) {
                                        Serial.println("Waked up from external GPIO!");
                                  
                                        gpio_hold_dis(GPIO_NUM_21);
                                        gpio_hold_dis(GPIO_NUM_19);
                                  
                                        gpio_deep_sleep_hold_dis();
                                  
                                        e220ttl.setMode(MODE_0_NORMAL);
                                  
                                        delay(1000);
                                  
                                        e220ttl.sendFixedMessage(0, DESTINATION_ADDL, 23, "We have waked up from message, but we can't read It!");
                                    }else{
                                        e220ttl.setMode(MODE_2_POWER_SAVING);
                                  
                                        delay(1000);
                                    }
                                  }
                                   
                                  // The loop function is called in an endless loop
                                  void loop()
                                  {
                                   
                                      if (e220ttl.available() > 1) {
                                        Serial.println("Message arrived!");
                                        ResponseStructContainer rsc = e220ttl.receiveMessage(sizeof(Message));
                                        struct Message message = *(Message*)rsc.data;
                                  
                                        //Serial.println(*(int*)(message.switchState));
                                        Serial.println(message.switchState); 
                                        free(rsc.data);
                                  
                                        // Work only with full connection
                                        e220ttl.setMode(MODE_0_NORMAL);
                                  
                                        delay(1000);
                                  
                                        ResponseStatus rsSend = e220ttl.sendFixedMessage(0, DESTINATION_ADDL, 23, "We have received the message!");
                                        // Check If there is some problem of succesfully send
                                        Serial.println(rsSend.getResponseDescription());
                                  
                                      if(interruptExecuted){
                                        
                                        Serial.println("WakeUp Callback, AUX pin go LOW and start receive message!");
                                      
                                        if (message.switchState == 1) {
                                          digitalWrite(relayPin, HIGH);
                                          Serial.println("\nBattery power switched ON");
                                          Serial.println("ESP32 wake from Deep Sleep\n");
                                        }
                                        
                                        if (message.switchState == 2) {
                                          digitalWrite(relayPin, LOW);
                                          Serial.println("\nBattery power switched OFF");
                                          Serial.println("ESP32 going to Deep Sleep");
                                          esp_sleep_enable_ext0_wakeup(GPIO_NUM_15,LOW); 
                                          gpio_deep_sleep_hold_en();
                                          //Go to sleep now
                                          Serial.println("Going to sleep now");
                                          esp_deep_sleep_start();
                                          delay(100);
                                          Serial.println("This will never be printed");
                                        }    
                                      }    
                                    }
                                  }
                                  
                                  void printParameters(struct Configuration configuration) {
                                  	Serial.println("----------------------------------------");
                                  
                                  	Serial.print(F("HEAD : "));  Serial.print(configuration.COMMAND, HEX);Serial.print(" ");Serial.print(configuration.STARTING_ADDRESS, HEX);Serial.print(" ");Serial.println(configuration.LENGHT, HEX);
                                  	Serial.println(F(" "));
                                  	Serial.print(F("AddH : "));  Serial.println(configuration.ADDH, HEX);
                                  	Serial.print(F("AddL : "));  Serial.println(configuration.ADDL, HEX);
                                  	Serial.println(F(" "));
                                  	Serial.print(F("Chan : "));  Serial.print(configuration.CHAN, DEC); Serial.print(" -> "); Serial.println(configuration.getChannelDescription());
                                  	Serial.println(F(" "));
                                  	Serial.print(F("SpeedParityBit     : "));  Serial.print(configuration.SPED.uartParity, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTParityDescription());
                                  	Serial.print(F("SpeedUARTDatte     : "));  Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTBaudRateDescription());
                                  	Serial.print(F("SpeedAirDataRate   : "));  Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRateDescription());
                                  	Serial.println(F(" "));
                                  	Serial.print(F("OptionSubPacketSett: "));  Serial.print(configuration.OPTION.subPacketSetting, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getSubPacketSetting());
                                  	Serial.print(F("OptionTranPower    : "));  Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getTransmissionPowerDescription());
                                  	Serial.print(F("OptionRSSIAmbientNo: "));  Serial.print(configuration.OPTION.RSSIAmbientNoise, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getRSSIAmbientNoiseEnable());
                                  	Serial.println(F(" "));
                                  	Serial.print(F("TransModeWORPeriod : "));  Serial.print(configuration.TRANSMISSION_MODE.WORPeriod, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getWORPeriodByParamsDescription());
                                  	Serial.print(F("TransModeEnableLBT : "));  Serial.print(configuration.TRANSMISSION_MODE.enableLBT, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getLBTEnableByteDescription());
                                  	Serial.print(F("TransModeEnableRSSI: "));  Serial.print(configuration.TRANSMISSION_MODE.enableRSSI, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getRSSIEnableByteDescription());
                                  	Serial.print(F("TransModeFixedTrans: "));  Serial.print(configuration.TRANSMISSION_MODE.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getFixedTransmissionDescription());
                                  
                                  	Serial.println("----------------------------------------");
                                  }
                                  
                                  void printModuleInformation(struct ModuleInformation moduleInformation) {
                                  	Serial.println("----------------------------------------");
                                  	Serial.print(F("HEAD: "));  Serial.print(moduleInformation.COMMAND, HEX);Serial.print(" ");Serial.print(moduleInformation.STARTING_ADDRESS, HEX);Serial.print(" ");Serial.println(moduleInformation.LENGHT, DEC);
                                  
                                  	Serial.print(F("Model no.: "));  Serial.println(moduleInformation.model, HEX);
                                  	Serial.print(F("Version  : "));  Serial.println(moduleInformation.version, HEX);
                                  	Serial.print(F("Features : "));  Serial.println(moduleInformation.features, HEX);
                                  	Serial.println("----------------------------------------");
                                  }
                                  

                                  Sender

                                  
                                  //  See library downloads for each library license.
                                  
                                  // With FIXED SENDER configuration
                                  #define DESTINATION_ADDL 3
                                  
                                  #include <Arduino.h>
                                  #include "WiFi.h"
                                  #include "LoRa_E220.h"
                                  #include <AsyncTCP.h>
                                  #include "ESPAsyncWebServer.h"
                                  #include <esp_sleep.h>
                                  #include <Ticker.h>
                                  
                                  #import "index7.h"  //Video feed HTML; do not remove
                                  
                                  // ---------- esp32 pins --------------
                                   LoRa_E220 e220ttl(&Serial2, 15, 21, 19); //  RX AUX M0 M1
                                  
                                  //LoRa_E220 e220ttl(&Serial2, 22, 4, 18, 21, 19, UART_BPS_RATE_9600); //  esp32 RX <-- e220 TX, esp32 TX --> e220 RX AUX M0 M1
                                  // -------------------------------------
                                  
                                  #define AUX GPIO_NUM_15
                                  
                                  // Replace with your network details
                                  const char *ssid = "XXXX";
                                  const char *password = "XXXXXXXX";
                                  
                                  WiFiClient client;
                                  
                                  AsyncWebServer server(80);
                                  
                                  int data;
                                  
                                  struct Message {
                                   int switchState;
                                  } message;
                                   
                                  Ticker oneTick;
                                  Ticker onceTick;
                                  
                                  String linkAddress = "xxx.xxx.xxx.xxx:80";
                                  
                                  portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
                                  
                                  volatile int watchdogCounter;
                                  int totalwatchdogCounter;
                                  int cameraPowerOff = 0;
                                  int watchDog;
                                  
                                  void ISRwatchdog() {
                                  
                                    portENTER_CRITICAL_ISR(&mux);
                                  
                                    watchdogCounter++;
                                  
                                    if (watchdogCounter >= 75) {
                                  
                                      watchDog = 1;
                                    }
                                  
                                    portEXIT_CRITICAL_ISR(&mux);
                                  }
                                  
                                  int cameraFlag;
                                  int needAnotherCountdown = 0;
                                  
                                  void ISRcamera() {
                                    batteryOff();
                                  }
                                  
                                  bool got_interrupt = false;
                                   
                                  void interruptHandler() {
                                    got_interrupt = true;
                                  }  // interruptHandler
                                  
                                  void setup() {
                                  
                                    Serial.begin(9600);
                                    delay(500);
                                    
                                    // Startup all pins and UART
                                    e220ttl.begin();
                                  
                                    e220ttl.setMode(MODE_1_WOR_TRANSMITTER);
                                  
                                    Serial.println("Hi, I'm going to send WOR message!");
                                  
                                    // Send message
                                    ResponseStatus rs = e220ttl.sendFixedMessage(0, DESTINATION_ADDL, 23, "Hello, world? WOR!");
                                    // Check If there is some problem of succesfully send
                                    Serial.println(rs.getResponseDescription());
                                  
                                    //  e220ttl.setMode(MODE_0_NORMAL);
                                  
                                    //  e220ttl.setMode(MODE_0_NORMAL);
                                  
                                    Serial.println("\n\n\nWebserver and");
                                    Serial.println("E220-900T30D Transceiver for turning ON Videofeed\n");
                                  
                                    wifi_Start();
                                  
                                    attachInterrupt(digitalPinToInterrupt(AUX), interruptHandler, FALLING);
                                  
                                    server.on("/relay", HTTP_GET, [](AsyncWebServerRequest *request) {
                                      request->send_P(200, PSTR("text/html"), HTML7, processor7);
                                      data = 1;
                                      needAnotherCountdown = 1;
                                      countdownTrigger();
                                    });
                                  
                                    server.begin();
                                  
                                    oneTick.attach(1.0, ISRwatchdog);  //watchdog  ISR triggers every 1 second
                                  } 
                                  
                                  void loop() {
                                    // If something available
                                    if (e220ttl.available() > 1) {
                                      // read the String message
                                      ResponseContainer rc = e220ttl.receiveMessage();
                                      // Is something goes wrong print error
                                      if (rc.status.code != 1) {
                                        Serial.println(rc.status.getResponseDescription());
                                      } else {
                                        // Print the data received
                                        Serial.println(rc.status.getResponseDescription());
                                        Serial.println(rc.data);
                                      }
                                    }
                                      
                                    if (Serial.available()) {
                                      message.switchState = data;
                                  	  message.switchState = Serial.parseInt();
                                  
                                  	  // Send message
                                  	  ResponseStatus rs = e220ttl.sendFixedMessage(0, 2, 23, &message, sizeof(Message));
                                  
                                  	  // Check If there is some problem of succesfully send
                                  	  Serial.println(rs.getResponseDescription());
                                    }  
                                  }
                                  
                                  String processor7(const String &var) {
                                  
                                    //index7.h
                                  
                                    if (var == F("LINK"))
                                      return linkAddress;
                                  
                                    return String();
                                  }
                                  
                                  void batteryOff() {
                                    int data = 2;
                                    switchOne(data);
                                    oneTick.detach();
                                  }
                                  
                                  void countdownTrigger() {
                                    // Perform countdown actions here
                                    Serial.println("\nCountdown timer triggered!\n");
                                    // Schedule the next countdown if needed
                                    if (needAnotherCountdown == 1) {
                                      onceTick.once(60, ISRcamera);
                                      int data = 1;
                                      switchOne(data);
                                      needAnotherCountdown = 0;
                                    }
                                  }
                                  
                                  void switchOne(int data) {
                                  
                                    if (data == 1) {
                                      int data = 1;
                                      message.switchState = data;
                                      Serial.println("Battery Switch is ON");
                                      Serial.println("ESP32 waking from Deep Sleep\n");
                                    }
                                  
                                    if (data == 2) {
                                      int data = 2;
                                      message.switchState = data;
                                      Serial.println("Battery power switched OFF");
                                      Serial.println("ESP32 going to Deep Sleep\n");
                                    }
                                  
                                  	Serial.println("Hi, I'm going to send message!");
                                  
                                  	// Send message
                                  	ResponseStatus rs = e220ttl.sendFixedMessage(0, DESTINATION_ADDL, 23, &message, sizeof(Message));
                                  	// Check If there is some problem of succesfully send
                                  	Serial.println(rs.getResponseDescription());
                                  }
                                  
                                  void wifi_Start() {
                                  
                                  //Server settings
                                  #define ip { 10, 0, 0, 27 }
                                  #define subnet \
                                    { 255, 255, 255, 0 }
                                  #define gateway \
                                    { 10, 0, 0, 1 }
                                  #define dns \
                                    { 10, 0, 0, 1 }
                                  
                                    WiFi.mode(WIFI_AP_STA);
                                  
                                    Serial.println();
                                    Serial.print("MAC: ");
                                    Serial.println(WiFi.macAddress());
                                  
                                    // We start by connecting to WiFi Station
                                    Serial.print("Connecting to ");
                                    Serial.println(ssid);
                                  
                                    WiFi.begin(ssid, password);
                                    delay(1000);
                                  
                                    //setting the static addresses in function "wifi_Start
                                    IPAddress ip;
                                    IPAddress gateway;
                                    IPAddress subnet;
                                    IPAddress dns;
                                  
                                    WiFi.config(ip, gateway, subnet, dns);
                                  
                                    Serial.println("Web server running. Waiting for the ESP32 IP...");
                                  
                                    // Printing the ESP IP address
                                    Serial.print("Server IP:  ");
                                    Serial.println(WiFi.localIP());
                                    Serial.print("Port:  ");
                                    Serial.println("80");
                                    Serial.print("MAC: ");
                                    Serial.println(WiFi.macAddress());
                                    Serial.print("Wi-Fi Channel: ");
                                    Serial.println(WiFi.channel());
                                    Serial.println("\n");
                                  
                                    delay(500);
                                  
                                    WiFi.waitForConnectResult();
                                  
                                    Serial.printf("Connection result: %d\n", WiFi.waitForConnectResult());
                                  
                                    server.begin();
                                  
                                    if (WiFi.waitForConnectResult() != 3) {
                                      delay(3000);
                                      wifi_Start();
                                    }
                                  }
                                  
                                  void printParameters(struct Configuration configuration) {
                                  	DEBUG_PRINTLN("----------------------------------------");
                                  
                                  	DEBUG_PRINT(F("HEAD : "));  DEBUG_PRINT(configuration.COMMAND, HEX);DEBUG_PRINT(" ");DEBUG_PRINT(configuration.STARTING_ADDRESS, HEX);DEBUG_PRINT(" ");DEBUG_PRINTLN(configuration.LENGHT, HEX);
                                  	DEBUG_PRINTLN(F(" "));
                                  	DEBUG_PRINT(F("AddH : "));  DEBUG_PRINTLN(configuration.ADDH, HEX);
                                  	DEBUG_PRINT(F("AddL : "));  DEBUG_PRINTLN(configuration.ADDL, HEX);
                                  	DEBUG_PRINTLN(F(" "));
                                  	DEBUG_PRINT(F("Chan : "));  DEBUG_PRINT(configuration.CHAN, DEC); DEBUG_PRINT(" -> "); DEBUG_PRINTLN(configuration.getChannelDescription());
                                  	DEBUG_PRINTLN(F(" "));
                                  	DEBUG_PRINT(F("SpeedParityBit     : "));  DEBUG_PRINT(configuration.SPED.uartParity, BIN);DEBUG_PRINT(" -> "); DEBUG_PRINTLN(configuration.SPED.getUARTParityDescription());
                                  	DEBUG_PRINT(F("SpeedUARTDatte     : "));  DEBUG_PRINT(configuration.SPED.uartBaudRate, BIN);DEBUG_PRINT(" -> "); DEBUG_PRINTLN(configuration.SPED.getUARTBaudRateDescription());
                                  	DEBUG_PRINT(F("SpeedAirDataRate   : "));  DEBUG_PRINT(configuration.SPED.airDataRate, BIN);DEBUG_PRINT(" -> "); DEBUG_PRINTLN(configuration.SPED.getAirDataRateDescription());
                                  	DEBUG_PRINTLN(F(" "));
                                  	DEBUG_PRINT(F("OptionSubPacketSett: "));  DEBUG_PRINT(configuration.OPTION.subPacketSetting, BIN);DEBUG_PRINT(" -> "); DEBUG_PRINTLN(configuration.OPTION.getSubPacketSetting());
                                  	DEBUG_PRINT(F("OptionTranPower    : "));  DEBUG_PRINT(configuration.OPTION.transmissionPower, BIN);DEBUG_PRINT(" -> "); DEBUG_PRINTLN(configuration.OPTION.getTransmissionPowerDescription());
                                  	DEBUG_PRINT(F("OptionRSSIAmbientNo: "));  DEBUG_PRINT(configuration.OPTION.RSSIAmbientNoise, BIN);DEBUG_PRINT(" -> "); DEBUG_PRINTLN(configuration.OPTION.getRSSIAmbientNoiseEnable());
                                  	DEBUG_PRINTLN(F(" "));
                                  	DEBUG_PRINT(F("TransModeWORPeriod : "));  DEBUG_PRINT(configuration.TRANSMISSION_MODE.WORPeriod, BIN);DEBUG_PRINT(" -> "); DEBUG_PRINTLN(configuration.TRANSMISSION_MODE.getWORPeriodByParamsDescription());
                                  	DEBUG_PRINT(F("TransModeEnableLBT : "));  DEBUG_PRINT(configuration.TRANSMISSION_MODE.enableLBT, BIN);DEBUG_PRINT(" -> "); DEBUG_PRINTLN(configuration.TRANSMISSION_MODE.getLBTEnableByteDescription());
                                  	DEBUG_PRINT(F("TransModeEnableRSSI: "));  DEBUG_PRINT(configuration.TRANSMISSION_MODE.enableRSSI, BIN);DEBUG_PRINT(" -> "); DEBUG_PRINTLN(configuration.TRANSMISSION_MODE.getRSSIEnableByteDescription());
                                  	DEBUG_PRINT(F("TransModeFixedTrans: "));  DEBUG_PRINT(configuration.TRANSMISSION_MODE.fixedTransmission, BIN);DEBUG_PRINT(" -> "); DEBUG_PRINTLN(configuration.TRANSMISSION_MODE.getFixedTransmissionDescription());
                                  
                                  	DEBUG_PRINTLN("----------------------------------------");
                                  }
                                  
                                  void printModuleInformation(struct ModuleInformation moduleInformation) {
                                  	Serial.println("----------------------------------------");
                                  	DEBUG_PRINT(F("HEAD: "));  DEBUG_PRINT(moduleInformation.COMMAND, HEX);DEBUG_PRINT(" ");DEBUG_PRINT(moduleInformation.STARTING_ADDRESS, HEX);DEBUG_PRINT(" ");DEBUG_PRINTLN(moduleInformation.LENGHT, DEC);
                                  
                                  	Serial.print(F("Model no.: "));  Serial.println(moduleInformation.model, HEX);
                                  	Serial.print(F("Version  : "));  Serial.println(moduleInformation.version, HEX);
                                  	Serial.print(F("Features : "));  Serial.println(moduleInformation.features, HEX);
                                  	Serial.println("----------------------------------------");
                                  }
                                  

                                  index7.h

                                  
                                  //index7.h
                                  const char HTML7[] PROGMEM = R"====(
                                  <!DOCTYPE html>
                                  <html>
                                  <head>
                                    <meta name="viewport" content="width=device-width, initial-scale=1">
                                  </head>
                                  <body>
                                    <div class="container">
                                      <header>
                                        <br><br>This is original H264 video encoded by IP camera; server doesn't do any transcoding.  Wyze Cam v3 video feeds
                                        <br>Wyze-Bridge Docker, container; which provides webRTC video URL.  Camera maybe offline; depending on battery discharge state.
                                        <br><br>
                                      </header>
                                      <main>
                                        <iframe class="iframe" width="1300" height="731"src="http://xxxxxx:port/cameraname/" frameborder="0"></iframe> 
                                      </main>
                                      <footer>
                                        <h2><a href="server return link goes here... " >ESP32 Server</a></h2>  
                                      </footer>
                                    </div>
                                  </body>
                                  </html>
                                  )====";
                                  
                                Viewing 15 posts - 1 through 15 (of 18 total)