customize - r41d/ClusterDuck-Protocol GitHub Wiki

Full API documentation can be found here

Edit the Duck's

The default Mama Example has a class duck.setupwithdefaults() that sets up the minimum classed needed to use a MamaDuck, is sets up the following methods.

setupRadio(); setupWifi(); setupDns(); setupWebServer(); setupOTA();

You can customize your Mamaduck by using the Custom Mama Example, Pass in the correct values to the methods as shown below.

Change Captive Portal name

You can change the SSID of the duck by passing in a new SSID in the setup.

#include <MamaDuck.h>

// create a MamaDuck Instance
MamaDuck duck = MamaDuck();

void setup(){

  // Change the Duck SSID
  duck.setupWifi(const char * ap = "DUCK CUSTOM SSID");

}

Change the Serial BaudRate

Chnage the baud rate, baudRate default: 115200

#include <MamaDuck.h>

// create a MamaDuck Instance
MamaDuck duck = MamaDuck();

void setup(){

  // Change the Serial BaudRate
  duck.setupRadio(int baudRate = 115200)

}

Change the Lora Radio Configuration

All of our supported development boards are defined in the CDPCFG.hif you want to add another LoRa configuration to the setup us the following method:

#include <MamaDuck.h>

// create a MamaDuck Instance
MamaDuck duck = MamaDuck();

// LORA RF CONFIG
#define LORA_FREQ 915.0 // Frequency Range. Set for US Region 915.0Mhz
#define LORA_TXPOWER 20 // Transmit Power
#define LORA_CS_PIN 18
#define LORA_DIO0_PIN 26
#define LORA_DIO1_PIN -1 // unused
#define LORA_RST_PIN 14

void setup(){

  // Change the Serial BaudRate
  duck.setupRadio(LORA_FREQ, LORA_CS_PIN, LORA_RST_PIN, LORA_DIO0_PIN, LORA_DIO1_PIN, LORA_TXPOWER);	

}

Change the Captive Portal

By default, every Duck has a Simple captive Portal that shows a simple message box for info. If you want to change the Captive Portal you can pass in a different portal in the duck.setupWebserver(); setup. There is a Custom Portal Example that sets up an Emergency portal which you can modify yourself.

#include <MamaDuck.h>
// You can build and modify your own Captive Portal by making edits to emergencyPortal.h 
#include "Portal.h"

// create a MamaDuck Instance
MamaDuck duck = MamaDuck();



void setup(){

 // initialize web server, enabling the captive portal and pass in a Custom Captive portal from Portal.h
  duck.setupWebServer(true,CustomPortal);	

}

You will need to have a PORTAL.h inside of your sketch folder and needs to look something like this;

#ifndef PORTAL_H
#define PORTAL_H

const char CustomPortal[] PROGMEM = R"=====(
<!DOCTYPE html>
<HTML>
// YOUR HTML PORTAL
</html>
)=====";

#endif
⚠️ **GitHub.com Fallback** ⚠️