Bsongis/move everything (#3669)

* Directories moved

* Directories moved

* Directories moved

* Directories moved

* Directories moved

* rename horus directories in gui to 480x272

* Directories moved

* Rename taranis to 212x64

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Fix x9e compile

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Minor improvement of path handling

* Another bunch of files renamed :)

* Another bunch of files renamed :)

* Another bunch of files renamed :)

* Another bunch of files renamed :)

* Another bunch of files renamed :)

* Rename 9x to 128x64

* Compilation fixes

* Compilation fixes

* Compilation fixes

* Compilation fixes

* Compilation fixes

* Compilation fixes
This commit is contained in:
Bertrand Songis
2016-07-29 12:47:20 +02:00
committed by GitHub
parent e3e0d970a5
commit 83cdd67e6a
340 changed files with 3035 additions and 5126 deletions
+71
View File
@@ -0,0 +1,71 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "opentx.h"
class GaugeWidget: public Widget
{
public:
GaugeWidget(const WidgetFactory * factory, const Zone & zone, Widget::PersistentData * persistentData):
Widget(factory, zone, persistentData)
{
}
virtual void refresh();
static const ZoneOption options[];
};
const ZoneOption GaugeWidget::options[] = {
{ "Source", ZoneOption::Source, OPTION_VALUE_UNSIGNED(1) },
{ "Min", ZoneOption::Integer, OPTION_VALUE_SIGNED(-RESX), OPTION_VALUE_SIGNED(-RESX), OPTION_VALUE_SIGNED(RESX) },
{ "Max", ZoneOption::Integer, OPTION_VALUE_SIGNED(RESX), OPTION_VALUE_SIGNED(-RESX), OPTION_VALUE_SIGNED(RESX) },
{ "Color", ZoneOption::Color, OPTION_VALUE_UNSIGNED(RED) },
{ NULL, ZoneOption::Bool }
};
void GaugeWidget::refresh()
{
mixsrc_t index = persistentData->options[0].unsignedValue;
int32_t min = persistentData->options[1].signedValue;
int32_t max = persistentData->options[2].signedValue;
uint16_t color = persistentData->options[3].unsignedValue;
int32_t value = getValue(index);
int32_t value_in_range = value;
if (value < min)
value_in_range = min;
else if (value > max)
value_in_range = max;
int w = divRoundClosest(zone.w * (value_in_range - min), (max - min));
int percent = divRoundClosest(100 * (value_in_range - min), (max - min));
// Gauge label
putsMixerSource(zone.x, zone.y, index, SMLSIZE | TEXT_INVERTED_COLOR);
// Gauge
lcdSetColor(color);
lcdDrawSolidFilledRect(zone.x, zone.y + 16, zone.w, 16, TEXT_INVERTED_COLOR);
lcdDrawNumber(zone.x+zone.w/2, zone.y + 17, percent, SMLSIZE | CUSTOM_COLOR | CENTERED, 0, NULL, "%");
lcd->invertRect(zone.x + w, zone.y + 16, zone.w - w, 16, CUSTOM_COLOR);
}
BaseWidgetFactory<GaugeWidget> gaugeWidget("Gauge", GaugeWidget::options);
@@ -0,0 +1,87 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "opentx.h"
class ModelBitmapWidget: public Widget
{
public:
ModelBitmapWidget(const WidgetFactory * factory, const Zone & zone, Widget::PersistentData * persistentData):
Widget(factory, zone, persistentData),
buffer(NULL)
{
memset(bitmapFilename, 255, sizeof(bitmapFilename));
}
virtual ~ModelBitmapWidget()
{
delete buffer;
}
void refreshBuffer()
{
delete buffer;
buffer = new BitmapBuffer(BMP_RGB565, zone.w, zone.h);
if (buffer) {
buffer->drawBitmap(0, 0, lcd, zone.x, zone.y, zone.w, zone.h);
GET_FILENAME(filename, BITMAPS_PATH, g_model.header.bitmap, "");
BitmapBuffer * bitmap = BitmapBuffer::load(filename);
if (zone.h >= 96 && zone.w >= 120) {
buffer->drawFilledRect(0, 0, zone.w, zone.h, SOLID, MAINVIEW_PANES_COLOR | OPACITY(5));
static BitmapBuffer * icon = BitmapBuffer::loadMask(getThemePath("mask_menu_model.png"));
buffer->drawMask(6, 4, icon, MAINVIEW_GRAPHICS_COLOR);
buffer->drawSizedText(45, 10, g_model.header.name, LEN_MODEL_NAME, ZCHAR | SMLSIZE);
buffer->drawSolidFilledRect(39, 27, zone.w - 48, 2, MAINVIEW_GRAPHICS_COLOR);
if (bitmap) {
buffer->drawScaledBitmap(bitmap, 0, 38, zone.w, zone.h - 38);
}
}
else {
if (bitmap) {
buffer->drawScaledBitmap(bitmap, 0, 0, zone.w, zone.h);
}
}
delete bitmap;
}
}
virtual void refresh()
{
if (memcmp(bitmapFilename, g_model.header.bitmap, sizeof(g_model.header.bitmap)) != 0 ||
memcmp(modelName, g_model.header.name, sizeof(g_model.header.name)) != 0) {
refreshBuffer();
memcpy(bitmapFilename, g_model.header.bitmap, sizeof(g_model.header.bitmap));
memcpy(modelName, g_model.header.name, sizeof(g_model.header.name));
}
if (buffer) {
lcd->drawBitmap(zone.x, zone.y, buffer);
}
}
protected:
char bitmapFilename[sizeof(g_model.header.bitmap)];
char modelName[sizeof(g_model.header.name)];
BitmapBuffer * buffer;
};
BaseWidgetFactory<ModelBitmapWidget> modelBitmapWidget("ModelBmp", NULL);
const WidgetFactory * defaultWidget = &modelBitmapWidget;
+94
View File
@@ -0,0 +1,94 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "opentx.h"
#define RECT_OFFSET 80
#define RECT_WIDTH (w - RECT_OFFSET)
#define ROW_HEIGHT 17
class OutputsWidget: public Widget
{
public:
OutputsWidget(const WidgetFactory * factory, const Zone & zone, Widget::PersistentData * persistentData):
Widget(factory, zone, persistentData)
{
}
virtual void refresh();
uint8_t drawChannels(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t firstChan)
{
char chanString[] = "CH32";
uint8_t numChan = h / ROW_HEIGHT;
uint8_t row_height = (h - numChan * ROW_HEIGHT >= numChan ? ROW_HEIGHT + 1 : ROW_HEIGHT);
uint8_t lastChan = firstChan + numChan;
for (uint8_t curChan = firstChan; curChan < lastChan && curChan < 33; curChan++) {
int16_t chanVal = calcRESXto100(channelOutputs[curChan-1]);
strAppend(chanString, "CH");
strAppendSigned(&chanString[2], curChan, 2);
lcdDrawText(x, y + (curChan - firstChan) * row_height + 1, chanString, SMLSIZE | TEXT_COLOR | LEFT);
strAppendSigned(chanString, chanVal);
lcdDrawText(x + RECT_OFFSET - 2, y + (curChan - firstChan) * row_height + 1, chanString, SMLSIZE | TEXT_COLOR | RIGHT);
if (chanVal > 0) {
lcdDrawSolidFilledRect(x + RECT_OFFSET + RECT_WIDTH / 2, y + (curChan -firstChan) * row_height, divRoundClosest(RECT_WIDTH * chanVal, 200), row_height, MAINVIEW_GRAPHICS_COLOR);
}
else if (chanVal < 0) {
uint16_t startpoint = x + RECT_OFFSET;
uint16_t endpoint = startpoint + RECT_WIDTH / 2;
uint16_t size = divRoundClosest(- RECT_WIDTH * chanVal, 200);
lcdDrawSolidFilledRect(endpoint - size, y + (curChan - firstChan) * row_height, size, row_height, MAINVIEW_GRAPHICS_COLOR);
}
lcdDrawRect(x + RECT_OFFSET, y + (curChan - firstChan) * row_height, RECT_WIDTH, row_height+1);
lcd->drawSolidVerticalLine(x + RECT_OFFSET + RECT_WIDTH / 2, y + (curChan - firstChan) * row_height, row_height, MAINVIEW_GRAPHICS_COLOR);
}
return lastChan;
}
void twoColumns()
{
uint8_t endColumn = drawChannels(zone.x, zone.y, zone.w / 2, zone.h, persistentData->options[0].unsignedValue);
drawChannels(zone.x + zone.w / 2 + 2, zone.y, zone.w / 2, zone.h, endColumn + 1);
}
void oneColumn()
{
drawChannels(zone.x, zone.y, zone.w, zone.h, persistentData->options[0].unsignedValue);
}
static const ZoneOption options[];
};
const ZoneOption OutputsWidget::options[] = {
{ "First channel", ZoneOption::Integer, OPTION_VALUE_UNSIGNED(1), OPTION_VALUE_UNSIGNED(1), OPTION_VALUE_UNSIGNED(32) },
{ NULL, ZoneOption::Bool }
};
void OutputsWidget::refresh()
{
if (zone.w > 300 && zone.h > 20)
twoColumns();
else if (zone.w > 150 && zone.h > 20)
oneColumn();
};
BaseWidgetFactory<OutputsWidget> outputsWidget("Outputs", OutputsWidget::options);
+50
View File
@@ -0,0 +1,50 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "opentx.h"
class TextWidget: public Widget
{
public:
TextWidget(const WidgetFactory * factory, const Zone & zone, Widget::PersistentData * persistentData):
Widget(factory, zone, persistentData)
{
}
virtual void refresh();
static const ZoneOption options[];
};
const ZoneOption TextWidget::options[] = {
{ "Text", ZoneOption::String, OPTION_VALUE_STRING("\015\347\0\14\377\376\373\364") },
{ "Color", ZoneOption::Color, OPTION_VALUE_UNSIGNED(RED) },
{ "Size", ZoneOption::TextSize, OPTION_VALUE_UNSIGNED(0) },
{ NULL, ZoneOption::Bool }
};
void TextWidget::refresh()
{
lcdSetColor(persistentData->options[1].unsignedValue);
LcdFlags fontsize = FONTSIZE(persistentData->options[2].unsignedValue << 8);
lcdDrawSizedText(zone.x, zone.y, persistentData->options[0].stringValue, sizeof(persistentData->options[0].stringValue), ZCHAR|fontsize|CUSTOM_COLOR);
}
BaseWidgetFactory<TextWidget> textWidget("Text", TextWidget::options);
+98
View File
@@ -0,0 +1,98 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "opentx.h"
class TimerWidget: public Widget
{
public:
TimerWidget(const WidgetFactory * factory, const Zone & zone, Widget::PersistentData * persistentData):
Widget(factory, zone, persistentData)
{
}
virtual void refresh();
static const ZoneOption options[];
};
const ZoneOption TimerWidget::options[] = {
{ "Timer source", ZoneOption::Timer, OPTION_VALUE_UNSIGNED(0) },
{ NULL, ZoneOption::Bool }
};
void TimerWidget::refresh()
{
uint32_t index = persistentData->options[0].unsignedValue;
TimerData & timerData = g_model.timers[index];
TimerState & timerState = timersStates[index];
if (zone.w >= 180 && zone.h >= 70) {
if (timerState.val >= 0 || !(timerState.val % 2)) {
lcdDrawBitmapPattern(zone.x, zone.y, LBM_TIMER_BACKGROUND, MAINVIEW_PANES_COLOR);
}
else {
lcdDrawBitmapPattern(zone.x, zone.y, LBM_TIMER_BACKGROUND, HEADER_BGCOLOR);
}
if (timerData.start && timerState.val >= 0) {
lcdDrawBitmapPatternPie(
zone.x + 2,
zone.y + 3, LBM_RSCALE, MAINVIEW_GRAPHICS_COLOR, 0,
timerState.val <= 0 ? 360 : 360 * (timerData.start - timerState.val) / timerData.start);
}
else {
lcdDrawBitmapPattern(zone.x + 3, zone.y + 4, LBM_TIMER, MAINVIEW_GRAPHICS_COLOR);
}
if (abs(timerState.val) >= 3600) {
putsTimer(zone.x + 70, zone.y + 31, abs(timerState.val), TEXT_COLOR | MIDSIZE | LEFT | TIMEHOUR);
}
else {
putsTimer(zone.x + 76, zone.y + 31, abs(timerState.val), TEXT_COLOR | DBLSIZE | LEFT);
}
if (ZLEN(timerData.name) > 0) {
lcdDrawSizedText(zone.x + 78, zone.y + 20, timerData.name, LEN_TIMER_NAME, ZCHAR | SMLSIZE | TEXT_COLOR);
}
drawStringWithIndex(zone.x + 137, zone.y + 17, "TMR", index + 1, SMLSIZE | TEXT_COLOR);
}
else {
if (timerState.val < 0 && timerState.val % 2) {
lcdDrawSolidFilledRect(zone.x, zone.y, zone.w, zone.h, HEADER_ICON_BGCOLOR);
}
drawStringWithIndex(zone.x + 2, zone.y, "TMR", index + 1, SMLSIZE | TEXT_INVERTED_COLOR);
if (zone.w > 100 && zone.h > 40) {
if (abs(timerState.val) >= 3600) {
putsTimer(zone.x + 3, zone.y + 16, abs(timerState.val), TEXT_INVERTED_COLOR | LEFT | TIMEHOUR);
}
else {
putsTimer(zone.x + 3, zone.y + 16, abs(timerState.val), TEXT_INVERTED_COLOR | LEFT | MIDSIZE);
}
}
else {
if (abs(timerState.val) >= 3600) {
putsTimer(zone.x + 3, zone.y + 14, abs(timerState.val), TEXT_INVERTED_COLOR | LEFT | SMLSIZE | TIMEHOUR);
}
else {
putsTimer(zone.x + 3, zone.y + 14, abs(timerState.val), TEXT_INVERTED_COLOR | LEFT);
}
}
}
}
BaseWidgetFactory<TimerWidget> timerWidget("Timer", TimerWidget::options);
+99
View File
@@ -0,0 +1,99 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "opentx.h"
class ValueWidget: public Widget
{
public:
ValueWidget(const WidgetFactory * factory, const Zone & zone, Widget::PersistentData * persistentData):
Widget(factory, zone, persistentData)
{
}
virtual void refresh();
static const ZoneOption options[];
};
const ZoneOption ValueWidget::options[] = {
{ "Source", ZoneOption::Source, OPTION_VALUE_UNSIGNED(MIXSRC_Rud) },
{ NULL, ZoneOption::Bool }
};
void ValueWidget::refresh()
{
const int NUMBERS_PADDING = 4;
mixsrc_t field = persistentData->options[0].unsignedValue;
LcdFlags color = TEXT_INVERTED_COLOR;
int x = zone.x;
int y = zone.y;
// lcdDrawFilledRect(zone.x, zone.y, zone.w, zone.h, SOLID, MAINVIEW_PANES_COLOR | OPACITY(5));
int xValue, yValue, xLabel, yLabel;
LcdFlags attrValue, attrLabel=0;
if (zone.w < 120 && zone.h < 50) {
xValue = x;
yValue = y+14;
xLabel = x;
yLabel = y;
attrValue = LEFT | NO_UNIT | MIDSIZE;
attrLabel = SMLSIZE;
}
else if (zone.h < 50) {
xValue = x+zone.w-NUMBERS_PADDING;
yValue = y-2;
xLabel = x+NUMBERS_PADDING;
yLabel = y+2;
attrValue = RIGHT | NO_UNIT | DBLSIZE;
}
else {
xValue = x+NUMBERS_PADDING;
yValue = y+16;
xLabel = x+NUMBERS_PADDING;
yLabel = y+2;
attrValue = LEFT | DBLSIZE;
}
if (field >= MIXSRC_FIRST_TIMER && field <= MIXSRC_LAST_TIMER) {
TimerState & timerState = timersStates[field-MIXSRC_FIRST_TIMER];
if (timerState.val < 0) {
color = ALARM_COLOR;
}
putsMixerSource(x+NUMBERS_PADDING, y+2, field, color);
putsTimer(xValue, yValue, abs(timerState.val), attrValue|DBLSIZE|color);
return;
}
if (field >= MIXSRC_FIRST_TELEM) {
TelemetryItem & telemetryItem = telemetryItems[(field-MIXSRC_FIRST_TELEM)/3]; // TODO macro to convert a source to a telemetry index
if (!telemetryItem.isAvailable() || telemetryItem.isOld()) {
color = ALARM_COLOR;
}
}
putsMixerSource(xLabel, yLabel, field, attrLabel|color);
putsChannel(xValue, yValue, field, attrValue|color);
}
BaseWidgetFactory<ValueWidget> ValueWidget("Value", ValueWidget::options);