diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 940a7b1..0ddf4a9 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -3,8 +3,7 @@ { "name": "ESP32", "includePath": [ - "${workspaceFolder}/**", - "${vcpkgRoot}/x86-windows/include/**", + "${workspaceFolder}\\**", "C:\\Users\\derdoktor667\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\1.0.6\\**" ], "defines": [ @@ -13,14 +12,13 @@ "_UNICODE" ], "windowsSdkVersion": "10.0.19041.0", - "compilerPath": "C:/Qt/Tools/mingw730_32/bin/gcc.exe", - "intelliSenseMode": "gcc-x86", + "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe", + "intelliSenseMode": "windows-msvc-x86", "cStandard": "c17", "cppStandard": "c++14", "browse": { "path": [ "${workspaceFolder}", - "${vcpkgRoot}/x86-windows/include", "C:\\Users\\derdoktor667\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\1.0.6" ] } diff --git a/examples/dshot300/dshot300.ino b/examples/dshot300/dshot300.ino index bb7d3ca..4c9bdef 100644 --- a/examples/dshot300/dshot300.ino +++ b/examples/dshot300/dshot300.ino @@ -12,6 +12,7 @@ constexpr auto USB_SERIAL_BAUD = 115200; DShotRMT dshot_01(GPIO_NUM_4, RMT_CHANNEL_0); volatile uint16_t throttle_value = 0x30; // ...sending "48", the first throttle value +constexpr auto FAILSAVE_THROTTLE = 0x3E7; void setup() { // ...always start the onboard usb support @@ -19,20 +20,24 @@ void setup() { // ...start the dshot generation dshot_01.begin(DSHOT300); - - // ...stabilize settings - vTaskDelay(500); } void loop() { + read_SerialThrottle(); + dshot_01.send_dshot_value(throttle_value); + + // ...print to console + USB_Serial.println(throttle_value); } // // -void read_SerialThrottle() { +uint16_t read_SerialThrottle() { if (USB_Serial.available() > 0) { auto throttle_input = (USB_Serial.readStringUntil('\n')).toInt(); - throttle_value = throttle_input; - } + return throttle_input; + } else { + return FAILSAVE_THROTTLE; + } }