Skip to content

Commit

Permalink
Support speed info from "Futaba" remote prop
Browse files Browse the repository at this point in the history
  • Loading branch information
realA10001986 authored Aug 29, 2024
1 parent b7be582 commit 7561778
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
3 changes: 3 additions & 0 deletions vsr-A10001986/vsr-A10001986.ino
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@

/* Changelog
*
* 2024/08/28 (A10001986)
* - Treat TCD-speed from Remote like speed from RotEnc
* - Fix some typos
* 2024/08/11 (A10001986)
* - In addition to the custom "key3" and "key6" sounds, now also "key1",
* "key4", "key7" and "key9" are available/supported; command codes are
Expand Down
4 changes: 2 additions & 2 deletions vsr-A10001986/vsr_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*** Version Strings ***
*************************************************************************/

#define VSR_VERSION "V0.11"
#define VSR_VERSION_EXTRA "AUG112024"
#define VSR_VERSION "V0.12"
#define VSR_VERSION_EXTRA "AUG282024"

//#define VSR_DBG // debug output on Serial

Expand Down
4 changes: 3 additions & 1 deletion vsr-A10001986/vsr_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,14 @@ bool FPBUnitIsOn = true;
#define BTTFN_NOT_WAKEUP 10
#define BTTFN_NOT_AUX_CMD 11
#define BTTFN_NOT_VSR_CMD 12
#define BTTFN_NOT_REM_CMD 13
#define BTTFN_TYPE_ANY 0 // Any, unknown or no device
#define BTTFN_TYPE_FLUX 1 // Flux Capacitor
#define BTTFN_TYPE_SID 2 // SID
#define BTTFN_TYPE_PCG 3 // Plutonium gauge panel
#define BTTFN_TYPE_VSR 4 // VSR
#define BTTFN_TYPE_AUX 5 // Aux (user custom device)
#define BTTFN_TYPE_REMOTE 6 // Futaba remote control
static const uint8_t BTTFUDPHD[4] = { 'B', 'T', 'T', 'F' };
static bool useBTTFN = false;
static WiFiUDP bttfUDP;
Expand Down Expand Up @@ -1810,7 +1812,7 @@ static void BTTFNCheckPacket()
if(BTTFUDPBuf[5] & 0x02) {
gpsSpeed = (int16_t)(BTTFUDPBuf[18] | (BTTFUDPBuf[19] << 8));
if(gpsSpeed > 88) gpsSpeed = 88;
spdIsRotEnc = (BTTFUDPBuf[26] & 0x80) ? true : false;
spdIsRotEnc = (BTTFUDPBuf[26] & (0x80|0x20)) ? true : false; // Speed is from RotEnc or Remote
}
if(BTTFUDPBuf[5] & 0x04) {
TCDtemperature = (int16_t)(BTTFUDPBuf[20] | (BTTFUDPBuf[21] << 8));
Expand Down
12 changes: 6 additions & 6 deletions vsr-A10001986/vsr_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,30 +584,30 @@ static bool checkValidNumParmF(char *text, float lowerLim, float upperLim, float
float f;

if(len == 0) {
sprintf(text, "%1.1f", setDefault);
sprintf(text, "%.1f", setDefault);
return true;
}

for(i = 0; i < len; i++) {
if(text[i] != '.' && text[i] != '-' && (text[i] < '0' || text[i] > '9')) {
sprintf(text, "%1.1f", setDefault);
sprintf(text, "%.1f", setDefault);
return true;
}
}

f = atof(text);

if(f < lowerLim) {
sprintf(text, "%1.1f", lowerLim);
sprintf(text, "%.1f", lowerLim);
return true;
}
if(f > upperLim) {
sprintf(text, "%1.1f", upperLim);
sprintf(text, "%.1f", upperLim);
return true;
}

// Re-do to get rid of formatting errors (eg "0.")
sprintf(text, "%1.1f", f);
sprintf(text, "%.1f", f);

return false;
}
Expand Down Expand Up @@ -641,7 +641,7 @@ bool loadBrightness()
File configFile;

if(!haveFS && !configOnSD) {
#ifdef SID_DBG
#ifdef VSR_DBG
Serial.printf("%s: %s\n", funcName, fsNoAvail);
#endif
return false;
Expand Down
4 changes: 2 additions & 2 deletions vsr-A10001986/vsrdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ void vsrDisplay::setNumber(int num)
} else {
int num1, num2, num3;
if(num > 999) {
char buf[4];
sprintf(buf, "%1.2d", (float)num/1000.0);
char buf[8];
sprintf(buf, "%.2f", (float)num/1000.0);
setText(buf);
} else {
num1 = num / 100;
Expand Down

0 comments on commit 7561778

Please sign in to comment.