...fixed compilation

This commit is contained in:
Wastl Kraus 2021-06-30 06:43:07 +02:00
parent b6442f3005
commit 8c8017304b
2 changed files with 14 additions and 11 deletions

View File

@ -3,8 +3,7 @@
{ {
"name": "ESP32", "name": "ESP32",
"includePath": [ "includePath": [
"${workspaceFolder}/**", "${workspaceFolder}\\**",
"${vcpkgRoot}/x86-windows/include/**",
"C:\\Users\\derdoktor667\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\1.0.6\\**" "C:\\Users\\derdoktor667\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\1.0.6\\**"
], ],
"defines": [ "defines": [
@ -13,14 +12,13 @@
"_UNICODE" "_UNICODE"
], ],
"windowsSdkVersion": "10.0.19041.0", "windowsSdkVersion": "10.0.19041.0",
"compilerPath": "C:/Qt/Tools/mingw730_32/bin/gcc.exe", "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe",
"intelliSenseMode": "gcc-x86", "intelliSenseMode": "windows-msvc-x86",
"cStandard": "c17", "cStandard": "c17",
"cppStandard": "c++14", "cppStandard": "c++14",
"browse": { "browse": {
"path": [ "path": [
"${workspaceFolder}", "${workspaceFolder}",
"${vcpkgRoot}/x86-windows/include",
"C:\\Users\\derdoktor667\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\1.0.6" "C:\\Users\\derdoktor667\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\1.0.6"
] ]
} }

View File

@ -12,6 +12,7 @@ constexpr auto USB_SERIAL_BAUD = 115200;
DShotRMT dshot_01(GPIO_NUM_4, RMT_CHANNEL_0); DShotRMT dshot_01(GPIO_NUM_4, RMT_CHANNEL_0);
volatile uint16_t throttle_value = 0x30; // ...sending "48", the first throttle value volatile uint16_t throttle_value = 0x30; // ...sending "48", the first throttle value
constexpr auto FAILSAVE_THROTTLE = 0x3E7;
void setup() { void setup() {
// ...always start the onboard usb support // ...always start the onboard usb support
@ -19,20 +20,24 @@ void setup() {
// ...start the dshot generation // ...start the dshot generation
dshot_01.begin(DSHOT300); dshot_01.begin(DSHOT300);
// ...stabilize settings
vTaskDelay(500);
} }
void loop() { void loop() {
read_SerialThrottle();
dshot_01.send_dshot_value(throttle_value); 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) { if (USB_Serial.available() > 0) {
auto throttle_input = (USB_Serial.readStringUntil('\n')).toInt(); auto throttle_input = (USB_Serial.readStringUntil('\n')).toInt();
throttle_value = throttle_input; return throttle_input;
} } else {
return FAILSAVE_THROTTLE;
}
} }