WiFlasher/wiflash_esp32/configure.h

83 lines
2.2 KiB
C++

/*
configure.h
Copyright (c) 2020 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef WIFLASH_CONFIGURE_H
#define WIFLASH_CONFIGURE_H
#include <Arduino.h>
#include <WiFi.h>
namespace config {
/*
If this pin is tied LOW at setup(), settings will be defaulted
*/
const uint8_t reset_button = A1; // tie A1 to ground to reset preferances
/*
device configuration
*/
typedef struct {
String ssid;
String pwd;
wifi_mode_t mode;
bool dhcp;
String ip;
String subnet;
String gateway;
String hostname;
String osc_host;
uint16_t osc_port;
String osc_pressed_addr;
String osc_pressed_value;
String osc_released_addr;
String osc_released_value;
bool button_enable;
int button_pin;
bool strobe_enable;
int strobe_led_pin;
uint16_t strobe_universe;
uint16_t strobe_address;
bool strip_enable;
uint16_t strip_led_count;
uint8_t strip_data_pin;
uint16_t strip_universe;
uint16_t strip_address;
} settings_t;
bool loadConfig();
size_t set(const String& key, const String& value);
String getString(const String& key);
const settings_t settings();
} // namespace config
#endif // WIFLASH_CONFIGURE_H