Skip to content

Commit

Permalink
Merge pull request #1 from GUVWAF/beegee-tokyo
Browse files Browse the repository at this point in the history
Formatting for PR #4661
  • Loading branch information
beegee-tokyo authored Sep 13, 2024
2 parents c4c8577 + cd48084 commit 6c327d9
Show file tree
Hide file tree
Showing 5 changed files with 330 additions and 392 deletions.
3 changes: 1 addition & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,4 @@ lib_deps =
mprograms/QMC5883LCompass@^1.2.0


https://github.com/meshtastic/DFRobot_LarkWeatherStation#dee914270dc7cb3e43fbf034edd85a63a16a12ee
https://github.com/gjelsoe/STK8xxx-Accelerometer.git#v0.1.1
https://github.com/meshtastic/DFRobot_LarkWeatherStation#dee914270dc7cb3e43fbf034edd85a63a16a12ee
2 changes: 1 addition & 1 deletion src/AccelerometerThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class AccelerometerThread : public concurrency::OSThread
return 500;
}
#if defined(RAK_4631)
#if !defined (MESHTASTIC_EXCLUDE_SCREEN)
#if !defined(MESHTASTIC_EXCLUDE_SCREEN)
} else if (acceleremoter_type == ScanI2C::DeviceType::BMX160) {
sBmx160SensorData_t magAccel;
sBmx160SensorData_t gAccel;
Expand Down
11 changes: 7 additions & 4 deletions src/mqtt/MQTT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,9 @@ void MQTT::sendSubscriptions()
hasDownlink = true;
std::string topic = cryptTopic + channels.getGlobalId(i) + "/+";
LOG_INFO("Subscribing to %s\n", topic.c_str());
pubSub.subscribe(topic.c_str(), 1); // FIXME, is QOS 1 right?
#if !defined(ARCH_NRF52) || defined(NRF52_USE_JSON) // JSON is not supported on nRF52, see issue #2804 ### Fixed by using ArduinoJSON ###
pubSub.subscribe(topic.c_str(), 1); // FIXME, is QOS 1 right?
#if !defined(ARCH_NRF52) || \
defined(NRF52_USE_JSON) // JSON is not supported on nRF52, see issue #2804 ### Fixed by using ArduinoJSON ###
if (moduleConfig.mqtt.json_enabled == true) {
std::string topicDecoded = jsonTopic + channels.getGlobalId(i) + "/+";
LOG_INFO("Subscribing to %s\n", topicDecoded.c_str());
Expand Down Expand Up @@ -480,7 +481,8 @@ void MQTT::publishQueuedMessages()

publish(topic.c_str(), bytes, numBytes, false);

#if !defined(ARCH_NRF52) || defined(NRF52_USE_JSON) // JSON is not supported on nRF52, see issue #2804 ### Fixed by using ArduinoJson ###
#if !defined(ARCH_NRF52) || \
defined(NRF52_USE_JSON) // JSON is not supported on nRF52, see issue #2804 ### Fixed by using ArduinoJson ###
if (moduleConfig.mqtt.json_enabled) {
// handle json topic
auto jsonString = MeshPacketSerializer::JsonSerialize(env->packet);
Expand Down Expand Up @@ -562,7 +564,8 @@ void MQTT::onSend(const meshtastic_MeshPacket &mp, const meshtastic_MeshPacket &

publish(topic.c_str(), bytes, numBytes, false);

#if !defined(ARCH_NRF52) || defined(NRF52_USE_JSON) // JSON is not supported on nRF52, see issue #2804 ### Fixed by using ArduinoJson ###
#if !defined(ARCH_NRF52) || \
defined(NRF52_USE_JSON) // JSON is not supported on nRF52, see issue #2804 ### Fixed by using ArduinoJson ###
if (moduleConfig.mqtt.json_enabled) {
// handle json topic
auto jsonString = MeshPacketSerializer::JsonSerialize((meshtastic_MeshPacket *)&mp_decoded);
Expand Down
12 changes: 6 additions & 6 deletions src/platform/nrf52/NRF52Bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static BLEBas blebas; // BAS (Battery Service) helper class instance
#ifndef BLE_DFU_SECURE
static BLEDfu bledfu; // DFU software update helper service
#else
static BLEDfuSecure bledfusecure; // DFU software update helper service
static BLEDfuSecure bledfusecure; // DFU software update helper service
#endif

// This scratch buffer is used for various bluetooth reads/writes - but it is safe because only one bt operation can be in
Expand Down Expand Up @@ -114,8 +114,8 @@ void startAdv(void)
*/
Bluefruit.Advertising.restartOnDisconnect(true);
Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds. FIXME, we should stop advertising after X
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds. FIXME, we should stop advertising after X
}
// Just ack that the caller is allowed to read
static void authorizeRead(uint16_t conn_hdl)
Expand Down Expand Up @@ -172,7 +172,7 @@ void setupMeshService(void)
fromRadio.setMaxLen(sizeof(fromRadioBytes));
fromRadio.setReadAuthorizeCallback(
onFromRadioAuthorize,
false); // We don't call this callback via the adafruit queue, because we can safely run in the BLE context
false); // We don't call this callback via the adafruit queue, because we can safely run in the BLE context
fromRadio.setBuffer(fromRadioBytes, sizeof(fromRadioBytes)); // we preallocate our fromradio buffer so we won't waste space
// for two copies
fromRadio.begin();
Expand Down Expand Up @@ -262,7 +262,7 @@ void NRF52Bluetooth::setup()
bledfu.begin(); // Install the DFU helper
#else
bledfusecure.setPermission(SECMODE_ENC_WITH_MITM, SECMODE_ENC_WITH_MITM); // add by WayenWeng
bledfusecure.begin(); // Install the DFU helper
bledfusecure.begin(); // Install the DFU helper
#endif
// Configure and Start the Device Information Service
LOG_INFO("Configuring the Device Information Service\n");
Expand All @@ -286,7 +286,7 @@ void NRF52Bluetooth::resumeAdvertising()
{
Bluefruit.Advertising.restartOnDisconnect(true);
Bluefruit.Advertising.setInterval(32, 244); // in unit of 0.625 ms
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
Bluefruit.Advertising.start(0);
}
/// Given a level between 0-100, update the BLE attribute
Expand Down
Loading

0 comments on commit 6c327d9

Please sign in to comment.