Adding d8/d7 + serial pins on all versions
This commit is contained in:
parent
60675ecf0f
commit
d905aeafe9
@ -937,7 +937,7 @@
|
||||
setButtonDisabled( true );
|
||||
|
||||
var url = "/api/config";
|
||||
var url = "/test/config.json";
|
||||
//var url = "/test/config.json";
|
||||
$('#spinner').show();
|
||||
$.getJSON(url, function (cfg) {
|
||||
console.log( cfg );
|
||||
|
File diff suppressed because one or more lines are too long
@ -117,6 +117,9 @@ build_flags =
|
||||
#-DCORE_DEBUG_LEVEL=0
|
||||
${common_env_data.build_flags}
|
||||
-D LOG_LEVEL=5
|
||||
-DESP32D1
|
||||
-DCORE_DEBUG_LEVEL=0
|
||||
#-DUSE_SERIAL_PINS # Use the TX/RX pins for the serial port
|
||||
lib_deps =
|
||||
${common_env_data.lib_deps}
|
||||
${common_env_data.lib_deps32}
|
||||
|
@ -250,8 +250,10 @@ SerialDebug::SerialDebug(const uint32_t serialSpeed) {
|
||||
EspSerial.begin(115200L, SERIAL_8N1, 37, 39);
|
||||
#elif defined(ESP32S2)
|
||||
EspSerial.begin(115200L);
|
||||
#elif defined(USE_SERIAL_PINS) && defined(ESP32LITE)
|
||||
EspSerial.begin(serialSpeed, SERIAL_8N1, 16, 17);
|
||||
#elif defined(USE_SERIAL_PINS) && defined(ESP32)
|
||||
EspSerial.begin(serialSpeed, SERIAL_8N1, 3, 1);
|
||||
EspSerial.begin(serialSpeed, SERIAL_8N1, 1, 3);
|
||||
#elif defined(ESP32)
|
||||
EspSerial.begin(115200L);
|
||||
#endif
|
||||
@ -269,6 +271,21 @@ void printTimestamp(Print* _logOutput, int _logLevel) {
|
||||
_logOutput->print(c);
|
||||
}
|
||||
|
||||
bool checkPinConnected() {
|
||||
#if defined(ESP8266)
|
||||
pinMode(PIN_CFG1, INPUT);
|
||||
#else
|
||||
pinMode(PIN_CFG1, INPUT_PULLDOWN);
|
||||
#endif
|
||||
pinMode(PIN_CFG2, OUTPUT);
|
||||
delay(5);
|
||||
digitalWrite(PIN_CFG2, 1);
|
||||
delay(5);
|
||||
int i = digitalRead(PIN_CFG1);
|
||||
digitalWrite(PIN_CFG2, 0);
|
||||
return i == LOW ? false : true;
|
||||
}
|
||||
|
||||
BatteryVoltage::BatteryVoltage() {
|
||||
#if defined(ESP8266)
|
||||
pinMode(PIN_VOLT, INPUT);
|
||||
|
@ -43,6 +43,9 @@ void checkResetReason();
|
||||
// Sleep mode
|
||||
void deepSleep(int t);
|
||||
|
||||
// Force config mode
|
||||
bool checkPinConnected();
|
||||
|
||||
// Show build options
|
||||
void printBuildOptions();
|
||||
|
||||
|
@ -137,6 +137,7 @@ void setup() {
|
||||
// Add a delay so that serial is started.
|
||||
// delay(3000);
|
||||
#endif
|
||||
delay(2000);
|
||||
|
||||
// Main startup
|
||||
#if defined(ESP8266)
|
||||
@ -163,6 +164,11 @@ void setup() {
|
||||
myAdvancedConfig.loadFile();
|
||||
LOG_PERF_STOP("main-config-load");
|
||||
|
||||
sleepModeAlwaysSkip = checkPinConnected();
|
||||
if (sleepModeAlwaysSkip) {
|
||||
Log.notice(F("Main: Forcing config mode since D7/D8 are connected." CR));
|
||||
}
|
||||
|
||||
// Setup watchdog
|
||||
#if defined(ESP8266)
|
||||
ESP.wdtDisable();
|
||||
@ -331,7 +337,7 @@ bool loopReadGravity() {
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
Log.error(F("MAIN: No gyro value found, the device might be moving." CR));
|
||||
// Log.error(F("MAIN: No gyro value found, the device might be moving." CR));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
12
src/main.hpp
12
src/main.hpp
@ -44,6 +44,8 @@ extern RunMode runMode;
|
||||
#define ESP_RESET ESP.reset
|
||||
#define PIN_SDA D3
|
||||
#define PIN_SCL D4
|
||||
#define PIN_CFG1 D8
|
||||
#define PIN_CFG2 D7
|
||||
#define PIN_DS D6
|
||||
#define PIN_LED 2
|
||||
#define PIN_VOLT PIN_A0
|
||||
@ -65,6 +67,8 @@ extern RunMode runMode;
|
||||
#define PIN_SDA 7
|
||||
#define PIN_SCL 6
|
||||
#endif // JTAG_DEBUG
|
||||
#define PIN_CFG1 A5
|
||||
#define PIN_CFG2 A4
|
||||
#define PIN_DS A3
|
||||
#define PIN_VOLT A0
|
||||
// This should be the LED_BUILTIN, but that is also connected SDA (Gyro) so we
|
||||
@ -82,6 +86,8 @@ extern RunMode runMode;
|
||||
#define ESP8266WebServer WebServer
|
||||
#define PIN_SDA A17
|
||||
#define PIN_SCL A15
|
||||
#define PIN_CFG1 A11
|
||||
#define PIN_CFG2 A10
|
||||
#define PIN_DS A8
|
||||
#define PIN_VOLT A2
|
||||
#define PIN_LED LED_BUILTIN
|
||||
@ -99,6 +105,8 @@ extern RunMode runMode;
|
||||
#define PIN_SCL A19
|
||||
#define PIN_DS A3
|
||||
#define PIN_VOLT A7
|
||||
#define PIN_CFG1 A14
|
||||
#define PIN_CFG2 A13
|
||||
#define PIN_VCC A5
|
||||
#define PIN_GND A18
|
||||
#define PIN_LED LED_BUILTIN
|
||||
@ -115,11 +123,13 @@ extern RunMode runMode;
|
||||
#define PIN_SDA D3
|
||||
#define PIN_SCL D4
|
||||
#define PIN_DS D6
|
||||
#define PIN_CFG1 D8
|
||||
#define PIN_CFG2 D7
|
||||
#define PIN_LED LED_BUILTIN
|
||||
#define PIN_VOLT PIN_A0
|
||||
#endif
|
||||
|
||||
#if defined(USE_SERIAL_PINS) && defined(ESP32)
|
||||
#if defined(USE_SERIAL_PINS) && ( defined(ESP32C3) || defined(ESP32S2) )
|
||||
// #define EspSerial Serial0 // We cant use Serial on newer boards since this is
|
||||
// using USBC port
|
||||
#define EspSerial \
|
||||
|
@ -20,6 +20,7 @@ Schema for esp8266 build
|
||||
:width: 700
|
||||
:alt: Schema esp8266
|
||||
|
||||
|
||||
iSpindle based on esp32
|
||||
=======================
|
||||
|
||||
@ -114,3 +115,25 @@ this hardware platform as well but there are a few limitations:
|
||||
|
||||
* Temperature is read from the GYRO and cannot be changed. This works fine when measuring gravity but when in configuration mode the temperature will increase since it shows the chip temperature.
|
||||
* No possibility to measure battery level (can be added with additional hardware).
|
||||
|
||||
|
||||
Hardware extensions
|
||||
===================
|
||||
|
||||
GravityMon has implemented a few additions to the standard iSpindel hardware. It's possible to channel the serial console to the TX/RX pins on the chip (these position also applies to all the
|
||||
ESP32 chips for iSpindel). You need a USB to TTL converter for this to work. This enables you to read the serial console even when on battery (newer chips dont have a diode to remove).
|
||||
|
||||
.. note::
|
||||
You need to compile the software using the -DUSE_SERIAL_PINS option to enable this feature.
|
||||
|
||||
Its also possible to force the device into configuration mode by connecting D7/D8 on the board during the startup sequence. This will enable the feature "gravity mode enabled during float".
|
||||
|
||||
.. image:: images/8266_pins.jpg
|
||||
:width: 500
|
||||
:alt: iSpindel pins
|
||||
|
||||
For the floaty device pins 16/17 are used as TX/RX pins and the 13/15 pins are used to force the device into configuration mode. Pin 35 can also be connected to the battery voltage via an voltage divider to be able to read the battery voltage.
|
||||
|
||||
.. image:: images/32lite_pins.jpg
|
||||
:width: 500
|
||||
:alt: Floaty pins
|
||||
|
BIN
src_docs/source/images/32lite_pins.jpg
Normal file
BIN
src_docs/source/images/32lite_pins.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 416 KiB |
BIN
src_docs/source/images/8266_pins.jpg
Normal file
BIN
src_docs/source/images/8266_pins.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 324 KiB |
Loading…
Reference in New Issue
Block a user