mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 10:19:29 +02:00
Moving secrets from USER_SETTINGS to USER_SECRETS.h
This commit is contained in:
parent
f8bb4c8641
commit
8870027d75
6 changed files with 25 additions and 12 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -22,3 +22,6 @@ compile.bat
|
||||||
|
|
||||||
# Ignore binary files
|
# Ignore binary files
|
||||||
*.bin
|
*.bin
|
||||||
|
|
||||||
|
# Ignore secret file
|
||||||
|
USER_SECRETS.h
|
|
@ -54,7 +54,8 @@ For more examples showing wiring, see each battery types own Wiki page. For inst
|
||||||
5. The Arduino board should be set to `ESP32 Dev Module` (under `Tools` -> `Board` -> `ESP32 Arduino`) with the following settings:
|
5. The Arduino board should be set to `ESP32 Dev Module` (under `Tools` -> `Board` -> `ESP32 Arduino`) with the following settings:
|
||||||

|

|
||||||
6. Select which battery type you will use, along with other optional settings. This is done in the `USER_SETTINGS.h` file.
|
6. Select which battery type you will use, along with other optional settings. This is done in the `USER_SETTINGS.h` file.
|
||||||
7. Press `Verify` and `Upload` to send the sketch to the board.
|
7. Copy the `USER_SECRETS.TEMPLATE.h` file to `USER_SECRETS.h` and update relevant secrets.
|
||||||
|
8. Press `Verify` and `Upload` to send the sketch to the board.
|
||||||
NOTE: In some cases, the LilyGo must be powered through the main power connector instead of USB-C
|
NOTE: In some cases, the LilyGo must be powered through the main power connector instead of USB-C
|
||||||
when performing the initial firmware upload.
|
when performing the initial firmware upload.
|
||||||
NOTE: On Mac, the following USB driver may need to be installed: https://github.com/WCHSoftGroup/ch34xser_macos
|
NOTE: On Mac, the following USB driver may need to be installed: https://github.com/WCHSoftGroup/ch34xser_macos
|
||||||
|
|
8
Software/USER_SECRETS.TEMPLATE.h
Normal file
8
Software/USER_SECRETS.TEMPLATE.h
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#define WIFI_SSID "REPLACE_WITH_YOUR_SSID" // Maximum of 63 characters
|
||||||
|
#define WIFI_PASSWORD "REPLACE_WITH_YOUR_PASSWORD" // Minimum of 8 characters
|
||||||
|
#define AP_PASSWORD "123456789" // Minimum of 8 characters; set to blank if you want the access point to be open
|
||||||
|
#define HTTP_USERNAME "admin" // username to webserver authentication;
|
||||||
|
#define HTTP_PASSWORD "admin" // password to webserver authentication;
|
||||||
|
#define MQTT_SERVER "192.168.xxx.yyy" // mqtt server address
|
||||||
|
#define MQTT_USER NULL // mqtt username, leave blank for no authentication
|
||||||
|
#define MQTT_PASSWORD NULL // mqtt password, leave blank for no authentication
|
|
@ -1,5 +1,6 @@
|
||||||
#include "USER_SETTINGS.h"
|
#include "USER_SETTINGS.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "USER_SECRETS.h"
|
||||||
#include "src/devboard/hal/hal.h"
|
#include "src/devboard/hal/hal.h"
|
||||||
|
|
||||||
/* This file contains all the battery settings and limits */
|
/* This file contains all the battery settings and limits */
|
||||||
|
@ -22,10 +23,10 @@ volatile CAN_Configuration can_config = {
|
||||||
#ifdef WIFI
|
#ifdef WIFI
|
||||||
|
|
||||||
volatile uint8_t AccessPointEnabled = true; //Set to either true/false to enable direct wifi access point
|
volatile uint8_t AccessPointEnabled = true; //Set to either true/false to enable direct wifi access point
|
||||||
std::string ssid = "REPLACE_WITH_YOUR_SSID"; // Maximum of 63 characters
|
std::string ssid = WIFI_SSID; // Set in USER_SECRETS.h
|
||||||
std::string password = "REPLACE_WITH_YOUR_PASSWORD"; // Minimum of 8 characters
|
std::string password = WIFI_PASSWORD; // Set in USER_SECRETS.h
|
||||||
const char* ssidAP = "Battery Emulator"; // Maximum of 63 characters, also used for device name on web interface
|
const char* ssidAP = "Battery Emulator"; // Maximum of 63 characters, also used for device name on web interface
|
||||||
const char* passwordAP = "123456789"; // Minimum of 8 characters; set to NULL if you want the access point to be open
|
const char* passwordAP = AP_PASSWORD; // Set in USER_SECRETS.h
|
||||||
const uint8_t wifi_channel = 0; // Set to 0 for automatic channel selection
|
const uint8_t wifi_channel = 0; // Set to 0 for automatic channel selection
|
||||||
|
|
||||||
#ifdef WIFICONFIG
|
#ifdef WIFICONFIG
|
||||||
|
@ -37,14 +38,14 @@ IPAddress gateway(192, 168, 10, 1);
|
||||||
IPAddress subnet(255, 255, 255, 0);
|
IPAddress subnet(255, 255, 255, 0);
|
||||||
#endif
|
#endif
|
||||||
#ifdef WEBSERVER
|
#ifdef WEBSERVER
|
||||||
const char* http_username = "admin"; // username to webserver authentication;
|
const char* http_username = HTTP_USERNAME; // Set in USER_SECRETS.h
|
||||||
const char* http_password = "admin"; // password to webserver authentication;
|
const char* http_password = HTTP_PASSWORD; // Set in USER_SECRETS.h
|
||||||
|
|
||||||
#endif // WEBSERVER
|
#endif // WEBSERVER
|
||||||
// MQTT
|
// MQTT
|
||||||
#ifdef MQTT
|
#ifdef MQTT
|
||||||
const char* mqtt_user = "REDACTED"; // Set NULL for no username
|
const char* mqtt_user = MQTT_USER; // Set in USER_SECRETS.h
|
||||||
const char* mqtt_password = "REDACTED"; // Set NULL for no password
|
const char* mqtt_password = MQTT_PASSWORD; // Set in USER_SECRETS.h
|
||||||
#ifdef MQTT_MANUAL_TOPIC_OBJECT_NAME
|
#ifdef MQTT_MANUAL_TOPIC_OBJECT_NAME
|
||||||
const char* mqtt_topic_name =
|
const char* mqtt_topic_name =
|
||||||
"BE"; // Custom MQTT topic name. Previously, the name was automatically set to "battery-emulator_esp32-XXXXXX"
|
"BE"; // Custom MQTT topic name. Previously, the name was automatically set to "battery-emulator_esp32-XXXXXX"
|
||||||
|
|
|
@ -92,7 +92,6 @@
|
||||||
|
|
||||||
/* MQTT options */
|
/* MQTT options */
|
||||||
// #define MQTT // Enable this line to enable MQTT
|
// #define MQTT // Enable this line to enable MQTT
|
||||||
#define MQTT_SERVER "192.168.xxx.yyy"
|
|
||||||
#define MQTT_PORT 1883
|
#define MQTT_PORT 1883
|
||||||
#define MQTT_MANUAL_TOPIC_OBJECT_NAME // Enable this to use custom MQTT topic, object ID prefix, and device name. \
|
#define MQTT_MANUAL_TOPIC_OBJECT_NAME // Enable this to use custom MQTT topic, object ID prefix, and device name. \
|
||||||
// WARNING: If this is not defined, the previous default naming format \
|
// WARNING: If this is not defined, the previous default naming format \
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <freertos/FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
|
#include "../../../USER_SECRETS.h"
|
||||||
#include "../../../USER_SETTINGS.h"
|
#include "../../../USER_SETTINGS.h"
|
||||||
#include "../../battery/BATTERIES.h"
|
#include "../../battery/BATTERIES.h"
|
||||||
#include "../../datalayer/datalayer.h"
|
#include "../../datalayer/datalayer.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue