Bluetooth setup code integration
This commit is contained in:
parent
e88598d324
commit
06b345c9ef
|
@ -56,6 +56,11 @@
|
||||||
*/
|
*/
|
||||||
#define EFI_TUNER_STUDIO TRUE
|
#define EFI_TUNER_STUDIO TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bluetooth UART setup support.
|
||||||
|
*/
|
||||||
|
#define EFI_BLUETOOTH_SETUP FALSE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TunerStudio debug output
|
* TunerStudio debug output
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
#include "console_io.h"
|
#include "console_io.h"
|
||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
#include "fl_protocol.h"
|
#include "fl_protocol.h"
|
||||||
|
#include "bluetooth.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "engine_configuration.h"
|
#include "engine_configuration.h"
|
||||||
|
@ -167,6 +168,13 @@ static void setTsSpeed(int value) {
|
||||||
printTsStats();
|
printTsStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if EFI_BLUETOOTH_SETUP || defined(__DOXYGEN__)
|
||||||
|
// Bluetooth HC-06 module initialization start (it waits for disconnect and then communicates to the module)
|
||||||
|
static void bluetoothHC06(const char *baudRate, const char *name, const char *pinCode) {
|
||||||
|
bluetoothStart(&tsChannel, BLUETOOTH_HC_06, baudRate, name, pinCode);
|
||||||
|
}
|
||||||
|
#endif /* EFI_BLUETOOTH_SETUP */
|
||||||
|
|
||||||
void tunerStudioDebug(const char *msg) {
|
void tunerStudioDebug(const char *msg) {
|
||||||
#if EFI_TUNER_STUDIO_VERBOSE || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO_VERBOSE || defined(__DOXYGEN__)
|
||||||
scheduleMsg(&tsLogger, "%s", msg);
|
scheduleMsg(&tsLogger, "%s", msg);
|
||||||
|
@ -452,6 +460,10 @@ void runBinaryProtocolLoop(ts_channel_s *tsChannel, bool isConsoleRedirect) {
|
||||||
|
|
||||||
if (received != 1) {
|
if (received != 1) {
|
||||||
// tunerStudioError("ERROR: no command");
|
// tunerStudioError("ERROR: no command");
|
||||||
|
#if EFI_BLUETOOTH_SETUP || defined(__DOXYGEN__)
|
||||||
|
// assume there's connection loss and notify the bluetooth init code
|
||||||
|
bluetoothSoftwareDisconnectNotify();
|
||||||
|
#endif /* EFI_BLUETOOTH_SETUP */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
onDataArrived();
|
onDataArrived();
|
||||||
|
@ -828,6 +840,13 @@ void startTunerStudioConnectivity(void) {
|
||||||
addConsoleAction("tsinfo", printTsStats);
|
addConsoleAction("tsinfo", printTsStats);
|
||||||
addConsoleAction("reset_ts", resetTs);
|
addConsoleAction("reset_ts", resetTs);
|
||||||
addConsoleActionI("set_ts_speed", setTsSpeed);
|
addConsoleActionI("set_ts_speed", setTsSpeed);
|
||||||
|
|
||||||
|
#if EFI_BLUETOOTH_SETUP || defined(__DOXYGEN__)
|
||||||
|
// Usage: "bluetooth_hc06 <baud> <name> <pincode>"
|
||||||
|
// Example: "bluetooth_hc06 38400 rusefi 1234"
|
||||||
|
addConsoleActionSSS("bluetooth_hc06", bluetoothHC06);
|
||||||
|
addConsoleAction("bluetooth_cancel", bluetoothCancel);
|
||||||
|
#endif /* EFI_BLUETOOTH_SETUP */
|
||||||
|
|
||||||
chThdCreateStatic(tsThreadStack, sizeof(tsThreadStack), NORMALPRIO, (tfunc_t)tsThreadEntryPoint, NULL);
|
chThdCreateStatic(tsThreadStack, sizeof(tsThreadStack), NORMALPRIO, (tfunc_t)tsThreadEntryPoint, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
TUNERSTUDIO_SRC_CPP = $(PROJECT_DIR)/console/binary/tunerstudio_io.cpp \
|
TUNERSTUDIO_SRC_CPP = $(PROJECT_DIR)/console/binary/tunerstudio_io.cpp \
|
||||||
$(PROJECT_DIR)/console/binary/tunerstudio.cpp
|
$(PROJECT_DIR)/console/binary/tunerstudio.cpp \
|
||||||
|
$(PROJECT_DIR)/console/binary/bluetooth.cpp
|
||||||
|
|
Loading…
Reference in New Issue