Added code for floaty hardware option

This commit is contained in:
Magnus Persson 2022-11-06 11:14:40 +01:00
parent 09ffcba84e
commit 29d6486743
8 changed files with 79 additions and 2 deletions

View File

@ -148,6 +148,7 @@ build_flags =
-DCORE_DEBUG_LEVEL=0
-DESP32C3
-DARDUINO_ESP32C3_DEV
-DREDUCE_WIFI_POWER # Enable this if v1.0 chip is used
#-DUSE_SERIAL_PINS # Use the TX/RX pins for the serial port
lib_deps =
${common_env_data.lib_deps}
@ -246,3 +247,36 @@ board_build.embed_txtfiles =
html/index.min.htm
html/test.min.htm
# This is a version for the floaty hardware. No DSB18 sensor and no battery measurement.
[env:gravity32lite-release]
framework = ${common_env_data.framework}
platform = ${common_env_data.platform32}
upload_speed = ${common_env_data.upload_speed}
monitor_speed = ${common_env_data.monitor_speed}
extra_scripts = ${common_env_data.extra_scripts}
build_unflags =
${common_env_data.build_unflags}
build_flags =
-Wl,-Map,output.map
${common_env_data.build_flags}
-DLOG_LEVEL=5
-DCORE_DEBUG_LEVEL=0
-DESP32LITE
-DFLOATY
#-DUSE_SERIAL_PINS # Use the TX/RX pins for the serial port
lib_deps =
${common_env_data.lib_deps}
${common_env_data.lib_deps32}
lib_ignore =
board = lolin32_lite
build_type = release
board_build.partitions = part32.csv
board_build.filesystem = littlefs
board_build.embed_txtfiles =
html/calibration.min.htm
html/config.min.htm
html/firmware.min.htm
html/format.min.htm
html/about.min.htm
html/index.min.htm
html/test.min.htm

View File

@ -56,6 +56,16 @@ def after_build(source, target, env):
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
if name == "gravity32lite-release" :
target = dir + "/bin/firmware32lite.bin"
source = dir + "/.pio/build/" + name + "/firmware.bin"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
target = dir + "/bin/partitions32lite.bin"
source = dir + "/.pio/build/" + name + "/partitions.bin"
print( "Copy file : " + source + " -> " + target )
shutil.copyfile( source, target )
print( "Adding custom build step (copy firmware): ")
env.AddPostAction("buildprog", after_build)

View File

@ -149,13 +149,19 @@ class Config {
float _voltageFactor = 1.3;
#elif defined(ESP32S2)
float _voltageFactor = 0.59;
#elif defined(ESP32LITE)
float _voltageFactor = 1.59;
#else // ESP32
float _voltageFactor = 1.3;
#endif
float _voltageConfig = 4.15;
float _tempSensorAdjC = 0;
int _sleepInterval = 900;
#if defined(FLOATY)
bool _gyroTemp = true;
#else
bool _gyroTemp = false;
#endif
bool _storageSleep = false;
// Wifi Config
@ -211,8 +217,12 @@ class Config {
const bool isGyroTemp() { return _gyroTemp; }
void setGyroTemp(bool b) {
#if defined(FLOATY)
// Floaty hardware dont have a temp sensor, uses gyro temperature
#else
_gyroTemp = b;
_saveNeeded = true;
#endif
}
const bool isStorageSleep() { return _storageSleep; }

View File

@ -79,6 +79,19 @@ extern RunMode runMode;
#define PIN_DS A8
#define PIN_A0 A2
#define PIN_LED LED_BUILTIN
#elif defined(ESP32LITE)
#include <FS.h>
#include <LittleFS.h>
#include "esp32/rom/rtc.h"
#define ESPhttpUpdate httpUpdate
#define ESP_RESET ESP.restart
#define ESP8266WebServer WebServer
#define PIN_SDA A17
#define PIN_SCL A19
#define PIN_DS A3
#define PIN_A0 A0
#define PIN_LED LED_BUILTIN
#else // defined (ESP32)
#include <FS.h>
#include <LittleFS.h>

View File

@ -91,6 +91,8 @@ void WebServerHandler::webHandleConfig() {
doc[PARAM_PLATFORM] = "esp32c3";
#elif defined(ESP32S2)
doc[PARAM_PLATFORM] = "esp32s2";
#elif defined(ESP32LITE)
doc[PARAM_PLATFORM] = "esp32lite";
#else // esp32 mini
doc[PARAM_PLATFORM] = "esp32";
#endif
@ -274,6 +276,8 @@ void WebServerHandler::webHandleStatus() {
doc[PARAM_PLATFORM] = "esp32c3";
#elif defined(ESP32S2)
doc[PARAM_PLATFORM] = "esp32s2";
#elif defined(ESP32LITE)
doc[PARAM_PLATFORM] = "esp32lite";
#else // esp32 mini
doc[PARAM_PLATFORM] = "esp32";
#endif

View File

@ -84,7 +84,7 @@ GET: /api/status
Retrieve the current device status via an HTTP GET command. Payload is in JSON format.
* ``temp-format`` can be either ``C`` or ``F``
* ``platform`` can be either ``esp8266``, ``esp32c3``, ``esp32s2`` or ``esp32``
* ``platform`` can be either ``esp8266``, ``esp32c3``, ``esp32s2``, ``esp32`` or ``esp32lite`` (floaty hardware)
* ``temp-c`` will be set to -273 C if there is no temp sensor
* ``angle`` will be set to 0 if no valid angle is found and -1 if there is no gyro

View File

@ -114,4 +114,7 @@ This is a list of C++ defines that is used to enable/disable functions in the co
- Defines the version of the compiled software
* - USE_SERIAL_PINS
- Will send the serial console to the TX/RX pins on an ESP32 target so that debugging can be done when on battery
* - REDUCE_WIFI_POWER
- Will reduce wifi power to support the ESP32C3 v1.0 which has a bad antenna
* - FLOATY
- Build for the ESP32lite FLOATY hardware option (no DS18B20 and no battery monitor)

View File

@ -53,6 +53,9 @@ In the /bin directory you will find 4 different firmware builds;
This is the release build for an ESP32s2-mini variant. When flashing an ESP32 you also need the *partition32s2.bin* file that outlines the flash memory structure. Due to
the size of the firmware we are using a custom partition setup.
* **firmware32lite.bin**
This is the release build for an ESP32lite which is used by the floaty build (clone).
Esptool (esp8266)
=================