Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom page addition matching current layout and format #1719

Open
letis009 opened this issue Mar 11, 2024 · 0 comments
Open

Custom page addition matching current layout and format #1719

letis009 opened this issue Mar 11, 2024 · 0 comments

Comments

@letis009
Copy link

Basic Infos

Awesome library guys. really is a lifesaver.
Feature request maybe or just missing instructions.
We looking to use CSS format set in Main and PARAMS,
going to /custom presents a blank page with text, is there a method to use all the styles and scripts from index and params ?

I have already added backgrounds and icons to styling but do I need to duplicate the entire page in code again ?

Hardware

WiFimanager Branch/Release: Master

Esp8266/Esp32: ESP32c3

Hardware: Custom ESP32C3 board

Description

Problem description

Settings in IDE

Arduino Release v2.0.14 based on ESP-IDF v4.4.6

Module: esp32c3

Additional libraries:

Sketch

#BEGIN
#include <Arduino.h>
#include "WiFiManager.h"

void saveWifiCallback(){
  Serial.println("[CALLBACK] saveCallback fired");
}

//gets called when WiFiManager enters configuration mode
void configModeCallback (WiFiManager *myWiFiManager) {
  Serial.println("[CALLBACK] configModeCallback fired");
  // myWiFiManager->setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0)); 
  // Serial.println(WiFi.softAPIP());
  //if you used auto generated SSID, print it
  // Serial.println(myWiFiManager->getConfigPortalSSID());
  // 
  // esp_wifi_set_bandwidth(WIFI_IF_AP, WIFI_BW_HT20);
}

void handleRoute(){
  Serial.println("[HTTP] handle route");
  wm.server->send(200, "text/plain", "hello from user code");
}

void bindServerCallback(){
  wm.server->on("/custom",handleRoute); // this is now crashing esp32 for some reason
  // wm.server->on("/info",handleRoute); // you can override wm!
}
void setup() {
    wm.setWebServerCallback(bindServerCallback);
    wm.setCustomHeadElement(icon);
    wm.setCustomHeadElement(base64img);
    const char* menuhtml = "<form action='/custom' method='get'><button>Advanced</button></form><br/>\n";
    wm.setCustomMenuHTML(menuhtml);
    std::vector<const char *> menu = {"wifi", "update", "info", "param", "custom", "sep", "restart", "exit"};
    wm.setMenu(menu);
}

void loop() {

}
#END

Debug Messages

messages here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant