Skip to content

Commit 32750ab

Browse files
Merge pull request #12 from talbotmcinnis/ImproveDocumentation
Improve documentation
2 parents dbf3b14 + e8fa199 commit 32750ab

File tree

8 files changed

+83
-30
lines changed

8 files changed

+83
-30
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is an Arduino library that makes it easy to write sketches that talk to DCS-BIOS.
44

5-
For more information and documentation, see the [DCS-BIOS FlightPanels Project](https://github.com/DCSFlightpanels).
5+
For more information and documentation, see the [DCS-BIOS FlightPanels Project](https://github.com/DCSFlightpanels). The example "OneOfEverything" is a good place to start looking for controls to use.
66

77
## Origins
88

@@ -12,3 +12,8 @@ DCS-BIOS was originally developed here, [DCS-BIOS project.](https://github.com/d
1212

1313
This is a community maintained plugin. Support is best found at the DCS-Flightpanels discord channel. The wiki is very much a work in progress, and can be found here: https://github.com/talbotmcinnis/dcs-bios-arduino-library/wiki
1414

15+
## Releasing
16+
17+
1. Bump version number in library.properties
18+
2. Run make_release, providing the same version number when prompted.
19+
3. Manually make a zip file of the folder created in /Releases, and upload to github.

examples/Dynamic Mapping based on Aircraft Type Code/Dynamic Control Mapping.ino renamed to examples/DynamicControlMapping/DynamicControlMapping.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//
55
//
66

7-
#define DCSBIOS_IRQ_SERIAL
7+
#define DCSBIOS_DEFAULT_SERIAL
88
#include "DcsBios.h"
99

1010
bool g_bRun = true; //main loop control
@@ -168,4 +168,4 @@ void loop() {
168168
DcsBios::loop();
169169
}
170170

171-
}
171+
}

examples/MasterCaution/MasterCaution.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* use '#define DCSBIOS_DEFAULT_SERIAL' instead if your Arduino board
22
* does not feature an ATMega328 or ATMega2650 controller.
33
*/
4-
#define DCSBIOS_IRQ_SERIAL
4+
#define DCSBIOS_DEFAULT_SERIAL
55
#include "DcsBios.h"
66

77
/* Declare a Master Caution Reset button on pin 10 */
@@ -16,4 +16,3 @@ void setup() {
1616
void loop() {
1717
DcsBios::loop();
1818
}
19-

examples/OneOfEverything/OneOfEverything.ino

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,67 @@
1-
/* use '#define DCSBIOS_DEFAULT_SERIAL' instead if your Arduino board
2-
* does not feature an ATMega328 or ATMega2650 controller.
3-
*/
41
#define DCSBIOS_DEFAULT_SERIAL
52
#include <DcsBios.h>
63

4+
/* This file serves two purposes:
5+
*#1 - Provided compilable demonstrations of each type of controls availble in DCS-Bios arduino library. This is not meant to be deployed onto
6+
* hardware, as several pins conflict and the messages are made up.
7+
*#2 - Provide a very basic testing suite that developers can use to ensure that changes do not break existing sketches
8+
*/
9+
10+
// Buttons
11+
///////////
12+
// The simplest push button, a single momentary button on a single pin, which sends ARG_0 to MSG_0
13+
DcsBios::ActionButton iffDec("IFF_CODE", "INC", 1);
14+
15+
// Used when a physical switch is a momentary button, but needs to sent alternating arguments each time it is pressed
16+
DcsBios::ToggleButton toggleButtonExample("MSG_0", "ARG_0", "ARG_1", 1);
17+
18+
// Switches
19+
////////////
20+
// A standard two position on/off
21+
DcsBios::Switch2Pos switch2PosExample("MSG_0", 1);
22+
// A three position on/off/on switch
23+
DcsBios::Switch3Pos switch3PosExample("MSG_0", 1, 2);
24+
// A multiple position switch, often a rotary switch
25+
const byte multiPosPins[4] = {1,2,3,4};
26+
DcsBios::SwitchMultiPos switchMulitPosExample("MSG_0", multiPosPins, 4);
27+
28+
// Analogs
29+
///////////
30+
// Use an analog input, divided into discrete steps
731
DcsBios::AnalogMultiPos analogMultiPosExample("MSG_0", 1, 10);
8-
DcsBios::RadioPreset radioPresetExample("MSG_0", 1, 2, 3, 4, 5);
32+
33+
// Other stuff
34+
// A Binary Coded Decimal wheel usually displaying digits for numeric entry, i.e. IFF code wheels.
935
DcsBios::BcdWheel bcdWheelExample("MSG_0", 1, 2);
10-
DcsBios::ActionButton actionButtonExample("MSG_0", "ARG_0", 1);
11-
DcsBios::ToggleButton toggleButtonExample("MSG_0", "ARG_0", "ARG_1", 1);
36+
// A special case of bcdWheel that will send a radio frequency instead of raw digit
37+
DcsBios::RadioPreset radioPresetExample("MSG_0", 1, 2, 3, 4, 5);
38+
39+
// Spinning things
40+
///////////////////
41+
// Rotary encoder on two pins to send INC/DEC arguments when rotated
1242
DcsBios::RotaryEncoder rotaryEncoderExample("MSG_0", "ARG_DEC", "ARG_INC", 1, 2);
43+
// A rotary encoder which will send larger increments when used continuously. Originally written for faster gross adjustments to HSI.
1344
DcsBios::RotaryAcceleratedEncoder rotaryAcceleratedEncoderExample("MSG_0", "ARG_DEC", "ARG_INC", "FAST_INC", "FAST_DEC", 1, 2);
45+
// A linear/analog axis on a single pin
1446
DcsBios::Potentiometer potentiometerExample("MSG_0", 1);
47+
// An inverted version of a linear axis control
1548
DcsBios::InvertedPotentiometer invertedPotentiometerExample("MSG_0", 1);
16-
DcsBios::Switch2Pos switch2PosExample("MSG_0", 1);
17-
DcsBios::Switch3Pos switch3PosExample("MSG_0", 1, 2);
18-
const byte multiPosPins[4] = {1,2,3,4};
19-
DcsBios::SwitchMultiPos switchMulitPosExample("MSG_0", multiPosPins, 4);
2049

50+
// Outputs
51+
///////////
52+
// A single LED
2153
DcsBios::Dimmer defaultDimmerExample(0x1012, 5);
54+
DcsBios::LED masterCaution(0x1012, 0x0800, 13);
55+
// An analog output with a value that comes from a DCS address
56+
DcsBios::Dimmer dimmerExample(0x1012, 13);
2257
DcsBios::Dimmer invertedDimmerExample(0x1012, 5, 200,0);
2358
unsigned int myValueMapper(unsigned int dcsValue)
2459
{
2560
return dcsValue % 10;
2661
}
2762
DcsBios::Dimmer mappedDimmerExample(0x1012, 5, myValueMapper);
28-
29-
DcsBios::LED masterCaution(0x1012, 0x0800, 13);
63+
// A servo motor controlleed from DCS, i.e. a guage.
64+
DcsBios::ServoOutput servoExample(0x1012, 13, 544, 2400);
3065

3166
void setup() {
3267
DcsBios::setup();

examples/Other Examples.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Here are some other examples of dcs-bios in action:
2+
3+
- [RobinMLi/DCS-CDU-Display: Proof of concept - A cheap solution to create a DCS A-10C CDU display. (github.com)](https://github.com/RobinMLi/DCS-CDU-Display)
4+
- https://github.com/talbotmcinnis/McPit-DCS-BIOS
5+
- https://github.com/talbotmcinnis/TabletCDU
6+
- This one uses DCS-BIOS's export stream in Python/PyGame to render a CDU on a network connected windows tablet.

make_release.ps1

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
$version = Read-Host -Prompt 'What version are you release (i.e. 0.3.1)'
2-
$outFile = './Releases/dcs-bios-arduino-library-' + $version + '.zip'
2+
$folder = './Releases/dcs-bios-arduino-library-' + $version
33

4+
# Create the Releases folder if it doesn't exist
45
if (!(Test-Path './Releases'))
56
{
67
new-item './Releases' -itemtype directory
78
}
89

9-
Get-ChildItem -Path '.\' -Exclude 'Releases','make_release.ps1' | Compress-Archive -DestinationPath $outfile
10+
# Create and populate folder for the release
11+
if ((Test-Path $folder))
12+
{
13+
Remove-Item $folder -Recurse -Force
14+
}
15+
16+
new-item $folder -itemtype directory
17+
Copy-Item -Path '.\examples' -Recurse -Destination $folder
18+
Copy-Item -Path '.\src' -Recurse -Destination $folder
19+
Copy-Item -Path '.\keywords.txt' -Destination $folder
20+
Copy-Item -Path '.\library.properties' -Destination $folder
21+
Copy-Item -Path '.\LICENSE' -Destination $folder
22+
Copy-Item -Path '.\*.md' -Destination $folder
23+
24+
# Compress it
25+
# Note Compress-Archive seems to make a zip file, but that zip cannot be consumed by Arduino
26+
#Compress-Archive -Path $folder -DestinationPath $finalZip -Force -CompressionLevel Fastest
27+
# I tried other approaches but nothing seemed to work and its more work than its worth at this point, so just zip it manually.

releasenotes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## v0.3.3
88

9-
- Added ToggleSwitch to allow a single (presumably momentary) button to send alternating values for a single command on rising edges (pushes) of said button.
9+
- Added ToggleButton to allow a single (presumably momentary) button to send alternating values for a single command on rising edges (pushes) of said button.
1010

1111
## v0.3.2
1212
- Added new feature for SwitchMultiPos, allowing a "default" state to be specified for controls that can have a default state. For example, A-10 Emergency Trim without a center detent

src/internal/Servos.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
#ifndef __DCSBIOS_SERVOS_H
22
#define __DCSBIOS_SERVOS_H
33

4-
#ifdef Servo_h
5-
64
#include "Arduino.h"
75
#include "ExportStreamListener.h"
86
#include <Servo.h>
97

10-
11-
12-
138
namespace DcsBios {
14-
15-
16-
179
class ServoOutput : public Int16Buffer {
1810
private:
1911
void onDcsBiosFrameSync();
@@ -58,6 +50,4 @@ namespace DcsBios {
5850
};
5951
}
6052

61-
#endif
62-
6353
#endif

0 commit comments

Comments
 (0)