Skip to content

Commit

Permalink
New release
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Vincent committed Dec 11, 2023
1 parent 539fed5 commit 0faed17
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 31 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

Download the following two files.

Link: [Latest release of Radio Panel for Raspberry Pi Zero W](https://github.com/scott-vincent/radio-panel/releases/latest/download/radio-panel-v1.3.7-raspi.tar.gz)
Link: [Latest release of Radio Panel for Raspberry Pi Zero W](https://github.com/scott-vincent/radio-panel/releases/latest/download/radio-panel-v1.5.0-raspi.tar.gz)

Link: [Latest release of Instrument Data Link for Windows](https://github.com/scott-vincent/instrument-data-link/releases/latest/download/instrument-data-link-v1.7.8-windows-x64.zip)
Link: [Latest release of Instrument Data Link for Windows](https://github.com/scott-vincent/instrument-data-link/releases/latest/download/instrument-data-link-v2.0.0-windows-x64.zip)

Unzip instrument-data-link into its own folder and double-click instrument-data-link.exe to run it.

Expand Down
7 changes: 5 additions & 2 deletions radio-panel/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ void identifyAircraft(char* aircraft)
else if (strncmp(aircraft, globals.Supermarine_Spitfire_Text, globals.Supermarine_Spitfire_Len) == 0) {
globals.aircraft = SUPERMARINE_SPITFIRE;
}
else if (strncmp(aircraft, globals.JustFlight_PA28_Text, globals.JustFlight_PA28_Len) == 0) {
globals.aircraft = JUSTFLIGHT_PA28;
}
else {
// Need to flip between other aircraft so that instruments
// can detect the aircraft has changed.
Expand All @@ -63,11 +66,11 @@ void identifyAircraft(char* aircraft)
/// <summary>
/// Server can send us a delta rather than full data so we need to unpack it.
/// </summary>
void receiveDelta(char *deltaData, long deltaSize, char* simVarsPtr)
void receiveDelta(char *deltaData, int deltaSize, char* simVarsPtr)
{
char* dataPtr = deltaData;

long tempDeltaSize = deltaSize;
int tempDeltaSize = deltaSize;
while (deltaSize > 0) {
DeltaDouble* deltaDouble = (DeltaDouble*)dataPtr;
if (deltaDouble->offset & 0x10000) {
Expand Down
4 changes: 4 additions & 0 deletions radio-panel/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum Aircraft {
FBW_A320,
BOEING_747,
SUPERMARINE_SPITFIRE,
JUSTFLIGHT_PA28,
OTHER_AIRCRAFT,
OTHER_AIRCRAFT2,
};
Expand Down Expand Up @@ -50,6 +51,9 @@ struct globalVars
const int Salty_Boeing_747_Len = 16;
const char* Supermarine_Spitfire_Text = "FlyingIron Spitfire";
const int Supermarine_Spitfire_Len = 19;
const char* JustFlight_PA28_Text = "Just Flight PA28";
const int JustFlight_PA28_Len = 16;

const int FastAircraftSpeed = 195;

const char* BitmapDir = "bitmaps/";
Expand Down
2 changes: 1 addition & 1 deletion radio-panel/radio-panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "simvars.h"
#include "radio.h"

const char* radioVersion = "v1.3.7";
const char* radioVersion = "v1.5.0";
const bool Debug = false;

struct globalVars globals;
Expand Down
30 changes: 18 additions & 12 deletions radio-panel/radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,10 +915,16 @@ void radio::gpioTrimWheelInput()
while (adjust != 0) {
if (adjust > 0) {
globals.simVars->write(KEY_ELEV_TRIM_UP);
if (globals.aircraft == JUSTFLIGHT_PA28) {
globals.simVars->write(KEY_ELEV_TRIM_UP);
}
adjust--;
}
else {
globals.simVars->write(KEY_ELEV_TRIM_DN);
if (globals.aircraft == JUSTFLIGHT_PA28) {
globals.simVars->write(KEY_ELEV_TRIM_DN);
}
adjust++;
}
}
Expand Down Expand Up @@ -1064,7 +1070,18 @@ double radio::adjustComFrac(int adjust)
int frac2 = thousandths % 100;

if (fracSetSel == 0) {
// Adjust 10ths, 100ths and 1000ths
// Adjust 10ths
frac1 += adjust;

if (frac1 > 9) {
frac1 = 0;
}
else if (frac1 < 0) {
frac1 = 9;
}
}
else {
// Adjust 100ths and 1000ths (rollover 10ths)
// 25 KHz spacing uses .000, .025, 0.050 and 0.075
// 8.33 KHz spacing uses 0.005, 0.010, 0.015, 0.030, 0.035, 0.040, 0.055, 0.060, 0.065, 0.080, 0.085 and 0.090
// So we can Skip .020, .045, .070 and .095
Expand Down Expand Up @@ -1103,17 +1120,6 @@ double radio::adjustComFrac(int adjust)
}
}
}
else {
// Adjust 10ths
frac1 += adjust;

if (frac1 > 9) {
frac1 = 0;
}
else if (frac1 < 0) {
frac1 = 9;
}
}

standbyFreq = whole + (frac1 / 10.0) + (frac2 / 1000.0);

Expand Down
3 changes: 2 additions & 1 deletion radio-panel/simvarDefs.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <stdio.h>
#include "simvarDefs.h"

const char* versionString = "v1.7.8";
const char* versionString = "v2.0.0";

const char* SimVarDefs[][2] = {
// Vars for Jetbridge (must come first)
Expand Down Expand Up @@ -370,6 +370,7 @@ WriteEvent WriteEvents[] = {
{ EVENT_GO_AROUND, "EVENT_GO_AROUND" },
{ EVENT_IS_CESSNA_152, "EVENT_IS_CESSNA_152" },
{ EVENT_NOT_CESSNA_152, "EVENT_NOT_CESSNA_152" },
{ EVENT_RESET_DRONE_FOV, "EVENT_RESET_DRONE_FOV" },
{ SWITCHBOX_JOY, "SWITCHBOX_JOY" },
{ VJOY_BUTTONS, "VJOY_BUTTONS" },
{ VJOY_BUTTON_1, "VJOY_BUTTON_1" },
Expand Down
13 changes: 7 additions & 6 deletions radio-panel/simvarDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ enum EVENT_ID {
KEY_TOGGLE_FLIGHT_DIRECTOR,
KEY_AP_SPD_VAR_SET,
KEY_AP_MACH_VAR_SET,
KEY_HEADING_BUG_SET,
KEY_HEADING_BUG_SET, // 50
KEY_AP_ALT_VAR_SET_ENGLISH,
KEY_AP_VS_VAR_SET_ENGLISH,
KEY_AP_AIRSPEED_ON,
Expand Down Expand Up @@ -276,7 +276,7 @@ enum EVENT_ID {
KEY_TANK_SELECT_1,
KEY_TANK_SELECT_2,
KEY_ENG_CRANK,
KEY_SKYTRACK_STATE,
KEY_SKYTRACK_STATE, // 98
KEY_G1000_PFD_SOFTKEY_1,
KEY_G1000_PFD_SOFTKEY_2,
KEY_G1000_PFD_SOFTKEY_3,
Expand Down Expand Up @@ -365,6 +365,7 @@ enum EVENT_ID {
EVENT_GO_AROUND,
EVENT_IS_CESSNA_152,
EVENT_NOT_CESSNA_152,
EVENT_RESET_DRONE_FOV,
SWITCHBOX_JOY,
VJOY_BUTTONS,
// Buttons must start from 1 and must be sequential until VJOY_BUTTONS_END
Expand Down Expand Up @@ -404,18 +405,18 @@ struct PosData {
};

struct Request {
long requestedSize;
long wantFullData;
int requestedSize;
int wantFullData;
WriteData writeData;
};

struct DeltaDouble {
long offset;
int offset;
double data;
};

struct DeltaString {
long offset;
int offset;
char data[32];
};

Expand Down
12 changes: 6 additions & 6 deletions radio-panel/simvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ char dataLinkHost[64];
int dataLinkPort;
extern const char* SimVarDefs[][2];
bool prevConnected = false;
long dataSize;
int dataSize;
Request request;
char deltaData[8192];
int nextFull = 0;

void dataLink(simvars*);
void identifyAircraft(char* aircraft);
void receiveDelta(char* deltaData, long deltaSize, char* simVarsPtr);
void receiveDelta(char* deltaData, int deltaSize, char* simVarsPtr);

simvars::simvars()
{
Expand Down Expand Up @@ -83,7 +83,7 @@ void simvars::write(EVENT_ID eventId, double value)
void resetConnection(simvars* thisPtr)
{
// Only want a subset of SimVars for Radio panel (to save bandwidth)
dataSize = (long)(&thisPtr->simVars.transponderCode) + sizeof(double) - (long)&thisPtr->simVars;
dataSize = (int)((long)(&thisPtr->simVars.transponderCode) + sizeof(double) - (long)&thisPtr->simVars);
request.requestedSize = dataSize;

// Want full data on first connect
Expand Down Expand Up @@ -138,7 +138,7 @@ void dataLink(simvars* thisPtr)
timeval timeout;
timeout.tv_sec = 0;
timeout.tv_usec = 500000;
long actualSize;
int actualSize;
int bytes;
int selFail = 0;

Expand Down Expand Up @@ -185,9 +185,9 @@ void dataLink(simvars* thisPtr)
// Receive latest data (delta will never be larger than full data size)
bytes = recv(sockfd, deltaData, dataSize, 0);

if (bytes == sizeof(long)) {
if (bytes == sizeof(int)) {
// Data size mismatch
memcpy(&actualSize, &thisPtr->simVars, sizeof(long));
memcpy(&actualSize, &thisPtr->simVars, sizeof(int));
printf("DataLink: Requested %ld bytes but server sent %ld bytes\n", dataSize, actualSize);
fflush(stdout);
exit(1);
Expand Down
2 changes: 1 addition & 1 deletion release.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rel=v1.3.7
rel=v1.5.0
mkdir release >/dev/null 2>&1
rm -rf release/$rel >/dev/null 2>&1
mkdir release/$rel
Expand Down

0 comments on commit 0faed17

Please sign in to comment.