reformat cultivar_sensor.ino with 2-space indent and add CULTIVAR_ENV_WIRE define for platform-specific Wire selection
This commit is contained in:
1 parent
89173129d9
commit
0f2dac32f1
2 files changed
+4
-5
No files matched your search
@@ -31,11 +31,13 @@
|
|||||||
do { char _b[128]; snprintf(_b, sizeof(_b), fmt, ##__VA_ARGS__); Serial.print(_b); } while(0)
|
do { char _b[128]; snprintf(_b, sizeof(_b), fmt, ##__VA_ARGS__); Serial.print(_b); } while(0)
|
||||||
#define CULTIVAR_ENV_SDA 0
|
#define CULTIVAR_ENV_SDA 0
|
||||||
#define CULTIVAR_ENV_SCL 0
|
#define CULTIVAR_ENV_SCL 0
|
||||||
|
#define CULTIVAR_ENV_WIRE Wire1
|
||||||
#else
|
#else
|
||||||
#define CULTIVAR_SERIAL_PRINTF(fmt, ...) Serial.printf(fmt, ##__VA_ARGS__)
|
#define CULTIVAR_SERIAL_PRINTF(fmt, ...) Serial.printf(fmt, ##__VA_ARGS__)
|
||||||
// ── Default I2C pins (ESP32S3 dev board — override for production) ─────────
|
// ── Default I2C pins (ESP32S3 dev board — override for production) ─────────
|
||||||
#define CULTIVAR_ENV_SDA 42
|
#define CULTIVAR_ENV_SDA 42
|
||||||
#define CULTIVAR_ENV_SCL 41
|
#define CULTIVAR_ENV_SCL 41
|
||||||
|
#define CULTIVAR_ENV_WIRE Wire
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|||||||
@@ -28,10 +28,7 @@ CultivarEnv env;
|
|||||||
static char jsonBuf[JSON_BUF_SIZE];
|
static char jsonBuf[JSON_BUF_SIZE];
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
if (!Bridge.begin()) {
|
Bridge.begin();
|
||||||
Monitor.println("[ERROR] Bridge init failed");
|
|
||||||
while (true) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Monitor.println("\n[cultivar] ENV bridge starting...");
|
Monitor.println("\n[cultivar] ENV bridge starting...");
|
||||||
|
|
||||||
@@ -41,7 +38,7 @@ void setup() {
|
|||||||
Monitor.println("[cultivar] TCP bridge ready on :5678");
|
Monitor.println("[cultivar] TCP bridge ready on :5678");
|
||||||
|
|
||||||
// SDA=0, SCL=0 on Zephyr = device tree configured pins (correct)
|
// SDA=0, SCL=0 on Zephyr = device tree configured pins (correct)
|
||||||
if (!env.begin(Wire, SDA, SCL)) {
|
if (!env.begin(Wire1, SDA, SCL)) {
|
||||||
Monitor.println("[WARN] BME690 init failed — check wiring");
|
Monitor.println("[WARN] BME690 init failed — check wiring");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user