[CLI] reboot command added

This commit is contained in:
Bertrand Songis
2016-02-20 16:55:05 +01:00
parent 0f4f49b64e
commit 67a599e0b9
45 changed files with 920 additions and 605 deletions
+2 -67
View File
@@ -30,6 +30,7 @@
#define POTS_LINE_Y 252
Layout * customScreens[MAX_CUSTOM_SCREENS];
Topbar * topbar;
void drawMainPots()
{
@@ -79,72 +80,6 @@ void drawTrims(uint8_t flightMode)
}
}
void drawMainViewTopBar()
{
const int ALTITUDE_Y = 16;
const int VOLTS_Y = 16+16+30;
const int ALTITUDE_W = 56;
const int ALTITUDE_X = LCD_W-ALTITUDE_Y-ALTITUDE_W;
const int ALTITUDE_H = 30;
const int PADDING = 4;
theme->drawTopbarBackground(NULL);
// USB icon
if (usbPlugged()) {
lcdDrawBitmapPattern(378, 8, LBM_TOPMENU_USB, MENU_TITLE_COLOR);
}
// RSSI
const uint8_t rssiBarsValue[] = { 30, 40, 50, 60, 80 };
const uint8_t rssiBarsHeight[] = { 5, 10, 15, 21, 31 };
for (unsigned int i=0; i<DIM(rssiBarsHeight); i++) {
uint8_t height = rssiBarsHeight[i];
lcdDrawSolidFilledRect(390+i*6, 38-height, 4, height, TELEMETRY_RSSI() >= rssiBarsValue[i] ? MENU_TITLE_COLOR : MENU_TITLE_DISABLE_COLOR);
}
// Radio battery - TODO
// putsValueWithUnit(370, 8, g_vbat100mV, UNIT_VOLTS, PREC1|SMLSIZE|MENU_TITLE_COLOR);
// lcdDrawSolidRect(300, 3, 20, 50, MENU_TITLE_COLOR);
// lcdDrawRect(batt_icon_x+FW, BAR_Y+1, 13, 7);
// lcdDrawSolidVerticalLine(batt_icon_x+FW+13, BAR_Y+2, 5);
// Rx battery
if (g_model.frsky.voltsSource) { // TODO should not be in frsky struct
TelemetryItem & item = telemetryItems[g_model.frsky.voltsSource-1];
if (item.isAvailable()) {
int32_t value = item.value;
TelemetrySensor & sensor = g_model.telemetrySensors[g_model.frsky.altitudeSource-1];
LcdFlags att = 0;
if (sensor.prec == 2) {
att |= PREC1;
value /= 10;
}
else if (sensor.prec == 1) {
att |= PREC1;
}
att |= (item.isOld() ? ALARM_COLOR : TEXT_COLOR);
lcdDrawSolidFilledRect(ALTITUDE_X, VOLTS_Y, ALTITUDE_W, ALTITUDE_H, TEXT_BGCOLOR);
lcdDrawText(ALTITUDE_X+PADDING, VOLTS_Y+2, "Voltage", att);
putsValueWithUnit(ALTITUDE_X+PADDING, VOLTS_Y+12, value, UNIT_VOLTS, DBLSIZE|LEFT|att);
}
}
// Model altitude
if (g_model.frsky.altitudeSource) {
TelemetryItem & item = telemetryItems[g_model.frsky.altitudeSource-1];
if (item.isAvailable()) {
int32_t value = item.value;
TelemetrySensor & sensor = g_model.telemetrySensors[g_model.frsky.altitudeSource-1];
if (sensor.prec) value /= sensor.prec == 2 ? 100 : 10;
LcdFlags att = (item.isOld() ? ALARM_COLOR : TEXT_COLOR);
lcdDrawSolidFilledRect(ALTITUDE_X, ALTITUDE_Y, ALTITUDE_W, ALTITUDE_H, TEXT_BGCOLOR);
lcdDrawText(ALTITUDE_X+PADDING, ALTITUDE_Y+2, "Alt", att);
putsValueWithUnit(ALTITUDE_X+PADDING, ALTITUDE_Y+12, value, UNIT_METERS, DBLSIZE|LEFT|att);
}
}
}
bool isViewAvailable(int index)
{
if (index <= VIEW_CHANNELS)
@@ -187,7 +122,7 @@ void onMainViewMenu(const char *result)
chainMenu(menuStatisticsView);
}
else if (result == STR_SETUP_SCREENS) {
pushMenu(menuTabMainviews[1]);
pushMenu(menuTabScreensSetup[1]);
}
else if (result == STR_ABOUT_US) {
chainMenu(menuAboutView);