52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
|
|
// RC Config
|
|
#define myId 0x01
|
|
#define myChannel 1
|
|
#define jName "DefaultReceiver"
|
|
|
|
// activate System-Features
|
|
#define jMPU6050
|
|
#define jCOMP
|
|
#define jGNSS
|
|
#define debug true
|
|
|
|
// RC lib
|
|
#include "juRCReceiver.h"
|
|
|
|
TaskHandle_t RadioTaskHandle;
|
|
|
|
void RadioTask(void* parameter) {
|
|
for (;;) {
|
|
jRadioLoop();
|
|
if (rc_serial_available()) {
|
|
String got = rc_serial_read();
|
|
Serial.println("received serial: " + got);
|
|
rc_serial_write("got: " + got);
|
|
}
|
|
taskYIELD();
|
|
}
|
|
}
|
|
|
|
void onConnect() {}
|
|
void onDisconnect(bool expected) {}
|
|
|
|
void setup() {
|
|
// jSetOnConnect(onConnect);
|
|
// jSetOnDisconnect(onDisconnect);
|
|
Serial.begin(115200);
|
|
Serial.println("setup");
|
|
delay(1000);
|
|
jSetup();
|
|
xTaskCreatePinnedToCore(RadioTask, /* Function to implement the task */
|
|
"RadioTask", /* Name of the task */
|
|
10000, /* Stack size in words */
|
|
NULL, /* Task input parameter */
|
|
0, /* Priority of the task */
|
|
&RadioTaskHandle, /* Task handle. */
|
|
0); /* Core where the task should run */
|
|
}
|
|
|
|
void loop() {
|
|
jSensorLoop();
|
|
// fly
|
|
}
|