Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0e55dc6
chore(library): Deprecate existing files-and-folders structure
ZZ-Cat Jan 28, 2024
fa55e39
refactor: Initial re-factor of CRSF for Arduino
ZZ-Cat Feb 2, 2024
7e8d6f2
chore(gitignore): Update `.gitignore` and `platformio.ini` files
ZZ-Cat Feb 2, 2024
f2757a4
refactor(platformio): Use a `CFA_DEVELOPMENT_MODE` flag instead of us…
ZZ-Cat Feb 2, 2024
a8d0723
chore(platformio): Clean up `platformio.ini`
ZZ-Cat Feb 2, 2024
5c1e817
chore(library): Minor clean-up
ZZ-Cat Feb 2, 2024
e0be018
chore(generic stream buffer): Bring in Generic Stream Buffer files
ZZ-Cat Feb 2, 2024
ae17c10
chore(telemetry): Bring in Telemetry files
ZZ-Cat Feb 2, 2024
857daac
chore(serial receiver interface): Switch CRSF access from `public` to…
ZZ-Cat Feb 2, 2024
619cbc7
chore(serial receiver interface): Reinstate CRSF API
ZZ-Cat Feb 3, 2024
00db939
chore(generic stream buffer): Reinstate Generic Stream Buffer API
ZZ-Cat Feb 3, 2024
7cfe305
chore(telemetry): Reinstate Telemetry API
ZZ-Cat Feb 3, 2024
2603513
chore(serial receiver interface): Reinstate Serial Receiver Interface…
ZZ-Cat Feb 3, 2024
095c510
chore(sketch layer): Reinstate Sketch Layer API
ZZ-Cat Feb 3, 2024
bd7c904
chore(library): Recover missing code
ZZ-Cat Feb 3, 2024
9055d49
chore(compatibility table): Reinstate Compatibility Table API
ZZ-Cat Feb 4, 2024
b58dee6
fix(compatibility table): `CFA_Config.hpp` no such file or directory
ZZ-Cat Feb 4, 2024
92bcf1b
refactor(library): Use relative include paths, and remove `CFA_DEVELO…
ZZ-Cat Feb 4, 2024
ee36149
chore(platformio): Move `main.cpp` to `platformio` examples folder
ZZ-Cat Feb 4, 2024
453e787
chore(arduino): Clean up `cfa_test.ino` example file
ZZ-Cat Feb 4, 2024
ac84abd
chore(rc channels): Reinstate RC Channels example file
ZZ-Cat Feb 4, 2024
5e62a4e
chore(telemetry): Reinstate telemetry example
ZZ-Cat Feb 4, 2024
ff76351
chore(flight modes): Reinstate Flight Modes example
ZZ-Cat Feb 4, 2024
f9aed5b
chore: Remove `cfa_test.ino` file
ZZ-Cat Feb 4, 2024
5bdb2da
chore(library): Add missing boiler plates
ZZ-Cat Feb 4, 2024
adcedb0
chore(platformio): Disable development environment in `platformio.ini`
ZZ-Cat Feb 4, 2024
a31fd36
chore(platformio): Reinstate build targets for CI/CD
ZZ-Cat Feb 4, 2024
e8bf933
chore(library): Resolve incorrect formatting
ZZ-Cat Feb 4, 2024
582cf8b
docs(readme): Add section about using CRSF for Arduino as a PlatformI…
ZZ-Cat Feb 4, 2024
6401565
chore(gitignore): Update `.gitignore`
ZZ-Cat Feb 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
# Artefacts for Visual Studio Code
.vscode/

# PlatformIO specific README files
src/platformio/include/README
src/platformio/test/README
# PlatformIO specific files
test/README

# Template files for CRSF for Arduino
templates/
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ Pro tips:
In PlatformIO, CRSF for Arduino's dependencies are automatically installed, when you build your project for the first time.
The `platformio.ini` file contains a list of development boards that is compatible with CRSF for Arduino.

## Installation - Using as a dependency in your PlatformIO project

Simply add `https://github.com/ZZ-Cat/CRSFforArduino.git @^ 1.0.0` to your `lib_deps` section in your `platformio.ini` file.
PlatformIO will take care of the rest. This is fairly new, so any hiccups, don't hesitate to let me know via my Issues tab.

## Installation - Straight from the Main-Trunk

If you want bleeding edge features and want to help me out on developing CRSF for Arduino, this is how you go about it:
Expand Down
160 changes: 0 additions & 160 deletions examples/channels/channels.ino

This file was deleted.

47 changes: 21 additions & 26 deletions examples/flight_modes/flight_modes.ino
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* @file main_flight_modes.ino
* @file flight_modes.ino
* @author Cassandra "ZZ Cat" Robinson (nicad.heli.flier@gmail.com)
* @brief Demonstrates the use of CRSF for Arduino's flight mode functionality.
* @brief Example of how to read flight modes from a receiver.
* @version 1.0.0
* @date 2024-1-20
* @date 2024-2-5
*
* @copyright Copyright (c) 2023, Cassandra "ZZ Cat" Robinson. All rights reserved.
* @copyright Copyright (c) 2024, Cassandra "ZZ Cat" Robinson. All rights reserved.
*
* @section License GNU General Public License v3.0
* This [file type] is a part of the CRSF for Arduino library.
* This example is a part of the CRSF for Arduino library.
* CRSF for Arduino is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -23,9 +23,6 @@
* along with CRSF for Arduino. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO) && defined(PLATFORMIO)
#error "This example sketch is not compatible with PlatformIO. Please use the main_rc.cpp example instead."
#elif defined(ARDUINO) && !defined(PLATFORMIO)

#include "CRSFforArduino.hpp"

Expand Down Expand Up @@ -61,7 +58,7 @@

CRSFforArduino crsf = CRSFforArduino(&Serial1);

void onFlightModeUpdate(serialReceiver::flightModeId_t);
void onFlightModeUpdate(serialReceiverLayer::flightModeId_t);

void setup()
{
Expand All @@ -85,7 +82,7 @@ void setup()
}

// Set flight modes.
if (!crsf.setFlightMode(serialReceiver::FLIGHT_MODE_DISARMED, FLIGHT_MODE_ARM_CHANNEL, FLIGHT_MODE_ARM_MIN, FLIGHT_MODE_ARM_MAX))
if (!crsf.setFlightMode(serialReceiverLayer::FLIGHT_MODE_DISARMED, FLIGHT_MODE_ARM_CHANNEL, FLIGHT_MODE_ARM_MIN, FLIGHT_MODE_ARM_MAX))
{
Serial.println("Failed to set \"DISARMED\" flight mode!");
while (1)
Expand All @@ -94,7 +91,7 @@ void setup()
}
}

if (!crsf.setFlightMode(serialReceiver::FLIGHT_MODE_ACRO, FLIGHT_MODE_ACRO_CHANNEL, FLIGHT_MODE_ACRO_MIN, FLIGHT_MODE_ACRO_MAX))
if (!crsf.setFlightMode(serialReceiverLayer::FLIGHT_MODE_ACRO, FLIGHT_MODE_ACRO_CHANNEL, FLIGHT_MODE_ACRO_MIN, FLIGHT_MODE_ACRO_MAX))
{
Serial.println("Failed to set \"ACRO\" flight mode!");
while (1)
Expand All @@ -103,7 +100,7 @@ void setup()
}
}

if (!crsf.setFlightMode(serialReceiver::FLIGHT_MODE_ANGLE, FLIGHT_MODE_ANGLE_CHANNEL, FLIGHT_MODE_ANGLE_MIN, FLIGHT_MODE_ANGLE_MAX))
if (!crsf.setFlightMode(serialReceiverLayer::FLIGHT_MODE_ANGLE, FLIGHT_MODE_ANGLE_CHANNEL, FLIGHT_MODE_ANGLE_MIN, FLIGHT_MODE_ANGLE_MAX))
{
Serial.println("Failed to set \"ANGLE\" flight mode!");
while (1)
Expand All @@ -112,7 +109,7 @@ void setup()
}
}

if (!crsf.setFlightMode(serialReceiver::FLIGHT_MODE_HORIZON, FLIGHT_MODE_HORIZON_CHANNEL, FLIGHT_MODE_HORIZON_MIN, FLIGHT_MODE_HORIZON_MAX))
if (!crsf.setFlightMode(serialReceiverLayer::FLIGHT_MODE_HORIZON, FLIGHT_MODE_HORIZON_CHANNEL, FLIGHT_MODE_HORIZON_MIN, FLIGHT_MODE_HORIZON_MAX))
{
Serial.println("Failed to set \"HORIZON\" flight mode!");
while (1)
Expand All @@ -136,43 +133,43 @@ void loop()
crsf.update();
}

void onFlightModeUpdate(serialReceiver::flightModeId_t flightMode)
void onFlightModeUpdate(serialReceiverLayer::flightModeId_t flightMode)
{
/* Here is where you would put your flight mode implementation.
For this example, we will just print the flight mode to the serial port,
and send it to the controller as telemetry. */
static serialReceiver::flightModeId_t lastFlightMode = serialReceiver::FLIGHT_MODE_DISARMED;
static serialReceiverLayer::flightModeId_t lastFlightMode = serialReceiverLayer::FLIGHT_MODE_DISARMED;

if (flightMode != lastFlightMode)
{
Serial.print("Flight Mode: ");
switch (flightMode)
{
case serialReceiver::FLIGHT_MODE_DISARMED:
case serialReceiverLayer::FLIGHT_MODE_DISARMED:
Serial.println("Disarmed");
break;
case serialReceiver::FLIGHT_MODE_ACRO:
case serialReceiverLayer::FLIGHT_MODE_ACRO:
Serial.println("Acro");
break;
case serialReceiver::FLIGHT_MODE_WAIT:
case serialReceiverLayer::FLIGHT_MODE_WAIT:
Serial.println("Wait for GPS Lock");
break;
case serialReceiver::FLIGHT_MODE_FAILSAFE:
case serialReceiverLayer::FLIGHT_MODE_FAILSAFE:
Serial.println("Failsafe");
break;
case serialReceiver::FLIGHT_MODE_GPS_RESCUE:
case serialReceiverLayer::FLIGHT_MODE_GPS_RESCUE:
Serial.println("GPS Rescue");
break;
case serialReceiver::FLIGHT_MODE_PASSTHROUGH:
case serialReceiverLayer::FLIGHT_MODE_PASSTHROUGH:
Serial.println("Passthrough");
break;
case serialReceiver::FLIGHT_MODE_ANGLE:
case serialReceiverLayer::FLIGHT_MODE_ANGLE:
Serial.println("Angle");
break;
case serialReceiver::FLIGHT_MODE_HORIZON:
case serialReceiverLayer::FLIGHT_MODE_HORIZON:
Serial.println("Horizon");
break;
case serialReceiver::FLIGHT_MODE_AIRMODE:
case serialReceiverLayer::FLIGHT_MODE_AIRMODE:
Serial.println("Airmode");
break;
default:
Expand All @@ -184,5 +181,3 @@ void onFlightModeUpdate(serialReceiver::flightModeId_t flightMode)
crsf.telemetryWriteFlightMode(flightMode);
}
}

#endif
Loading