Skip to content

Commit bb09a5a

Browse files
author
Marcus Poulton
committed
2 parents 1e89f0f + 432daad commit bb09a5a

File tree

9 files changed

+116
-139
lines changed

9 files changed

+116
-139
lines changed

src/hubs/CubeCell/CubeCellReceiver/platformio.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ board_build.arduino.lorawan.adr = OFF
2020
board_build.arduino.lorawan.debug_level = FREQ_AND_DIO
2121
framework = arduino
2222
monitor_speed = 115200
23-
monitor_port = COM8
24-
upload_port = COM8
23+
monitor_port = COM6
24+
upload_port = COM6
2525
upload_speed = 921600
2626
build_flags =
2727
${common_env_data.build_flags}

src/hubs/CubeCell/CubeCellReceiver/src/main.cpp

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,26 @@ bool isDebug()
3939
return debug;
4040
}
4141

42+
void setupWire()
43+
{
44+
bool ok=false;
45+
46+
for (int i=0; i<3;i++)
47+
{
48+
Serial.printf("Start I2\n");
49+
if (Wire.begin())
50+
{
51+
Serial.printf("I2C started, clock %d\n", Wire.getClock());
52+
break;
53+
}
54+
else
55+
{
56+
Wire.end();
57+
Serial.printf("I2C failed to start\n");
58+
}
59+
}
60+
}
61+
4262
void flash(uint32_t color,uint32_t time)
4363
{
4464
pinMode(USER_KEY, INPUT);
@@ -67,8 +87,7 @@ void setup() {
6787
LORA_CRC, LORA_FREQ_HOP, LORA_HOP_PERIOD, LORA_IQ_INVERSION_ON, true );
6888

6989
Radio.Rx( 0 );
70-
if (Wire.begin())
71-
Serial.printf("I2C started, clock %d\n", Wire.getClock());
90+
setupWire();
7291
}
7392

7493
void loop()
@@ -92,6 +111,8 @@ void OnRxDone( unsigned char* payload, unsigned short size, short rssi, signed c
92111
Wire.beginTransmission(CHANNEL); // transmit to device #9
93112
Wire.write(rxpacket, size);
94113
uint8_t err = Wire.endTransmission(); // stop transmitting
95-
Serial.printf("I2C ERROR %d %s\n", err);
114+
Serial.printf("I2C ERROR %d %s\n", err, Wire.getErrorText(err));
115+
if (err!=0)
116+
setupWire();
96117
}
97118

src/hubs/TTGO-BEAM/platformio.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ platform = espressif32
2121
board = ttgo-t-beam
2222
framework = arduino
2323
monitor_speed = 115200
24-
monitor_port = COM3
25-
upload_port = COM3
24+
monitor_port = COM7
25+
upload_port = COM7
2626
upload_speed = 921600
2727
build_flags =
2828
${common_env_data.build_flags}

src/hubs/TTGO-BEAM/src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ MessageBuffer messageBuffer(128);
3030

3131
#define MQTT_HOST DEFAULT_BROKER
3232
#define MQTT_PORT 1883
33-
#define WIFI_SSID "Poulton"
34-
#define WIFI_PASSWORD "12345678"
33+
#define WIFI_SSID "poulton"
34+
#define WIFI_PASSWORD "9scvfpkKcygt"
3535

3636
AsyncMqttClient mqttClient;
3737
TimerHandle_t mqttReconnectTimer;
Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
; PlatformIO Project Configuration File
2+
;
3+
; Build options: build flags, source filter
4+
; Upload options: custom upload port, speed and extra flags
5+
; Library options: dependencies, extra library storages
6+
; Advanced options: extra scripting
7+
;
8+
; Please visit documentation for the other options and examples
9+
; https://docs.platformio.org/page/projectconf.html
10+
111
[platformio]
212
default_envs = heltec_wifi_kit_32_V3
313

@@ -6,28 +16,26 @@ build_flags =
616
-I ../common
717
-D VERSION=1.0
818
-D MQTT_MAX_PACKET_SIZE=512
9-
-D ENV_WIFI_SSID="\"${sysenv.ENV_WIFI_SSID}\""
10-
-D ENV_WIFI_PASSWORD="\"${sysenv.ENV_WIFI_PASSWORD}\""
11-
19+
-D ENV_WIFI_SSID="\"${sysenv.ENV_WIFI_SSID}\""
20+
-D ENV_WIFI_PASSWORD="\"${sysenv.ENV_WIFI_PASSWORD}\""
1221
lib_deps =
1322
densaugeo/base64@^1.2.1
14-
PubSubClient
23+
# PubSubClient
1524
ArduinoJson
16-
AsyncMqttClient
1725
Wire
18-
26+
1927
[env:heltec_wifi_kit_32_V3]
2028
platform = espressif32
2129
board = heltec_wifi_kit_32_V3
22-
board_packages=heltec_wifi_kit_32_V3@https://resource.heltec.cn/download/package_heltec_esp32_index.json
2330
framework = arduino
2431
monitor_speed = 115200
25-
monitor_port = COM6
26-
upload_port = COM6
32+
monitor_port = COM9
33+
upload_port = COM9
2734
upload_speed = 921600
2835
build_flags =
2936
${common_env_data.build_flags}
3037
-D WIFI_Kit_32
3138
lib_deps =
3239
${common_env_data.lib_deps}
33-
heltecautomation/Heltec ESP32 Dev-Boards
40+
256dpi/MQTT@^2.5.2
41+
thingpulse/ESP8266 and ESP32 OLED driver for SSD1306 displays@^4.6.1

0 commit comments

Comments
 (0)