Telemetry screen cosmetics
This commit is contained in:
@@ -42,7 +42,7 @@ class FlightModeGroup: public FormGroup
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkEvents()
|
void checkEvents() override
|
||||||
{
|
{
|
||||||
FormGroup::checkEvents();
|
FormGroup::checkEvents();
|
||||||
bool newActive = (getFlightMode() == index);
|
bool newActive = (getFlightMode() == index);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
class OutputEditWindow : public Page {
|
class OutputEditWindow : public Page {
|
||||||
public:
|
public:
|
||||||
OutputEditWindow(uint8_t channel) :
|
explicit OutputEditWindow(uint8_t channel) :
|
||||||
Page(ICON_MODEL_OUTPUTS),
|
Page(ICON_MODEL_OUTPUTS),
|
||||||
channel(channel)
|
channel(channel)
|
||||||
{
|
{
|
||||||
@@ -118,7 +118,7 @@ class OutputLineButton : public Button {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void paint(BitmapBuffer * dc) override
|
void paint(BitmapBuffer * dc) override
|
||||||
{
|
{
|
||||||
// first line
|
// first line
|
||||||
drawNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, output->min - 1000, PREC1);
|
drawNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, output->min - 1000, PREC1);
|
||||||
|
|||||||
@@ -140,23 +140,23 @@ class SensorEditWindow : public Page {
|
|||||||
new StaticText(sensorOneWindow, grid.getLabelSlot(), STR_FORMULA);
|
new StaticText(sensorOneWindow, grid.getLabelSlot(), STR_FORMULA);
|
||||||
new Choice(sensorOneWindow, grid.getFieldSlot(), STR_VFORMULAS, 0, TELEM_FORMULA_LAST, GET_DEFAULT(sensor->formula),
|
new Choice(sensorOneWindow, grid.getFieldSlot(), STR_VFORMULAS, 0, TELEM_FORMULA_LAST, GET_DEFAULT(sensor->formula),
|
||||||
[=](uint8_t newValue) {
|
[=](uint8_t newValue) {
|
||||||
sensor->formula = newValue;
|
sensor->formula = newValue;
|
||||||
sensor->param = 0;
|
sensor->param = 0;
|
||||||
if (sensor->formula == TELEM_FORMULA_CELL) {
|
if (sensor->formula == TELEM_FORMULA_CELL) {
|
||||||
sensor->unit = UNIT_VOLTS;
|
sensor->unit = UNIT_VOLTS;
|
||||||
sensor->prec = 2;
|
sensor->prec = 2;
|
||||||
}
|
}
|
||||||
else if (sensor->formula == TELEM_FORMULA_DIST) {
|
else if (sensor->formula == TELEM_FORMULA_DIST) {
|
||||||
sensor->unit = UNIT_DIST;
|
sensor->unit = UNIT_DIST;
|
||||||
sensor->prec = 0;
|
sensor->prec = 0;
|
||||||
}
|
}
|
||||||
else if (sensor->formula == TELEM_FORMULA_CONSUMPTION) {
|
else if (sensor->formula == TELEM_FORMULA_CONSUMPTION) {
|
||||||
sensor->unit = UNIT_MAH;
|
sensor->unit = UNIT_MAH;
|
||||||
sensor->prec = 0;
|
sensor->prec = 0;
|
||||||
}
|
}
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
telemetryItems[index].clear();
|
telemetryItems[index].clear();
|
||||||
updateSensorOneWindow();
|
updateSensorOneWindow();
|
||||||
});
|
});
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
}
|
}
|
||||||
@@ -413,7 +413,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
|||||||
new StaticText(window, grid.getLabelSlot(true), STR_CRITICALALARM);
|
new StaticText(window, grid.getLabelSlot(true), STR_CRITICALALARM);
|
||||||
edit = new NumberEdit(window, grid.getFieldSlot(), -30, 30, GET_SET_DEFAULT(g_model.rssiAlarms.critical));
|
edit = new NumberEdit(window, grid.getFieldSlot(), -30, 30, GET_SET_DEFAULT(g_model.rssiAlarms.critical));
|
||||||
edit->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
edit->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
|
||||||
drawNumber(dc, 2, 2, g_model.rssiAlarms.getCriticalRssi(), flags);
|
drawNumber(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, g_model.rssiAlarms.getCriticalRssi(), flags);
|
||||||
});
|
});
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
@@ -424,9 +424,15 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
|||||||
// Sensors
|
// Sensors
|
||||||
grid.setLabelWidth(140);
|
grid.setLabelWidth(140);
|
||||||
new Subtitle(window, grid.getLineSlot(), STR_TELEMETRY_SENSORS);
|
new Subtitle(window, grid.getLineSlot(), STR_TELEMETRY_SENSORS);
|
||||||
new StaticText(window, {SENSOR_COL2, grid.getWindowHeight() + 3, SENSOR_COL3 - SENSOR_COL2, PAGE_LINE_HEIGHT}, STR_VALUE, SMLSIZE | TEXT_DISABLE_COLOR);
|
|
||||||
if (!g_model.ignoreSensorIds && !IS_SPEKTRUM_PROTOCOL())
|
// Sensors columns titles
|
||||||
new StaticText(window, {SENSOR_COL3, grid.getWindowHeight() + 3, LCD_W - SENSOR_COL3, PAGE_LINE_HEIGHT}, STR_ID, SMLSIZE | TEXT_DISABLE_COLOR);
|
uint8_t sensorsCount = getTelemetrySensorsCount();
|
||||||
|
if (sensorsCount > 0) {
|
||||||
|
new StaticText(window, {SENSOR_COL2, grid.getWindowHeight() + 3, SENSOR_COL3 - SENSOR_COL2, PAGE_LINE_HEIGHT}, STR_VALUE, SMLSIZE | TEXT_DISABLE_COLOR);
|
||||||
|
if (!g_model.ignoreSensorIds && !IS_SPEKTRUM_PROTOCOL())
|
||||||
|
new StaticText(window, {SENSOR_COL3, grid.getWindowHeight() + 3, LCD_W - SENSOR_COL3, PAGE_LINE_HEIGHT}, STR_ID, SMLSIZE | TEXT_DISABLE_COLOR);
|
||||||
|
}
|
||||||
|
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
for (uint8_t idx = 0; idx < MAX_TELEMETRY_SENSORS; idx++) {
|
for (uint8_t idx = 0; idx < MAX_TELEMETRY_SENSORS; idx++) {
|
||||||
@@ -467,8 +473,12 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
grid.setLabelWidth(250);
|
||||||
|
|
||||||
// Autodiscover button
|
// Autodiscover button
|
||||||
auto discover = new TextButton(window, grid.getLineSlot(), STR_DISCOVER_SENSORS);
|
auto rect = grid.getLabelSlot(true);
|
||||||
|
rect.w -= MENUS_MARGIN_LEFT;
|
||||||
|
auto discover = new TextButton(window, rect, STR_DISCOVER_SENSORS);
|
||||||
discover->setPressHandler([=]() {
|
discover->setPressHandler([=]() {
|
||||||
allowNewSensors = !allowNewSensors;
|
allowNewSensors = !allowNewSensors;
|
||||||
if (allowNewSensors) {
|
if (allowNewSensors) {
|
||||||
@@ -480,10 +490,9 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
grid.nextLine();
|
|
||||||
|
|
||||||
// New sensor button
|
// New sensor button
|
||||||
new TextButton(window, grid.getLineSlot(), STR_TELEMETRY_NEWSENSOR,
|
new TextButton(window, grid.getFieldSlot(), STR_TELEMETRY_NEWSENSOR,
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
int idx = availableTelemetryIndex();
|
int idx = availableTelemetryIndex();
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
@@ -494,17 +503,19 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
|||||||
});
|
});
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
// Delete all sensors button
|
if (sensorsCount > 0) {
|
||||||
new TextButton(window, grid.getLineSlot(), STR_DELETE_ALL_SENSORS,
|
// Delete all sensors button
|
||||||
[]() -> uint8_t {
|
new TextButton(window, grid.getLineSlot(), STR_DELETE_ALL_SENSORS,
|
||||||
new FullScreenDialog(WARNING_TYPE_CONFIRM, STR_CONFIRMDELETE, "", [=]() {
|
[]() -> uint8_t {
|
||||||
for (int i = 0; i < MAX_TELEMETRY_SENSORS; i++) {
|
new FullScreenDialog(WARNING_TYPE_CONFIRM, STR_CONFIRMDELETE, "", [=]() {
|
||||||
delTelemetryIndex(i);
|
for (int i = 0; i < MAX_TELEMETRY_SENSORS; i++) {
|
||||||
}
|
delTelemetryIndex(i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return 0;
|
||||||
});
|
});
|
||||||
return 0;
|
grid.nextLine();
|
||||||
});
|
}
|
||||||
grid.nextLine();
|
|
||||||
|
|
||||||
// Ignore instance button
|
// Ignore instance button
|
||||||
new StaticText(window, grid.getLabelSlot(true), STR_IGNORE_INSTANCE);
|
new StaticText(window, grid.getLabelSlot(true), STR_IGNORE_INSTANCE);
|
||||||
@@ -540,5 +551,6 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
|||||||
|
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
|
window->setLastField();
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
window->setInnerHeight(grid.getWindowHeight());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class RadioToolsPage: public PageTab {
|
|||||||
void checkEvents() override;
|
void checkEvents() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void rebuild(FormWindow * window);
|
static void rebuild(FormWindow * window);
|
||||||
FormWindow * window = nullptr;
|
FormWindow * window = nullptr;
|
||||||
uint8_t waiting = 0;
|
uint8_t waiting = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -121,6 +121,17 @@ bool isTelemetryFieldAvailable(int index)
|
|||||||
return sensor.isAvailable();
|
return sensor.isAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t getTelemetrySensorsCount()
|
||||||
|
{
|
||||||
|
uint8_t count = 0;
|
||||||
|
for (auto telemetrySensor : g_model.telemetrySensors) {
|
||||||
|
if (telemetrySensor.isAvailable()) {
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
bool isTelemetryFieldComparisonAvailable(int index)
|
bool isTelemetryFieldComparisonAvailable(int index)
|
||||||
{
|
{
|
||||||
if (!isTelemetryFieldAvailable(index))
|
if (!isTelemetryFieldAvailable(index))
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ bool isAltSensor(int sensor);
|
|||||||
bool isVoltsSensor(int sensor);
|
bool isVoltsSensor(int sensor);
|
||||||
bool isCurrentSensor(int sensor);
|
bool isCurrentSensor(int sensor);
|
||||||
bool isTelemetryFieldAvailable(int index);
|
bool isTelemetryFieldAvailable(int index);
|
||||||
|
uint8_t getTelemetrySensorsCount();
|
||||||
bool isTelemetryFieldComparisonAvailable(int index);
|
bool isTelemetryFieldComparisonAvailable(int index);
|
||||||
bool isSensorAvailable(int sensor);
|
bool isSensorAvailable(int sensor);
|
||||||
bool isRssiSensorAvailable(int sensor);
|
bool isRssiSensorAvailable(int sensor);
|
||||||
|
|||||||
@@ -494,7 +494,7 @@ void hallStick_GetTxDataFromUSB( void )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TRANSFER_DIR_HALLSTICK:
|
case TRANSFER_DIR_HALLSTICK:
|
||||||
onFlySkyUsbDownloadStart(TRANSFER_DIR_HALLSTICK);
|
// onFlySkyUsbDownloadStart(TRANSFER_DIR_HALLSTICK);
|
||||||
|
|
||||||
if ( 0xA2 == HallProtocolTx.hallID.ID )
|
if ( 0xA2 == HallProtocolTx.hallID.ID )
|
||||||
{
|
{
|
||||||
@@ -513,17 +513,17 @@ void hallStick_GetTxDataFromUSB( void )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TRANSFER_DIR_RFMODULE:
|
case TRANSFER_DIR_RFMODULE:
|
||||||
onFlySkyUsbDownloadStart(TRANSFER_DIR_RFMODULE);
|
// onFlySkyUsbDownloadStart(TRANSFER_DIR_RFMODULE);
|
||||||
|
|
||||||
if ( 0xAE == HallProtocolTx.hallID.ID && HallProtocolTx.length == 0 )
|
if ( 0xAE == HallProtocolTx.hallID.ID && HallProtocolTx.length == 0 )
|
||||||
{ // 55 AE 00 D3 47
|
{ // 55 AE 00 D3 47
|
||||||
onIntmoduleUsbDownloadStart(INTERNAL_MODULE);
|
// onIntmoduleUsbDownloadStart(INTERNAL_MODULE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if ( isFlySkyUsbDownload() )
|
//if ( isFlySkyUsbDownload() )
|
||||||
{
|
{
|
||||||
intmoduleSendBufferDMA( pt, HallProtocolTx.length + 3 + 2 );
|
// intmoduleSendBufferDMA( pt, HallProtocolTx.length + 3 + 2 );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -532,7 +532,7 @@ void hallStick_GetTxDataFromUSB( void )
|
|||||||
|
|
||||||
if ( !usbPlugged() )
|
if ( !usbPlugged() )
|
||||||
{
|
{
|
||||||
onFlySkyUsbDownloadStart(0);
|
// onFlySkyUsbDownloadStart(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -586,7 +586,7 @@ void hall_stick_loop(void)
|
|||||||
//TRACE("HALL: %02X %02X %02X ...%04X", pt[0], pt[1], pt[2], HallProtocol.checkSum);
|
//TRACE("HALL: %02X %02X %02X ...%04X", pt[0], pt[1], pt[2], HallProtocol.checkSum);
|
||||||
pt[HallProtocol.length + 3] = HallProtocol.checkSum & 0xFF;
|
pt[HallProtocol.length + 3] = HallProtocol.checkSum & 0xFF;
|
||||||
pt[HallProtocol.length + 4] = HallProtocol.checkSum >> 8;
|
pt[HallProtocol.length + 4] = HallProtocol.checkSum >> 8;
|
||||||
usbDownloadTransmit( pt, HallProtocol.length + 5 );
|
// usbDownloadTransmit( pt, HallProtocol.length + 5 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//printf_log_now = 1;
|
//printf_log_now = 1;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ uint32_t readTrims()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t trimDown(uint8_t idx)
|
bool trimDown(uint8_t idx)
|
||||||
{
|
{
|
||||||
return readTrims() & (1 << idx);
|
return readTrims() & (1 << idx);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ void pwrOff()
|
|||||||
GPIO_ResetBits(PWR_GPIO, PWR_ON_GPIO_PIN);
|
GPIO_ResetBits(PWR_GPIO, PWR_ON_GPIO_PIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t pwrPressed()
|
bool pwrPressed()
|
||||||
{
|
{
|
||||||
return GPIO_ReadInputDataBit(PWR_GPIO, PWR_SWITCH_GPIO_PIN) == Bit_RESET;
|
return GPIO_ReadInputDataBit(PWR_GPIO, PWR_SWITCH_GPIO_PIN) == Bit_RESET;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user