Giter VIP home page Giter VIP logo

Comments (4)

Hieromon avatar Hieromon commented on June 29, 2024
  1. Uniqueization of APID is possible even of the current release
AutoConnectConfig config;
config.apid = String(AUTOCONNECT_APID)+"_"+String(ESP.getChipId(),HEX));
portal.config(config);
portal.begin();
  1. hostname
    I accept your proposal. I prepare like as:
AutoConnectConfig config;
config.apid = String(AUTOCONNECT_APID)+"_"+String(ESP.getChipId(),HEX)); // If you want
config.hostname = "name_of_host";
portal.config(config);
portal.begin();

so, WiFi.hostname() behaves with the hostname contained in the AutoConnectConfig before first WiFi.begin().

from autoconnect.

ageurtse avatar ageurtse commented on June 29, 2024

Great to here about accepting the hostname config.

when trying out the code from the first point, i become a wdt error.
Can't figure out what causes it.

here is a part of the serial log.

[AC] WiFi.begin()
[AC] Connecting.[AC] established IP:192.168.1.207

 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
vbb28d4a3
~ld

[AC] WiFi.config(IP=0.0.0.0, Gateway=0.0.0.0, Subnetmask=0.0.0.0, DNS1=0.0.0.0, DNS2=0.0.0.0) [AC] DHCP client(STARTED)
[AC] WiFi.begin()
[AC] Connecting.[AC] established IP:192.168.1.207```

and this is the code

/*
Simple.ino, Example for the AutoConnect library.
Copyright (c) 2018, Hieromon Ikasamo
https://github.com/Hieromon/AutoConnect

This software is released under the MIT License.
https://opensource.org/licenses/MIT
*/

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <AutoConnect.h>
#include <ArduinoOTA.h>
#include <ESP8266HTTPUpdateServer.h>
#include <ESP8266mDNS.h>

ESP8266WebServer Server;
AutoConnect Portal(Server);
ESP8266HTTPUpdateServer UpdateServer;
AutoConnectConfig config;

void rootPage() {
String content =
""
""
"<meta name="viewport" content="width=device-width, initial-scale=1">"
""
""
"<h2 align="center" style="color:blue;margin:20px;">Hello, world"
"<p style="padding-top:10px;text-align:center">" AUTOCONNECT_LINK(COG_32) "

"
""
"";
Server.send(200, "text/html", content);
}

void StartOTAServer (){
//Starting Update Server
ArduinoOTA.onStart( {
String type;
if (ArduinoOTA.getCommand() == U_FLASH) {
type = "sketch";
} else { // U_SPIFFS
type = "filesystem";
}

       // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
       Serial.println("Start updating " + type);
     });
     ArduinoOTA.onEnd([]() {
       Serial.println("\nEnd");
     });
     ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
       Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
     });
     ArduinoOTA.onError([](ota_error_t error) {
       Serial.printf("Error[%u]: ", error);
       if (error == OTA_AUTH_ERROR) {
         Serial.println("Auth Failed");
       } else if (error == OTA_BEGIN_ERROR) {
         Serial.println("Begin Failed");
       } else if (error == OTA_CONNECT_ERROR) {
         Serial.println("Connect Failed");
       } else if (error == OTA_RECEIVE_ERROR) {
         Serial.println("Receive Failed");
       } else if (error == OTA_END_ERROR) {
         Serial.println("End Failed");
       }
     });
     ArduinoOTA.begin();

     Serial.println("OTA server started.");

}

void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();

// config.apid = String(AUTOCONNECT_APID)+"______"+String(ESP.getChipId(),HEX);

UpdateServer.setup(&Server);

config.apid = String(AUTOCONNECT_APID)+"_"+String(ESP.getChipId(),HEX);
Portal.config(config);

Server.on("/", rootPage);
if (Portal.begin()) {
Serial.println("WiFi connected: " + WiFi.localIP().toString());
StartOTAServer();

//Added by AJG, the device will be acsabible from [name].local

// char __dataFileName[sizeof(Portal.AP_hostname)];
// Portal.AP_hostname.toCharArray(__dataFileName, sizeof(__dataFileName));
// MDNS.begin(__dataFileName );

}
}

void loop() {
Portal.handleClient();
ArduinoOTA.handle();
}

from autoconnect.

ageurtse avatar ageurtse commented on June 29, 2024

a little update, when ussing AutoConnect-enhance-AutoConnectAux lib. the sketch is working fine.

Are there more new things in this lib that i can try.

i saw that you aded hostname :)

from autoconnect.

Hieromon avatar Hieromon commented on June 29, 2024

Are there more new things in this lib that i can try.

It is the development branch, I updated the branch with a version you can evaluate the development situation. However, some rework is necessary and the documentation is not yet.
You can try the custom parameters handling by the mqttRSSI example.
This version is ArduinoJson required. If you don't have it, please install the ArduinoJson library v5.

from autoconnect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.