Skip to content

Commit 154d352

Browse files
author
Scott Vincent
committed
New release
1 parent 99c8238 commit 154d352

File tree

17 files changed

+201
-51
lines changed

17 files changed

+201
-51
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ You can also run the display on a PC (the same one running FS2020 if you wish) b
1010

1111
Download the following two zip files.
1212

13-
Link: [Latest release of Instrument Panel for Windows](https://github.com/scott-vincent/instrument-panel/releases/latest/download/instrument-panel-v1.7.7-Windows-x64.zip)
13+
Link: [Latest release of Instrument Panel for Windows](https://github.com/scott-vincent/instrument-panel/releases/latest/download/instrument-panel-v1.7.8-Windows-x64.zip)
1414

15-
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.7-windows-x64.zip)
15+
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)
1616

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

instrument-panel/instruments/alt.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ void alt::update()
204204
if (fastAircraft) {
205205
customInstrument = new altFast(xPos, yPos, size, name);
206206
}
207+
prevVal = simVars->sbEncoder[2];
207208
}
208209

209210
#ifndef _WIN32
@@ -286,18 +287,34 @@ void alt::updateKnobs()
286287
{
287288
// Read knob for pressure calibration
288289
int val = globals.hardwareKnobs->read(calKnob);
290+
int diff = (val - prevVal) / 2;
291+
bool switchBox = false;
292+
293+
if (prevValSb == 0) {
294+
prevValSb = simVars->sbEncoder[2];
295+
}
296+
else if (simVars->sbEncoder[2] != prevValSb) {
297+
val = simVars->sbEncoder[2];
298+
diff = val - prevValSb;
299+
switchBox = true;
300+
}
289301

290302
if (val != INT_MIN) {
291303
// Change calibration by knob movement amount (adjust for desired sensitivity)
292-
double adjust = (int)((val - prevVal) / 2.0) * 0.01;
304+
double adjust = diff * 0.01;
293305
if (adjust != 0) {
294306
inhg += adjust;
295307
if (inhg < 28 || inhg >= 31.01) {
296308
inhg -= adjust;
297309
}
298310
double newVal = inhg * 33.86378746435 * 16;
299311
globals.simVars->write(KEY_KOHLSMAN_SET, newVal);
300-
prevVal = val;
312+
if (switchBox) {
313+
prevValSb = val;
314+
}
315+
else {
316+
prevVal = val;
317+
}
301318
}
302319
time(&lastCalAdjust);
303320
}

instrument-panel/instruments/alt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class alt : public instrument
2020
// Hardware knobs
2121
int calKnob = -1;
2222
int prevVal = 0;
23+
int prevValSb = 0;
2324
time_t lastCalAdjust = 0;
2425
time_t now;
2526

instrument-panel/instruments/alternate/altFast.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,18 +324,34 @@ void altFast::updateKnobs()
324324
{
325325
// Read knob for pressure calibration
326326
int val = globals.hardwareKnobs->read(calKnob);
327+
int diff = (val - prevVal) / 2;
328+
bool switchBox = false;
329+
330+
if (prevValSb == 0) {
331+
prevValSb = simVars->sbEncoder[2];
332+
}
333+
else if (simVars->sbEncoder[2] != prevValSb) {
334+
val = simVars->sbEncoder[2];
335+
diff = val - prevValSb;
336+
switchBox = true;
337+
}
327338

328339
if (val != INT_MIN) {
329340
// Change calibration by knob movement amount (adjust for desired sensitivity)
330-
double adjust = (int)((val - prevVal) / 2) * 0.01;
341+
double adjust = diff * 0.01;
331342
if (adjust != 0) {
332343
inhg += adjust;
333344
if (inhg < 28 || inhg >= 31.01) {
334345
inhg -= adjust;
335346
}
336347
double newVal = inhg * 33.86378746435 * 16;
337348
globals.simVars->write(KEY_KOHLSMAN_SET, newVal);
338-
prevVal = val;
349+
if (switchBox) {
350+
prevValSb = val;
351+
}
352+
else {
353+
prevVal = val;
354+
}
339355
}
340356
time(&lastCalAdjust);
341357
}

instrument-panel/instruments/alternate/altFast.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class altFast : public instrument
1919
// Hardware knobs
2020
int calKnob = -1;
2121
int prevVal = 0;
22+
int prevValSb = 0;
2223
time_t lastCalAdjust = 0;
2324
time_t now;
2425

instrument-panel/instruments/digitalClock.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,12 @@ void digitalClock::updateKnobs()
390390
val = globals.hardwareKnobs->read(rightButton);
391391
if (val != INT_MIN) {
392392
if (prevRightVal % 2 == 1) {
393+
if (prevTopVal % 2 == 0) {
394+
// Top and right buttons pressed at same time so reboot
395+
strcpy(globals.error, "Forced reboot\n");
396+
system("sudo reboot");
397+
}
398+
393399
time(&stopWatchPressed);
394400

395401
if (clockView == ElapsedTime) {

instrument-panel/instruments/digitalClock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class digitalClock : public instrument
4949
int topButton = -1;
5050
int leftButton = -1;
5151
int rightButton = -1;
52-
int prevTopVal = 0;
52+
int prevTopVal = -1;
5353
int prevLeftVal = 0;
5454
int prevRightVal = 0;
5555

instrument-panel/instruments/hi.cpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ void hi::render()
120120
/// </summary>
121121
void hi::update()
122122
{
123+
// Check for aircraft change
124+
bool aircraftChanged = (loadedAircraft != globals.aircraft);
125+
if (aircraftChanged) {
126+
loadedAircraft = globals.aircraft;
127+
prevVal = simVars->sbEncoder[3];
128+
}
129+
123130
// Check for position or size change
124131
long *settings = globals.simVars->readSettings(name, xPos, yPos, size);
125132

@@ -173,10 +180,21 @@ void hi::updateKnobs()
173180
{
174181
// Read knob for new instrument calibration
175182
int val = globals.hardwareKnobs->read(hdgKnob);
183+
int diff = (val - prevVal) / 2;
184+
bool switchBox = false;
185+
186+
if (simVars->sbMode != 3) {
187+
prevValSb = simVars->sbEncoder[3];
188+
}
189+
else if (simVars->sbEncoder[3] != prevValSb) {
190+
val = simVars->sbEncoder[3];
191+
diff = val - prevValSb;
192+
switchBox = true;
193+
}
176194

177195
if (val != INT_MIN) {
178196
// Convert knob value to heading (adjust for desired sensitivity)
179-
int adjust = ((int)(val - prevVal) / 2) * 5;
197+
int adjust = diff * 5;
180198
if (adjust != 0) {
181199
int newHeading = headingBug += adjust;
182200
if (newHeading > 359) {
@@ -187,7 +205,12 @@ void hi::updateKnobs()
187205
}
188206
globals.simVars->write(KEY_HEADING_BUG_SET, newHeading);
189207
globals.simVars->write(A32NX_FCU_HDG_SET, newHeading);
190-
prevVal = val;
208+
if (switchBox) {
209+
prevValSb = val;
210+
}
211+
else {
212+
prevVal = val;
213+
}
191214
}
192215
time(&lastBugAdjust);
193216
}

instrument-panel/instruments/hi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class hi : public instrument
88
{
99
private:
1010
SimVars* simVars;
11+
Aircraft loadedAircraft = UNDEFINED;
1112
float scaleFactor;
1213

1314
// Instrument values (caclulated from variables and needed to draw the instrument)
@@ -18,6 +19,7 @@ class hi : public instrument
1819
// Hardware knobs
1920
int hdgKnob = -1;
2021
int prevVal = 0;
22+
int prevValSb = 0;
2123
time_t lastBugAdjust = 0;
2224
time_t now;
2325

instrument-panel/instruments/tc.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ void tc::update()
131131
}
132132

133133
// Calculate values
134-
planeAngle = simVars->tcRate * 200;
134+
planeAngle = simVars->tcRate * 5;
135135

136-
if (planeAngle < -23) {
137-
planeAngle = -23;
136+
if (planeAngle < -35) {
137+
planeAngle = -35;
138138
}
139-
else if (planeAngle > 23) {
140-
planeAngle = 23;
139+
else if (planeAngle > 35) {
140+
planeAngle = 35;
141141
}
142142

143143
// Need to turn ball by -90 degrees = -64

0 commit comments

Comments
 (0)