diff --git a/LeonardoMixerIO/src/LeonardoMixer.cpp b/LeonardoMixerIO/src/LeonardoMixer.cpp index 940b34e674028dc711382e66f90ed967745fa106..c5ebd12c66784e5b84c42302fad4a6ecad8410db 100644 --- a/LeonardoMixerIO/src/LeonardoMixer.cpp +++ b/LeonardoMixerIO/src/LeonardoMixer.cpp @@ -1,7 +1,11 @@ // LeonardoMixer.cpp -// TODO License -// Lukas Friedrichsen, Philipp Stenkamp, 2017-1-6 +// Copyright 2016, 2017 Lukas Friedrichsen, Philipp Stenkamp +// License: Modified BSD-License // +// Realtime RC mixer for Arduino-devices +// +// 2017-01-06 + #include <Arduino.h> #include "RC.h" @@ -32,20 +36,17 @@ nRtTask *nRtTasks[] = { &readRawSerial, &readSpektrum, &mix, NULL }; void mix_Function (void) { - //Serial.println("MIX"); mixer.mix(); } void readSpektrum_Function (void) { - //Serial.println("SPEKTRUM"); spektrum.dataReceive(); spektrum.getData(); } void readRawSerial_Function (void) { - //Serial.println("RAW_SERIAL"); serial.dataReceive(); serial.getData(); } @@ -75,9 +76,6 @@ void printLCD_Function () void send_Function (void) { - - //Serial.println("SEND"); - //printDebug(); msp.SerialEncode(); } @@ -117,7 +115,7 @@ void setup() lcd.begin(2, 8); while(Serial1.available()){ - Serial1.read(); //gibt es eine bessere möglichkeit () + Serial1.read(); } } diff --git a/LeonardoMixerIO/src/Mixer.cpp b/LeonardoMixerIO/src/Mixer.cpp index 3e4c063480c5c27cc701be1e07510a42046903ea..f2a7f81030c9d7ec3358814c89abb990af1b4cad 100644 --- a/LeonardoMixerIO/src/Mixer.cpp +++ b/LeonardoMixerIO/src/Mixer.cpp @@ -1,9 +1,12 @@ - // Mixer.cpp -// TODO License -// Philipp Stenkamp, 2016-11-7 +// Mixer.cpp +// Copyright 2016, 2017 Lukas Friedrichsen, Philipp Stenkamp +// License: Modified BSD-License // // Very basic implementation of an RC mixer. // Mixing can be activated remotely via one of the input channels +// +// 2016-11-07 + #include "Mixer.h" #include "Arduino.h" diff --git a/LeonardoMixerIO/src/MultiWiiSerial.cpp b/LeonardoMixerIO/src/MultiWiiSerial.cpp index 05ec230e64acfd05225c0d6cce3cb0d75dd35bd6..4cb6ebbdc9196cb1743179d48d895d238471ad04 100644 --- a/LeonardoMixerIO/src/MultiWiiSerial.cpp +++ b/LeonardoMixerIO/src/MultiWiiSerial.cpp @@ -1,9 +1,12 @@ // MultiWiiSerial.cpp -// TODO License -// Philipp Stenkamp, 2016-11-7 +// Copyright 2016, 2017 Lukas Friedrichsen, Philipp Stenkamp +// License: Modified BSD-License // // Implementation of the MultiWii Serial Protocol for Arduino // http://www.multiwii.com/wiki/index.php?title=Multiwii_Serial_Protocol +// +// 2016-11-07 + #include "MultiWiiSerial.h" #include "Arduino.h" diff --git a/LeonardoMixerIO/src/MultiWiiSerial.cpp.lukas b/LeonardoMixerIO/src/MultiWiiSerial.cpp.lukas deleted file mode 100644 index 7fd66319c16d064c35505586170f30e0b791edfb..0000000000000000000000000000000000000000 --- a/LeonardoMixerIO/src/MultiWiiSerial.cpp.lukas +++ /dev/null @@ -1,59 +0,0 @@ -#include "MultiWiiSerial.h" -#include "Arduino.h" -#include "RC.h" - -/* - * The general format of an MSP message is: - * <preamble>,<direction>,<size>,<command>,<data>,<crc> - * preamble = the ASCII characters '$M' - * direction = the ASCII character '<' if to the MWC or '>' if from the MWC - * size = number of data bytes, binary. Can be zero as in the case of a data request to the MWC - * command = message_id as per the table below - * data = as per the table below. UINT16 values are LSB first. - * crc = XOR of <size>, <command> and each data byte into a zero'ed sum - */ - -MultiWiiSerial::MultiWiiSerial(rcSource *source) { - _source = source; -} -/* Needed if a reference to an HardwareSerial object is given, needs some logic to decide which type of Serial Object needs to be initialized - -void MultiWiiSerial::init(Serial_ *msp_Serial){ - _Serial = msp_Serial; - _Serial->begin(115200); -} -*/ -void MultiWiiSerial::init(HardwareSerial *msp_Serial){ - _Serial = msp_Serial; - _Serial->begin(115200); -} - -void MultiWiiSerial::SerialEncode() -{ - uint8_t header[] = {'$', 'M', '<', MSP_FRAME_SIZE, 200}; //Fixed header for sending raw RC Data - uint8_t crc = 0; - crc ^= MSP_FRAME_SIZE; - crc ^= 200; - //crc = makeCRC(crc, header + 3, 2); // checksum starts from len field - _Serial->write(header, 5); - for(uint8_t i = 0; i < MSP_FRAME_SIZE/2; i++){ - crc = crc ^ uint8_t(_source->data[i]%256); - _Serial->write(uint8_t(_source->data[i]%256)); - crc = crc ^ uint8_t(_source->data[i]/256); - _Serial->write(uint8_t(_source->data[i]/256)); - } - _Serial->write(crc); -} - - -void MultiWiiSerial::dataReceive(){ - while (_Serial->available() >= MSP_FRAME_SIZE) //DANGEROUS, runtime dependent on serial input, NO REALTIME AT ALL!! - { - _Serial->readBytes(frame, MSP_FRAME_SIZE); - } -} - -uint16_t MultiWiiSerial::readRawRC(uint8_t chan){ - return frame[chan]; - -} diff --git a/LeonardoMixerIO/src/MultiWiiSerial.h b/LeonardoMixerIO/src/MultiWiiSerial.h index 07230b2487fc1b15367a3364d213f1be590d786b..43eeecb1c5301c120507bc8f2cce7bcb3efdd3c1 100644 --- a/LeonardoMixerIO/src/MultiWiiSerial.h +++ b/LeonardoMixerIO/src/MultiWiiSerial.h @@ -1,9 +1,9 @@ // MultiWiiSerial.h -// TODO License -// Philipp Stenkamp, 2016-11-7 +// Copyright 2016, 2017 Lukas Friedrichsen, Philipp Stenkamp +// License: Modified BSD-License // -// Implementation of the MultiWii Serial Protocol for Arduino -// http://www.multiwii.com/wiki/index.php?title=Multiwii_Serial_Protocol +// 2016-11-07 + #ifndef MultiWiiSerial_h #define MultiWiiSerial_h diff --git a/LeonardoMixerIO/src/MultiWiiSerial.h.lukas b/LeonardoMixerIO/src/MultiWiiSerial.h.lukas deleted file mode 100644 index 261e9d07f2f735fc6bfa48b1741ac39c3d9c4a7f..0000000000000000000000000000000000000000 --- a/LeonardoMixerIO/src/MultiWiiSerial.h.lukas +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Implementation of the MultiWii Serial Protocol - * http://www.multiwii.com/wiki/index.php?title=Multiwii_Serial_Protocol - * - * - * - * Philipp Stenkamp - 7-11-2016 - */ - -#ifndef MultiWiiSerial_h -#define MultiWiiSerial_h - -#include <stdbool.h> -#include <stdint.h> -#include <stdlib.h> -#include "Arduino.h" -#include "RC.h" - -#define MSP_MAX_SUPPORTED_CHANNEL_COUNT 8 -#define MSP_FRAME_SIZE 8*2 - -class MultiWiiSerial { - public: - MultiWiiSerial(rcSource *source); - //void init(Serial_ *msp_Serial); - void init(HardwareSerial *msp_Serial); - void dataReceive(); - uint16_t readRawRC(uint8_t chan); - - void SerialEncode(); - - private: - HardwareSerial *_Serial; - rcSource *_source; - uint8_t channelCount; - uint16_t rxRefreshRate; - - uint8_t frame[MSP_FRAME_SIZE]; - - uint16_t channelData[MSP_MAX_SUPPORTED_CHANNEL_COUNT]; // shouldn't be channelCount to prevent going out of bounds in case of misconfiguration -}; - -#endif diff --git a/LeonardoMixerIO/src/RawSerial.cpp b/LeonardoMixerIO/src/RawSerial.cpp index 3bc85c678d2055b735ee12dda5f74f66df2635f9..9e9a032d8c7ffbc3fb18e293f144c27b8ad529d4 100644 --- a/LeonardoMixerIO/src/RawSerial.cpp +++ b/LeonardoMixerIO/src/RawSerial.cpp @@ -1,11 +1,14 @@ // RawSerial.h -// TODO License -// Philipp Stenkamp, 2016-11-7 +// Copyright 2016, 2017 Lukas Friedrichsen, Philipp Stenkamp +// License: Modified BSD-License // // Implementation of a simple serial data protocol. // Primarily meant for use with our OpenCV Android Circle Tracking App -// TODO Project Name -// TODO url +// Visual Based Landing System +// https://gitlab.cvh-server.de/lf.ps/vbls/Visual-Based-Landing-System/ +// +// 2016-11-07 + #include "RawSerial.h" #include "Arduino.h" diff --git a/LeonardoMixerIO/src/Scheduler.cpp b/LeonardoMixerIO/src/Scheduler.cpp index b54b214c26b515ad3340670c4dd7775ebb6569bf..5bdb1aba430013701a17a532539fac9d56926836 100644 --- a/LeonardoMixerIO/src/Scheduler.cpp +++ b/LeonardoMixerIO/src/Scheduler.cpp @@ -1,7 +1,11 @@ // Scheduler.cpp -// TODO License -// Lukas Friedrichsen, 2016-12- +// Copyright 2016, 2017 Lukas Friedrichsen, Philipp Stenkamp +// License: Modified BSD-License // +// Implementation of a cooperative multitasking based scheduler for Arduino-devices +// +// 2017-02-10 + #include "Scheduler.h" @@ -244,7 +248,6 @@ void Scheduler::schedule (void) { if (rtTasks) { unsigned long timerDiff = getTaskTimerDiff(rtTasks->listElement); unsigned long cycleTime = getTaskCycleTime((rtTask *) rtTasks->listElement); - //debugger->println("cycle-time: "+(String)cycleTime+" timer-diff: "+(String)timerDiff+" micros: "+(String)micros()); if (timerDiff >= cycleTime) { if (((timerDiff-cycleTime)*100/cycleTime) > OVERLOAD_THRESHOLD_PERCENT) { overloadCounter++; diff --git a/stuff/LeonardoMixerDemo/src/Mixer.h b/stuff/LeonardoMixerDemo/src/Mixer.h index 3f27e1e37ee044022b91a0f6caeb5ebed9d0dcf3..da570d7901d6c81ef1a092f22495589d5e21c35f 100644 --- a/stuff/LeonardoMixerDemo/src/Mixer.h +++ b/stuff/LeonardoMixerDemo/src/Mixer.h @@ -1,6 +1,9 @@ // Mixer.h -// TODO License -// Philipp Stenkamp, 2016-11-7 +// Copyright 2016, 2017 Lukas Friedrichsen, Philipp Stenkamp +// License: Modified BSD-License +// +// 2016-11-07 + #ifndef Mixer_h #define Mixer_h diff --git a/stuff/LeonardoMixerDemo/src/RC.h b/stuff/LeonardoMixerDemo/src/RC.h index 93653776a77621bd22d52a30e577046e90ed2fc2..6e89c069926c78d0bdcb32c3b2728887e49a8ef4 100644 --- a/stuff/LeonardoMixerDemo/src/RC.h +++ b/stuff/LeonardoMixerDemo/src/RC.h @@ -1,9 +1,9 @@ // RC.h -// TODO License -// Philipp Stenkamp, 2016-11-7 +// Copyright 2016, 2017 Lukas Friedrichsen, Philipp Stenkamp +// License: Modified BSD-License // -// Provides an array of channel data for a given number of channels. -// Can be signed with a timestamp to indicate timeliness of the data. +// 2016-11-07 + #ifndef RC_h #define RC_h diff --git a/stuff/LeonardoMixerDemo/src/RawSerial.h b/stuff/LeonardoMixerDemo/src/RawSerial.h index 5f7f48ba8a52e40f90fb900586b0b92f2754296a..923fb4fefb5f1d643eba82c83f6b0b624e289708 100644 --- a/stuff/LeonardoMixerDemo/src/RawSerial.h +++ b/stuff/LeonardoMixerDemo/src/RawSerial.h @@ -1,11 +1,9 @@ // RawSerial.h -// TODO License -// Philipp Stenkamp, 2016-11-7 +// Copyright 2016, 2017 Lukas Friedrichsen, Philipp Stenkamp +// License: Modified BSD-License // -// Implementation of a simple serial RC data protocol. -// Primarily meant for use with our OpenCV Android Circle Tracking App -// TODO Project Name -// TODO url +// 2016-11-07 + #ifndef RawSerial_h #define RawSerial_h diff --git a/stuff/LeonardoMixerDemo/src/Scheduler.h b/stuff/LeonardoMixerDemo/src/Scheduler.h index 324e773637aed645178434c4655b4602f6f3b0b7..5f3290ba9d21c07ec799da45dbd07b4e747b40e8 100644 --- a/stuff/LeonardoMixerDemo/src/Scheduler.h +++ b/stuff/LeonardoMixerDemo/src/Scheduler.h @@ -1,7 +1,9 @@ // Scheduler.h -// TODO License -// Lukas Friedrichsen, 2016-12- +// Copyright 2016, 2017 Lukas Friedrichsen, Philipp Stenkamp +// License: Modified BSD-License // +// 2017-02-10 + #ifndef Scheduler_h #define Scheduler_h diff --git a/stuff/LeonardoMixerDemo/src/Spektrum.cpp b/stuff/LeonardoMixerDemo/src/Spektrum.cpp index 675bfb4917c7fe76fc10a12b662811c7c9c50077..403318bce20b9f5d4ea3745b802edca5a196fbe2 100644 --- a/stuff/LeonardoMixerDemo/src/Spektrum.cpp +++ b/stuff/LeonardoMixerDemo/src/Spektrum.cpp @@ -1,6 +1,6 @@ // Spektrum.cpp -// TODO License -// Philipp Stenkamp, 2016-11-7 +// Copyright 2016, 2017 Lukas Friedrichsen, Philipp Stenkamp +// License: Modified BSD-License // // Implementation of the Spektrum Satellite Serial Protocol for Arduino // based on the Spektrum Remote Receiver Interfacing Specification @@ -8,6 +8,7 @@ // // In the style of Cleanflight // https://github.com/cleanflight/cleanflight/tree/master/src/main/rx +// 2016-11-07 #include "Spektrum.h" diff --git a/stuff/LeonardoMixerDemo/src/Spektrum.h b/stuff/LeonardoMixerDemo/src/Spektrum.h index 2a58c46c8ce74fe666f6446209032ccdfb08e2be..9955dcfc2789389000888890fe664e63c6cedbe0 100644 --- a/stuff/LeonardoMixerDemo/src/Spektrum.h +++ b/stuff/LeonardoMixerDemo/src/Spektrum.h @@ -1,12 +1,9 @@ // Spektrum.h -// TODO License -// Philipp Stenkamp, 2016-11-7 +// Copyright 2016, 2017 Lukas Friedrichsen, Philipp Stenkamp +// License: Modified BSD-License // -// Implementation of the Spektrum Remote Receiver Interfacing Specification -// https://www.spektrumrc.com/ProdInfo/Files/Remote%20Receiver%20Interfacing%20Rev%20A.pdf -// -// Partly based on and heavily influenced by Cleanflight -// https://github.com/cleanflight/cleanflight/tree/master/src/main/rx +// 2016-11-07 + #ifndef Spektrum_h #define Spektrum_h