diff --git a/.circleci/config.yml b/.circleci/config.yml index 2986032d6f..5a949d560a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 \ No newline at end of file diff --git a/radio/src/gui/128x64/lcd.cpp b/radio/src/gui/128x64/lcd.cpp index fc8db005b6..b532a64ba8 100644 --- a/radio/src/gui/128x64/lcd.cpp +++ b/radio/src/gui/128x64/lcd.cpp @@ -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); } diff --git a/radio/src/targets/flysky/tools/inav.cpp b/radio/src/targets/flysky/tools/inav.cpp index 5024b6fc93..4140019237 100644 --- a/radio/src/targets/flysky/tools/inav.cpp +++ b/radio/src/targets/flysky/tools/inav.cpp @@ -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 @@ -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]; @@ -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) { @@ -102,10 +118,10 @@ 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); @@ -113,22 +129,27 @@ static void inavDrawCraft(uint8_t x, uint8_t y) { 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() { @@ -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; @@ -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 @@ -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; @@ -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)); @@ -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); @@ -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(); diff --git a/tools/build-flysky.py b/tools/build-flysky.py index d91fdb56bc..5bf3e6ee1a 100755 --- a/tools/build-flysky.py +++ b/tools/build-flysky.py @@ -36,17 +36,7 @@ } translations = [ - "EN", - "PL", - "CZ", - "DE", - "ES", - "PT", - "NL", - "SE", - "FI", - "IT", - "FR" + "EN" ] common_options = {