mirror of
https://github.com/opentx/opentx.git
synced 2025-07-20 23:05:12 +03:00
More telemetry units. GPS screen rewritten.
This commit is contained in:
parent
209589ccc7
commit
f2126a8aa6
12 changed files with 84 additions and 68 deletions
12
src/Makefile
12
src/Makefile
|
@ -608,11 +608,6 @@ MIN_VER = ${shell sh -c "grep \"MIN_VERS\" open9x.h | cut -d\ -f3"}
|
|||
ABUILD_NUM = ${shell sh -c "grep \"BUILD_NUM\" stamp-open9x.h | egrep -o \"[[:digit:]]+\""}
|
||||
BUILD_NUM = $(shell echo $$(( $(ABUILD_NUM) + 1 )))
|
||||
BUILD_DIR = $(shell pwd | awk -F'/' '{print $$((NF-1))}')
|
||||
ifeq "$(USER)" "bryan"
|
||||
THEUSER=gruvin
|
||||
else
|
||||
THEUSER=$(USER)
|
||||
endif
|
||||
|
||||
# Default target.
|
||||
all: begin gccversion sizebefore build sizeafter end
|
||||
|
@ -640,9 +635,8 @@ stamp_header:
|
|||
@echo "//Automatically generated file (Makefile) - do not edit" > stamp-open9x.h
|
||||
@echo "#define DATE_STR \"`date +%Y-%m-%d`\"" >> stamp-open9x.h
|
||||
@echo "#define TIME_STR \"`date +%H:%I:%S`\"" >> stamp-open9x.h
|
||||
@echo "#define VERS_STR \"$(MAJ_VER).$(MIN_VER)-$(THEUSER)\"" >> stamp-open9x.h
|
||||
@echo "#define VERS_STR \"$(MAJ_VER).$(MIN_VER)-$(MODS)\"" >> stamp-open9x.h
|
||||
@echo "#define SVN_STR \"$(BUILD_DIR)-r$(REV)\"" >> stamp-open9x.h
|
||||
@echo "#define MOD_STR \"$(MODS)\"" >> stamp-open9x.h
|
||||
@cat stamp-open9x.h
|
||||
|
||||
stamp:
|
||||
|
@ -687,8 +681,8 @@ end:
|
|||
|
||||
|
||||
# Display size of file.
|
||||
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).elf
|
||||
ELFSIZE = $(SIZE) $(TARGET).elf
|
||||
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
||||
ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
|
||||
AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)
|
||||
|
||||
sizebefore:
|
||||
|
|
|
@ -56,6 +56,7 @@ struct FrskyAlarm frskyAlarms[4];
|
|||
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
FrskyHubData frskyHubData;
|
||||
int16_t baroAltitudeOffset = 0;
|
||||
uint8_t maxGpsSpeed = 0;
|
||||
#endif
|
||||
|
||||
void frskyPushValue(uint8_t *&ptr, uint8_t value)
|
||||
|
@ -150,6 +151,9 @@ void parseTelemHubByte(uint8_t byte)
|
|||
return;
|
||||
}
|
||||
((uint8_t*)&frskyHubData)[structPos+1] = byte;
|
||||
if (structPos == offsetof(FrskyHubData, gpsSpeed_ap)/2 && maxGpsSpeed < frskyHubData.gpsSpeed_ap)
|
||||
maxGpsSpeed = frskyHubData.gpsSpeed_ap;
|
||||
|
||||
state = TS_IDLE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -97,6 +97,7 @@ struct FrskyHubData {
|
|||
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
extern FrskyHubData frskyHubData;
|
||||
extern int16_t baroAltitudeOffset;
|
||||
extern uint8_t maxGpsSpeed;
|
||||
#endif
|
||||
|
||||
// Global Fr-Sky telemetry data variables
|
||||
|
|
10
src/lcd.cpp
10
src/lcd.cpp
|
@ -497,7 +497,7 @@ void putsTelemetryChannel(uint8_t x, uint8_t y, uint8_t channel, uint8_t val, ui
|
|||
{
|
||||
// TODO optimize this, avoid int32_t
|
||||
int16_t converted_value = ((int32_t)val+g_model.frsky.channels[channel].offset) * g_model.frsky.channels[channel].ratio * 2 / 51;
|
||||
if (g_model.frsky.channels[channel].type == 0 && converted_value < 1000) {
|
||||
if (g_model.frsky.channels[channel].type == UNIT_VOLTS && converted_value < 1000) {
|
||||
att |= PREC2;
|
||||
}
|
||||
else {
|
||||
|
@ -508,11 +508,13 @@ void putsTelemetryChannel(uint8_t x, uint8_t y, uint8_t channel, uint8_t val, ui
|
|||
|
||||
void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t att)
|
||||
{
|
||||
if (unit == 0/*v*/) {
|
||||
if (unit == UNIT_VOLTS) {
|
||||
putsVolts(x, y, val, att);
|
||||
}
|
||||
else /* raw or reserved unit */ {
|
||||
lcd_outdezAtt(x, y, val, att);
|
||||
else {
|
||||
lcd_outdezAtt(x, (att & DBLSIZE ? y - FH : y), val, att); // TODO we could add this test inside lcd_outdezAtt!
|
||||
if (~att & NO_UNIT && unit != UNIT_RAW)
|
||||
lcd_putsnAtt(lcd_lastPos+1, y, STR_VTELEMUNIT+LEN_VTELEMUNIT*unit, LEN_VTELEMUNIT, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -430,73 +430,82 @@ void menuMainView(uint8_t event)
|
|||
}
|
||||
#endif
|
||||
#ifdef FRSKY_HUB
|
||||
else if (g_model.frsky.usrProto == PROTO_FRSKY_HUB && view == e_telemetry+2*ALTERNATE_VIEW) {
|
||||
else if (g_model.frsky.usrProto == PROTO_FRSKY_HUB && view == e_telemetry+3*ALTERNATE_VIEW) {
|
||||
#define DATE_LINE (7*FH)
|
||||
//lcd_puts_P(0, DATE_LINE, PSTR("D/T:"));
|
||||
// Date
|
||||
lcd_outdezNAtt(1*FW, 1*FH, frskyHubData.year+2000, LEFT, 4);
|
||||
lcd_putc(lcd_lastPos, 1*FH, '-');
|
||||
lcd_outdezNAtt(lcd_lastPos+FW, 1*FH, frskyHubData.month, LEFT|LEADING0, 2);
|
||||
lcd_putc(lcd_lastPos, 1*FH, '-');
|
||||
lcd_outdezNAtt(lcd_lastPos+FW, 1*FH, frskyHubData.day, LEFT|LEADING0, 2);
|
||||
lcd_outdezNAtt(3*FW, DATE_LINE, frskyHubData.year+2000, LEFT, 4);
|
||||
lcd_putc(7*FW-4, DATE_LINE, '-');
|
||||
lcd_outdezNAtt(8*FW-4, DATE_LINE, frskyHubData.month, LEFT|LEADING0, 2);
|
||||
lcd_putc(10*FW-6, DATE_LINE, '-');
|
||||
lcd_outdezNAtt(11*FW-6, DATE_LINE, frskyHubData.day, LEFT|LEADING0, 2);
|
||||
|
||||
// Time
|
||||
lcd_outdezNAtt(FW*10+8, 1*FH, frskyHubData.hour, LEFT|LEADING0, 2);
|
||||
lcd_putc(lcd_lastPos, 1*FH, ':');
|
||||
lcd_outdezNAtt(lcd_lastPos+FW, 1*FH, frskyHubData.min, LEFT|LEADING0, 2);
|
||||
lcd_putc(lcd_lastPos, 1*FH, ':');
|
||||
lcd_outdezNAtt(lcd_lastPos+FW, 1*FH, frskyHubData.sec, LEFT|LEADING0, 2);
|
||||
|
||||
// Longitude
|
||||
lcd_outdezAtt(FW*3-2, 3*FH, frskyHubData.gpsLongitude_bp / 100, 0); // ddd before '.'
|
||||
lcd_putc(lcd_lastPos, 3*FH, '@');
|
||||
uint8_t mn = frskyHubData.gpsLongitude_bp % 100;
|
||||
lcd_outdezNAtt(lcd_lastPos+FW, 3*FH, mn, LEFT|LEADING0, 2); // mm before '.'
|
||||
lcd_plot(lcd_lastPos, 4*FH-2, 0); // small decimal point
|
||||
lcd_outdezNAtt(lcd_lastPos+2, 3*FH, frskyHubData.gpsLongitude_ap, LEFT|UNSIGN|LEADING0, 4); // after '.'
|
||||
lcd_putc(lcd_lastPos+1, 3*FH, frskyHubData.gpsLongitudeEW ? frskyHubData.gpsLongitudeEW : '-');
|
||||
lcd_outdezNAtt(12*FW+5, DATE_LINE, frskyHubData.hour, LEFT|LEADING0, 2);
|
||||
lcd_putc(14*FW+2, DATE_LINE, ':');
|
||||
lcd_outdezNAtt(15*FW+2, DATE_LINE, frskyHubData.min, LEFT|LEADING0, 2);
|
||||
lcd_putc(17*FW-1, DATE_LINE, ':');
|
||||
lcd_outdezNAtt(18*FW-1, DATE_LINE, frskyHubData.sec, LEFT|LEADING0, 2);
|
||||
lcd_filled_rect(0, DATE_LINE, DISPLAY_W, 8);
|
||||
|
||||
// Latitude
|
||||
lcd_outdezAtt(lcd_lastPos+3*FW+3, 3*FH, frskyHubData.gpsLatitude_bp / 100, 0); // ddd before '.'
|
||||
lcd_putc(lcd_lastPos, 3*FH, '@');
|
||||
mn = frskyHubData.gpsLatitude_bp % 100;
|
||||
lcd_outdezNAtt(lcd_lastPos+FW, 3*FH, mn, LEFT|LEADING0, 2); // mm before '.'
|
||||
lcd_plot(lcd_lastPos, 4*FH-2, 0); // small decimal point
|
||||
lcd_outdezNAtt(lcd_lastPos+2, 3*FH, frskyHubData.gpsLatitude_ap, LEFT|UNSIGN|LEADING0, 4); // after '.'
|
||||
lcd_putc(lcd_lastPos+1, 3*FH, frskyHubData.gpsLatitudeNS ? frskyHubData.gpsLatitudeNS : '-');
|
||||
#define LAT_LINE (2*FH)
|
||||
lcd_puts_P(0, LAT_LINE, PSTR("Lat:"));
|
||||
lcd_outdezAtt(lcd_lastPos, LAT_LINE, frskyHubData.gpsLatitude_bp / 100, LEFT); // ddd before '.'
|
||||
lcd_putc(lcd_lastPos, LAT_LINE, '@');
|
||||
uint8_t mn = frskyHubData.gpsLatitude_bp % 100;
|
||||
lcd_outdezNAtt(lcd_lastPos+FW, LAT_LINE, mn, LEFT|LEADING0, 2); // mm before '.'
|
||||
lcd_plot(lcd_lastPos, LAT_LINE+FH-2, 0); // small decimal point
|
||||
lcd_outdezNAtt(lcd_lastPos+2, LAT_LINE, frskyHubData.gpsLatitude_ap, LEFT|UNSIGN|LEADING0, 4); // after '.'
|
||||
lcd_putc(lcd_lastPos+1, LAT_LINE, frskyHubData.gpsLatitudeNS ? frskyHubData.gpsLatitudeNS : '-');
|
||||
|
||||
// Longitude
|
||||
#define LONG_LINE (3*FH)
|
||||
lcd_puts_P(0, LONG_LINE, PSTR("Lon:"));
|
||||
lcd_outdezAtt(lcd_lastPos, LONG_LINE, frskyHubData.gpsLongitude_bp / 100, LEFT); // ddd before '.'
|
||||
lcd_putc(lcd_lastPos, LONG_LINE, '@');
|
||||
mn = frskyHubData.gpsLongitude_bp % 100;
|
||||
lcd_outdezNAtt(lcd_lastPos+FW, LONG_LINE, mn, LEFT|LEADING0, 2); // mm before '.'
|
||||
lcd_plot(lcd_lastPos, LONG_LINE+FH-2, 0); // small decimal point
|
||||
lcd_outdezNAtt(lcd_lastPos+2, LONG_LINE, frskyHubData.gpsLongitude_ap, LEFT|UNSIGN|LEADING0, 4); // after '.'
|
||||
lcd_putc(lcd_lastPos+1, LONG_LINE, frskyHubData.gpsLongitudeEW ? frskyHubData.gpsLongitudeEW : '-');
|
||||
|
||||
#if 0
|
||||
// Course / Heading
|
||||
lcd_puts_P(5, 5*FH, STR_HDG);
|
||||
lcd_outdezNAtt(lcd_lastPos, 5*FH, frskyHubData.gpsCourse_bp, LEFT|LEADING0, 3); // before '.'
|
||||
lcd_plot(lcd_lastPos, 6*FH-2, 0); // small decimal point
|
||||
lcd_outdezAtt(lcd_lastPos+2, 5*FH, frskyHubData.gpsCourse_ap, LEFT); // after '.'
|
||||
lcd_putc(lcd_lastPos, 5*FH, '@');
|
||||
#endif
|
||||
|
||||
// Speed
|
||||
lcd_puts_P(76, 5*FH, STR_SPD);
|
||||
lcd_outdezAtt(lcd_lastPos, 5*FH, frskyHubData.gpsSpeed_bp, LEFT); // before '.'
|
||||
lcd_plot(lcd_lastPos, 6*FH-2, 0); // small decimal point
|
||||
lcd_outdezAtt(lcd_lastPos+2, 5*FH, frskyHubData.gpsSpeed_ap, LEFT|UNSIGN); // after '.'
|
||||
#define SPEED_LINE (6*FH)
|
||||
lcd_puts_P(0, SPEED_LINE, STR_SPD);
|
||||
putsTelemetryValue(lcd_lastPos, SPEED_LINE, frskyHubData.gpsSpeed_bp, UNIT_KTS, LEFT|DBLSIZE); // before '.'
|
||||
// lcd_putcAtt(lcd_lastPos-2, 5*FH, '.', DBLSIZE); // small decimal point
|
||||
// lcd_outdezAtt(lcd_lastPos+FW, 5*FH, frskyHubData.gpsSpeed_ap, LEFT|UNSIGN|DBLSIZE); // after '.'
|
||||
lcd_puts_P(10*FW, SPEED_LINE, PSTR("Max:"));
|
||||
putsTelemetryValue(lcd_lastPos, SPEED_LINE, maxGpsSpeed, UNIT_KTS, LEFT); // before '.'
|
||||
|
||||
// Altitude
|
||||
lcd_puts_P(7*FW, 7*FH, STR_ALT);
|
||||
lcd_outdezNAtt(lcd_lastPos, 7*FH, frskyHubData.gpsAltitude_bp, LEFT|LEADING0, 3); // before '.'
|
||||
lcd_plot(lcd_lastPos, 8*FH-2, 0); // small decimal point
|
||||
lcd_outdezAtt(lcd_lastPos+2, 7*FH, frskyHubData.gpsAltitude_ap, LEFT|UNSIGN); // after '.'
|
||||
lcd_putc(lcd_lastPos, 7*FH, 'm');
|
||||
#define ALTITUDE_LINE (4*FH)
|
||||
lcd_puts_P(0, ALTITUDE_LINE, STR_ALT);
|
||||
putsTelemetryValue(lcd_lastPos, ALTITUDE_LINE, frskyHubData.gpsAltitude_bp, UNIT_METERS, LEFT); // before '.'
|
||||
// lcd_plot(lcd_lastPos, 8*FH-2, 0); // small decimal point
|
||||
// lcd_outdezAtt(lcd_lastPos+2, 7*FH, frskyHubData.gpsAltitude_ap, LEFT|UNSIGN); // after '.'
|
||||
}
|
||||
else if (g_model.frsky.usrProto == PROTO_FRSKY_HUB && view == e_telemetry+3*ALTERNATE_VIEW) {
|
||||
else if (g_model.frsky.usrProto == PROTO_FRSKY_HUB && view == e_telemetry+2*ALTERNATE_VIEW) {
|
||||
uint8_t y = 2*FH;
|
||||
|
||||
// Temperature 1
|
||||
lcd_puts_P(0, y, STR_TEMP1);
|
||||
lcd_outdezNAtt(lcd_lastPos, y, frskyHubData.temperature1, LEFT);
|
||||
lcd_puts_P(lcd_lastPos, y, PSTR("@C"));
|
||||
putsTelemetryValue(lcd_lastPos, y, frskyHubData.temperature1, UNIT_DEGREES, LEFT);
|
||||
y += FH;
|
||||
|
||||
// Temperature 2
|
||||
lcd_puts_P(0, y, STR_TEMP2);
|
||||
lcd_outdezNAtt(lcd_lastPos, y, frskyHubData.temperature2, LEFT);
|
||||
lcd_puts_P(lcd_lastPos, y, PSTR("@C"));
|
||||
|
||||
putsTelemetryValue(lcd_lastPos, y, frskyHubData.temperature2, UNIT_DEGREES, LEFT);
|
||||
y += 2*FH;
|
||||
|
||||
// RPM
|
||||
|
|
|
@ -1880,7 +1880,7 @@ void menuProcTelemetry(uint8_t event)
|
|||
if (m_posHorz == 0)
|
||||
g_model.frsky.channels[i].ratio = checkIncDec(event, g_model.frsky.channels[i].ratio, 0, 255, EE_MODEL);
|
||||
else
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.channels[i].type, 0, 1);
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.channels[i].type, 0, UNIT_MAX-1);
|
||||
}
|
||||
}
|
||||
subN++;
|
||||
|
|
|
@ -177,6 +177,17 @@ PACK(typedef struct t_FuncSwData { // Function Switches data
|
|||
uint8_t param;
|
||||
}) FuncSwData;
|
||||
|
||||
enum TelemetryUnit {
|
||||
UNIT_VOLTS,
|
||||
UNIT_RAW,
|
||||
UNIT_KTS,
|
||||
UNIT_KMH,
|
||||
UNIT_MPH,
|
||||
UNIT_METERS,
|
||||
UNIT_DEGREES,
|
||||
UNIT_MAX
|
||||
};
|
||||
|
||||
PACK(typedef struct t_FrSkyChannelData {
|
||||
uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t type; // channel unit (0=volts, ...)
|
||||
|
|
|
@ -639,7 +639,6 @@ extern const char stamp1[];
|
|||
extern const char stamp2[];
|
||||
extern const char stamp3[];
|
||||
extern const char stamp4[];
|
||||
extern const char stamp5[];
|
||||
|
||||
#ifndef BATT_UNSTABLE_BANDGAP
|
||||
extern uint16_t abRunningAvg;
|
||||
|
|
|
@ -173,9 +173,7 @@ void Open9xSim::makeSnapshot(const FXDrawable* drawable)
|
|||
sprintf(buf,"snapshot_%02d.png", ++g_snapshot_idx);
|
||||
} while (stream.open(buf, FXStreamLoad));
|
||||
|
||||
if (stream.open(buf, FXStreamSave))
|
||||
//if (stream.open("snapshot.png", FXStreamSave))
|
||||
{
|
||||
if (stream.open(buf, FXStreamSave)) {
|
||||
snapshot.savePixels(stream);
|
||||
stream.close();
|
||||
printf("Snapshot written: %s\n", buf);
|
||||
|
|
|
@ -8,6 +8,4 @@ const pm_char stamp1[] PROGMEM = "VERS: V" VERS_STR;
|
|||
const pm_char stamp2[] PROGMEM = " SVN: " SVN_STR;
|
||||
const pm_char stamp3[] PROGMEM = "DATE: " DATE_STR;
|
||||
const pm_char stamp4[] PROGMEM = "TIME: " TIME_STR;
|
||||
const pm_char stamp5[] PROGMEM = " MOD: " MOD_STR;
|
||||
|
||||
|
||||
|
|
|
@ -65,13 +65,13 @@
|
|||
#else
|
||||
#define TR_SDCLOGGS
|
||||
#endif
|
||||
#define TR_VFSWFUNC "Security \0 ""Trainer \0 ""Instant Trim ""Trims2Offsets""Play sound " TR_SDCLOGGS
|
||||
#define TR_VFSWFUNC "Security \0 ""Trainer \0 ""Instant Trim ""Trims2Offsets""Play sound\0 " TR_SDCLOGGS
|
||||
|
||||
#define LEN_FUNCSOUNDS 6
|
||||
#define TR_FUNCSOUNDS "Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick ""Haptc1""Haptc2""Haptc3"
|
||||
|
||||
#define LEN_VTELEMUNIT 1
|
||||
#define TR_VTELEMUNIT "v""-"
|
||||
#define LEN_VTELEMUNIT 4
|
||||
#define TR_VTELEMUNIT "v\0 ""-\0 ""kts\0""km/h""M/h\0""m\0 ""@C\0 "
|
||||
|
||||
#define LEN_VALARM 3
|
||||
#define TR_VALARM "---""Yel""Org""Red"
|
||||
|
|
|
@ -70,8 +70,8 @@
|
|||
#define LEN_FUNCSOUNDS 6
|
||||
#define TR_FUNCSOUNDS "Warn1 ""Warn2 ""Cheep ""Ring ""SciFi ""Robot ""Chirp ""Tada ""Crickt""Siren ""AlmClk""Ratata""Tick ""Haptc1""Haptc2""Haptc3"
|
||||
|
||||
#define LEN_VTELEMUNIT 1
|
||||
#define TR_VTELEMUNIT "v""-"
|
||||
#define LEN_VTELEMUNIT 4
|
||||
#define TR_VTELEMUNIT "v\0 ""-\0 ""kts\0""km/h""M/h\0""m\0 ""@C\0 "
|
||||
|
||||
#define LEN_VALARM 3
|
||||
#define TR_VALARM "---""Yel""Org""Red"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue