Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INAV LITE WIDGET- MOD #399

Open
wants to merge 99 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
9d2c8ef
Origin
FRPProject Mar 9, 2024
7f247c5
Updated config.yml
FRPProject Mar 10, 2024
5842bed
origin Branch
FRPProject Mar 10, 2024
073fadd
yml
FRPProject Mar 10, 2024
48c0d53
Updated config.yml
FRPProject Mar 10, 2024
ecff537
py
FRPProject Mar 10, 2024
e3ac0dd
master
FRPProject Mar 10, 2024
b2095df
fix1-2
FRPProject Mar 10, 2024
8d0e985
fix2
FRPProject Mar 10, 2024
2ca5169
masterFix
FRPProject Mar 10, 2024
82df5bb
reset
FRPProject Mar 10, 2024
8bb1567
new
FRPProject Mar 10, 2024
e8ea598
Origin
FRPProject Mar 10, 2024
ed577a9
r1
FRPProject Mar 10, 2024
1c134af
rm1
FRPProject Mar 10, 2024
0d13a7e
S&E
FRPProject Mar 10, 2024
5087cb4
EN
FRPProject Mar 10, 2024
1e47304
INAV-TimerFIx
FRPProject Apr 3, 2024
80bd96d
V11.11.1 auto-set HOME Point
FRPProject May 9, 2024
df0a6f2
v3
FRPProject May 15, 2024
4053621
v4
FRPProject May 15, 2024
53024e1
v5
FRPProject May 15, 2024
aba0e5d
v5-1 (AutoSetHome)
FRPProject May 15, 2024
ca1f728
v6
FRPProject May 16, 2024
bfdee1f
V7
FRPProject May 16, 2024
e436f32
V8
FRPProject May 16, 2024
f93016c
V9
FRPProject May 16, 2024
09cd275
v10
FRPProject May 16, 2024
654d2cc
V11
FRPProject May 16, 2024
1189689
v12
FRPProject May 16, 2024
b958776
v13
FRPProject May 16, 2024
5e976ae
v14
FRPProject May 16, 2024
f684570
v15
FRPProject May 16, 2024
8acb46b
v16
FRPProject May 16, 2024
3f104f3
v17
FRPProject May 16, 2024
43deaef
TXPW
FRPProject May 20, 2024
8d97884
UNIT_MILLIWATTS
FRPProject May 20, 2024
51c28a3
alt = telemetryItem.value;V2
FRPProject May 20, 2024
fc5afa1
elsfif
FRPProject May 20, 2024
eff1f7b
v18
FRPProject May 20, 2024
9fef783
v19
FRPProject May 20, 2024
b7ed21c
v20
FRPProject May 20, 2024
8dcdece
v21
FRPProject May 20, 2024
b9e64a1
v22
FRPProject May 20, 2024
1a6fb67
v23
FRPProject May 20, 2024
15de753
v24
FRPProject May 20, 2024
1c4d81d
v25
FRPProject May 20, 2024
76f1505
v26
FRPProject May 20, 2024
c06178f
v27
FRPProject May 20, 2024
ef0ac2c
SMLSIZE | CENTERED
FRPProject May 20, 2024
e3ca3a6
;;
FRPProject May 20, 2024
6ab831c
--
FRPProject May 20, 2024
55db292
rr
FRPProject May 20, 2024
02335f7
{}
FRPProject May 20, 2024
1578ae2
***
FRPProject May 20, 2024
c65b69b
""
FRPProject May 20, 2024
e0b055f
v30
FRPProject May 20, 2024
64057ad
v31
FRPProject May 20, 2024
53edd52
v32
FRPProject May 20, 2024
02b9a95
v34
FRPProject May 20, 2024
ee4e6be
MapSign
FRPProject May 20, 2024
09767ea
KEY_DOWN
FRPProject May 20, 2024
80773d1
constexpr int8_t
FRPProject May 20, 2024
b934017
InavData
FRPProject May 20, 2024
18cefe1
MapPSign
FRPProject May 20, 2024
0dc7713
int8_t
FRPProject May 20, 2024
b41d67b
inavSetMapN
FRPProject May 20, 2024
9a4f21a
t1
FRPProject May 20, 2024
6ce444a
uint8_t
FRPProject May 20, 2024
c2e642e
MapNSign
FRPProject May 20, 2024
450e3e8
sine[32]
FRPProject May 20, 2024
8e950a7
//
FRPProject May 20, 2024
b7a88e4
-1
FRPProject May 20, 2024
af72a38
inavData.MapPSign
FRPProject May 20, 2024
9b175ef
S&W
FRPProject May 20, 2024
d751a9f
H&A
FRPProject May 20, 2024
05dabcd
>0
FRPProject May 20, 2024
983f30c
*=
FRPProject May 20, 2024
9ff04ef
KEY_RIGHT
FRPProject May 20, 2024
2115f6e
>=0
FRPProject May 20, 2024
1d9d911
else{
FRPProject May 20, 2024
6fefdfa
inititial value
FRPProject May 20, 2024
8e498ea
else if
FRPProject May 20, 2024
d347bb6
anestorov updates
FRPProject May 20, 2024
4ee786f
INAV_DIST_Y
FRPProject May 20, 2024
6ca8aa7
CRSF ARM
FRPProject May 20, 2024
5098774
}
FRPProject May 20, 2024
00f329c
vspd
FRPProject May 20, 2024
fdba618
TINSIZE
FRPProject May 20, 2024
6851d6f
INAV_BATTP_X, INAV_BATTP_Y
FRPProject May 20, 2024
8366e81
No Arm
FRPProject May 20, 2024
2e7750f
360 rotation
FRPProject May 21, 2024
be5b705
inavData-360deg
FRPProject May 21, 2024
b3492c7
inavData.MapOR
FRPProject May 21, 2024
392b4a8
LableFIX-360
FRPProject May 21, 2024
7597c7c
Clockwise360Rotation
FRPProject May 21, 2024
ee0405d
Clockwise360
FRPProject May 21, 2024
269563e
comments-added
FRPProject May 21, 2024
8c5910e
craftAngle-360
FRPProject May 21, 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
19 changes: 2 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,13 @@ jobs:
workflows:
openi6x-release-workflow:
jobs:
- build-en:
filters:
branches:
ignore:
- master
- build-std:
filters:
branches:
only:
- master
- Origin
- build-std-dfplayer:
filters:
branches:
only:
- master
- build-heli:
filters:
branches:
only:
- master
- build-heli-dfplayer:
filters:
branches:
only:
- master
- Origin
4 changes: 2 additions & 2 deletions radio/src/gui/128x64/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,10 @@ void drawTelemetryTopBar()
{
putsModelName(0, 0, g_model.header.name, g_eeGeneral.currModel, 0);
uint8_t att = (IS_TXBATT_WARNING() ? BLINK : 0);
putsVBat(10*FW-1,0,att);
//putsVBat(10*FW-1,0,att);
if (g_model.timers[0].mode) {
att = (timersStates[0].val<0 ? BLINK : 0);
drawTimer(13*FW+5, 0, timersStates[0].val, att, att);
drawTimer(10*FW-5, 0, timersStates[0].val, att, att);
}
lcdInvertLine(0);
}
Expand Down
174 changes: 137 additions & 37 deletions radio/src/targets/flysky/tools/inav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ static const int8_t sine[32] = {
0,-25,-49,-71,-91,-107,-118,-126,-128,-126,-118,-107,-91,-71,-49,-25
};

//#define INAV_ARM_X 18
//#define INAV_ARM_Y 9

#define INAV_BATTP_X 30
#define INAV_BATTP_Y 9
#define INAV_VOLT_X LCD_W
Expand Down Expand Up @@ -60,6 +63,12 @@ struct InavData {
int32_t currentLon;
// uint8_t homeHeading;
uint8_t heading;
uint8_t armed = 1;
uint8_t lastMode = 0;

int8_t MapPSign_X;//default (+):north up|(-):north down
int8_t MapPSign_Y;
uint8_t MapOR;
};

static InavData inavData; // = (InavData *)&reusableBuffer.cToolData[0];
Expand All @@ -79,7 +88,14 @@ static void inavSetHome() {
inavData.homeLat = inavData.currentLat;
inavData.homeLon = inavData.currentLon;
// inavData.homeHeading = inavData.heading;
audioEvent(AU_SPECIAL_SOUND_WARN1);
lcdDrawText(LCD_W/2-4 , LCD_H-14, "***", SMLSIZE);///indicator
}

static void inavSetMapN() {
inavData.MapOR+=1;//rotating the map 180 deg.
if (inavData.MapOR>3){
inavData.MapOR=0;
}
}

static void inavDrawHome(uint8_t x, uint8_t y) {
Expand All @@ -102,33 +118,38 @@ static void inavDrawCraft(uint8_t x, uint8_t y) {
int8_t rotatedPRX = (pRX * cosVal - pRY * sinVal) >> 7;
int8_t rotatedPRY = (pRY * cosVal + pRX * sinVal) >> 7;

uint8_t tPLX = x + rotatedPLX;
uint8_t tPLY = y + rotatedPLY;
uint8_t tPRX = x + rotatedPRX;
uint8_t tPRY = y + rotatedPRY;
uint8_t tPLX = x + inavData.MapPSign_X * rotatedPLX;
uint8_t tPLY = y + inavData.MapPSign_Y * rotatedPLY;
uint8_t tPRX = x + inavData.MapPSign_X * rotatedPRX;
uint8_t tPRY = y + inavData.MapPSign_Y * rotatedPRY;

// translate and draw
lcdDrawLine(x, y, tPLX, tPLY, SOLID, FORCE);
lcdDrawLine(x, y, tPRX, tPRY, SOLID, FORCE);
lcdDrawLine(tPLX, tPLY, tPRX, tPRY, DOTTED, FORCE);
}

// Mode: 0 - Passthrough, 1-Armed(rate), 2-Horizon, 3-Angle, 4-Waypoint, 5-AltHold, 6-PosHold, 7-Rth, 8-Launch, 9-Failsafe
//FM2 5-MANUAL, 1-ACRO, 1-AIR, 0-ANGLE, 7-HRZN, 2-ALTHOLD, 8-POSHOLD, 6-RTH, 3-WP, 3-CRUISE, 4-LAUNCH, 9-FAILSAFE
static void inavDrawAFHDS2AFM(uint8_t mode) {
static const char modeText[10][8] = {
{'P','A','S','S','T','H','R','U'},
{'A','R','M','E','D','\0',' ',' '},
{'H','O','R','I','Z','O','N','\0'},
{'A','N','G','L','E','\0',' ',' '},
{'W','A','Y','P','O','I','N','T'},
{'A','L','T',' ','H','O','L','D'},
{'P','O','S',' ','H','O','L','D'},
{'R','T','H','\0',' ',' ',' ',' '},
{'L','A','U','N','C','H','\0',' '},
{'F','A','I','L','S','A','F','E'},
static const char modeText[10][9] = {
{'A','N','G','L','E','\0',' ',' ',' '},
{'A','C','R','O',' ','A','I','R','\0'},
{'A','L','T',' ','H','O','L','D','\0'},
{'W','P',' ','C','R','U','I','S', 'E'},
{'L','A','U','N','C','H','\0',' ',' '},
{'M','A','N','U','E','L','\0',' ',' '},
{'R','T','H','\0',' ',' ',' ',' ',' '},
{'H','O','R','I','Z','O','N','\0',' '},
{'P','O','S',' ','H','O','L','D','\0'},
{'F','A','I','L','S','A','F','E','\0'},
};

lcdDrawSizedText(INAV_FM_X, INAV_FM_Y, modeText[mode], 8, SMLSIZE | CENTERED);
lcdDrawSizedText(INAV_FM_X, INAV_FM_Y, modeText[mode], 9, SMLSIZE | CENTERED);

if(inavData.lastMode != mode) {
audioEvent(AU_SPECIAL_SOUND_WARN2);
}
inavData.lastMode = mode;
}

static void inavDraw() {
Expand All @@ -139,8 +160,40 @@ static void inavDraw() {
lcdDrawSolidHorizontalLine(LCD_W - 26, 51, 32, FORCE);
lcdDrawLine(LCD_W - 30, (LCD_H / 2) + FH / 2, LCD_W - 28, (LCD_H / 2) + FH / 2, DOTTED, FORCE);

//MAP-Direction-Legend
switch(inavData.MapOR) { //90-deg each rotation:clockiwse
case 0://positive N up
lcdDrawText(LCD_W - 37, LCD_H/2, "E", SMLSIZE);//right
lcdDrawText(LCD_W/2-1 , LCD_H-6, "S", SMLSIZE);//down
inavData.MapPSign_X=1;
inavData.MapPSign_Y=1;
break;

case 1://negative north down: 180deg rotation
lcdDrawText(LCD_W - 37, LCD_H/2, "S", SMLSIZE);//right
lcdDrawText(LCD_W/2-1 , LCD_H-6, "W", SMLSIZE);//down
inavData.MapPSign_X=1;
inavData.MapPSign_Y=-1;
break;

case 2:
lcdDrawText(LCD_W - 37, LCD_H/2, "W", SMLSIZE);//right
lcdDrawText(LCD_W/2-1 , LCD_H-6, "N", SMLSIZE);//down
inavData.MapPSign_X=-1;
inavData.MapPSign_Y=-1;
break;

case 3:
lcdDrawText(LCD_W - 37, LCD_H/2, "N", SMLSIZE);//right
lcdDrawText(LCD_W/2-1 , LCD_H-6, "E", SMLSIZE);//down
inavData.MapPSign_X=-1;
inavData.MapPSign_Y=1;
break;

}

uint8_t rxBatt = 0, sats = 0;
int32_t dist = 0, alt = 0, galt = 0, speed = 0, current = 0;
int32_t dist = 0, alt = 0, galt = 0, speed = 0, current = 0, TXPW = 0;

int8_t rssi = 0;
int16_t vspd = 0;
Expand Down Expand Up @@ -186,13 +239,23 @@ static void inavDraw() {
} else if (strstr(sensor.label, ZSTR_GPS)) { // GPS coords
inavData.currentLat = telemetryItem.gps.longitude;
inavData.currentLon = telemetryItem.gps.latitude;
} else if(i==6){
TXPW= telemetryItem.value;//[7-1]:ELRS TX Power
} else if(i==10){ //CRSF ARM
inavData.armed = telemetryItem.value;
}
#endif // INAVLITE_CRSF
#endif // INAVLITE_CRSF=END

} else if (telemetryProtocol == PROTOCOL_FLYSKY_IBUS) {
#if defined(INAVLITE_AFHDS2A)
if (g_model.telemetrySensors[i].id == 0xfc) { // RX RSSI
rssi = telemetryItem.value;
}

if (g_model.telemetrySensors[i].id == 0x80) { // GPS
inavData.currentLat = telemetryItem.gps.latitude;
inavData.currentLon = telemetryItem.gps.longitude;
}

switch(g_model.telemetrySensors[i].instance) { // inav index - 1
case 1: // voltage sensor
Expand All @@ -218,8 +281,17 @@ static void inavDraw() {
case 8: // 9. Dist
dist = telemetryItem.value;
break;
// case 9: // 10. Armed
// break;
case 9: // 10. Armed
if(telemetryItem.value != inavData.armed) {
if(telemetryItem.value == 0) {
inavData.homeLat = 0;
inavData.homeLon = 0;
} else {
audioEvent(AU_SPECIAL_SOUND_SIREN);
}
}
inavData.armed = telemetryItem.value;
break;
case 10: // 11. Speed
speed = telemetryItem.value;
break;
Expand Down Expand Up @@ -253,23 +325,52 @@ static void inavDraw() {
// lcdDrawNumber(LCD_W, INAV_SATS_Y + 21, (9 - (sats % 10)) * 5 + 8, PREC1 | MIDSIZE | RIGHT);

drawValueWithUnit(INAV_CURRENT_X, INAV_CURRENT_Y, current, UNIT_AMPS, PREC1 | MIDSIZE | RIGHT);
drawValueWithUnit(INAV_CURRENT_X-8, INAV_CURRENT_Y-15, TXPW, UNIT_MILLIWATTS, MIDSIZE | RIGHT);

drawValueWithUnit(LCD_W - 11, 53, rssi, UNIT_DB, MIDSIZE | RIGHT);
drawValueWithUnit(INAV_GSPD_X, INAV_GSPD_Y, speed, UNIT_KMH, PREC1 | RIGHT);

drawValueWithUnit(INAV_DIST_X, INAV_DIST_Y, dist, UNIT_METERS, 0);
drawValueWithUnit(INAV_ALT_X, INAV_ALT_Y, alt, UNIT_METERS, RIGHT);
// drawValueWithUnit(INAV_DIST_X, INAV_DIST_Y, dist, UNIT_METERS, 0);
// drawValueWithUnit(INAV_ALT_X, INAV_ALT_Y, galt, UNIT_METERS, RIGHT);

lcdDrawChar(INAV_SATS_X - 25, INAV_SATS_Y + 4, SATS_ICON);
lcdDrawNumber(INAV_SATS_X, INAV_SATS_Y, sats, MIDSIZE | RIGHT);
drawValueWithUnit(INAV_GALT_X, INAV_GALT_Y, galt, UNIT_METERS, RIGHT);

lcdDrawText(INAV_GALT_X-19, INAV_GALT_Y-7, "Alt.", SMLSIZE);///indicator
drawValueWithUnit(INAV_GALT_X, INAV_GALT_Y, alt, UNIT_METERS, RIGHT);

lcdDrawText(INAV_GALT_X-19, INAV_GALT_Y-23, "Dist.", SMLSIZE);///indicator
drawValueWithUnit(INAV_GALT_X-5, INAV_GALT_Y-15, dist, UNIT_METERS, 0);
//lcdDrawText(INAV_GALT_X-25, INAV_GALT_Y-33, 'Distance');

// lcdDrawNumber(70, 20, inavData.currentLat, SMLSIZE | RIGHT);
// lcdDrawNumber(70, 30, inavData.currentLon, SMLSIZE | RIGHT);

//lcdDrawNumber(INAV_ALT_X, INAV_ALT_Y, vspd, SMLSIZE | RIGHT);
/*
static const char armText[2][5] = {
{'O', 'F', 'F', '\0', ' '},
{'A', 'R', 'M', 'E', 'D'}
};
lcdDrawSizedText(INAV_BATTP_X+10, INAV_GALT_Y, armText[inavData.armed], 5, TINSIZE);
*/
drawValueWithUnit(LCD_W - 6, 0, rxBatt, UNIT_VOLTS, PREC1 | RIGHT);
drawTelemetryTopBar(); // after rxBatt to add INVERS

if (sats >= 6 && inavData.homeLat == 0) {
inavSetHome();
audioEvent(AU_SPECIAL_SOUND_RATATA);
}
//auto-set HOME Point
if (sats >= 6 && current<10) { //current Value==10*Amp
if(speed<5 && dist<5 && galt<5 && alt<5){ //speed Value==10*KMH
inavSetHome();
//audioEvent(AU_SPECIAL_SOUND_TICK);
}
}
//test
//lcdDrawNumber(70, 30, speed, SMLSIZE | RIGHT);
//lcdDrawNumber(70, 20, galt, SMLSIZE | RIGHT);

int32_t h = inavData.homeLat - inavData.currentLat;
int32_t w = inavData.homeLon - inavData.currentLon;
int32_t d = isqrt32((w * w) + (h * h));
Expand All @@ -287,17 +388,12 @@ static void inavDraw() {
int32_t translatedCurrentLat = inavData.currentLat - centerLat;

// rotate to homeHeading
// ...

// scale
int8_t scaledHomeLon = translatedHomeLon / scaleFactor;
int8_t scaledHomeLat = translatedHomeLat / scaleFactor;
int8_t scaledCurrentLon = translatedCurrentLon / scaleFactor;
int8_t scaledCurrentLat = translatedCurrentLat / scaleFactor;

if (sats >= 6 && inavData.homeLat == 0) {
inavSetHome();
}
// ...
// scale:: //considering the North Position::inavData.MapPSign
int8_t scaledHomeLon = inavData.MapPSign_Y* translatedHomeLon / scaleFactor;
int8_t scaledHomeLat = inavData.MapPSign_X* translatedHomeLat / scaleFactor;
int8_t scaledCurrentLon = inavData.MapPSign_Y* translatedCurrentLon / scaleFactor;
int8_t scaledCurrentLat = inavData.MapPSign_X* translatedCurrentLat / scaleFactor;

// translate to LCD center space and draw
inavDrawHome(BBOX_CENTER_X + scaledHomeLat, BBOX_CENTER_Y - scaledHomeLon);
Expand All @@ -320,6 +416,10 @@ void inavRun(event_t event) {
popMenu();
} else if (event == EVT_KEY_LONG(KEY_ENTER)) { // set home on long press OK
inavSetHome();
audioEvent(AU_SPECIAL_SOUND_WARN2);
} else if (event == EVT_KEY_LONG(KEY_RIGHT)) { // set home on press menu
inavSetMapN();
audioEvent(AU_SPECIAL_SOUND_TADA);
}

inavDraw();
Expand Down
12 changes: 1 addition & 11 deletions tools/build-flysky.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,7 @@
}

translations = [
"EN",
"PL",
"CZ",
"DE",
"ES",
"PT",
"NL",
"SE",
"FI",
"IT",
"FR"
"EN"
]

common_options = {
Expand Down