Merge branch 'EdgeTX:2.4' into 2.4
This commit is contained in:
@@ -29,6 +29,7 @@ jobs:
|
|||||||
- X10
|
- X10
|
||||||
- X12S
|
- X12S
|
||||||
- X7
|
- X7
|
||||||
|
- X9D
|
||||||
- X9DP
|
- X9DP
|
||||||
- X9DP2019
|
- X9DP2019
|
||||||
- X9LITE
|
- X9LITE
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ jobs:
|
|||||||
- X10
|
- X10
|
||||||
- X12S
|
- X12S
|
||||||
- X7
|
- X7
|
||||||
|
- X9D
|
||||||
- X9DP
|
- X9DP
|
||||||
- X9DP2019
|
- X9DP2019
|
||||||
- X9LITE
|
- X9LITE
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
"targets": [
|
"targets": [
|
||||||
["TX16s", "tx16s-"],
|
["TX16s", "tx16s-"],
|
||||||
["QX7", "x7-"],
|
["QX7", "x7-"],
|
||||||
|
["X9D", "x9d-"],
|
||||||
["X9D Plus", "x9dp-"],
|
["X9D Plus", "x9dp-"],
|
||||||
["X9D Plus 2019", "x9dp2019-"],
|
["X9D Plus 2019", "x9dp2019-"],
|
||||||
["T-Lite", "tlite-"],
|
["T-Lite", "tlite-"],
|
||||||
["X-Lite", "xlite-"],
|
["X-Lite", "xlite-"],
|
||||||
["X9 Lite", "x9lite-"],
|
["X9 Lite", "x9lite-"],
|
||||||
["T16", "t16-"],
|
["T16", "t16-"],
|
||||||
|
["T18", "t18-"],
|
||||||
["TX12", "tx12-"],
|
["TX12", "tx12-"],
|
||||||
["Horus X12s", "x12s-"],
|
["Horus X12s", "x12s-"],
|
||||||
["Horus X10", "x10-"],
|
["Horus X10", "x10-"],
|
||||||
|
|||||||
@@ -1576,6 +1576,7 @@ void menuModelSetup(event_t event)
|
|||||||
if (MULTIMODULE_PROTOCOL_KNOWN(moduleIdx)) {
|
if (MULTIMODULE_PROTOCOL_KNOWN(moduleIdx)) {
|
||||||
const char * title = getMultiOptionTitle(moduleIdx);
|
const char * title = getMultiOptionTitle(moduleIdx);
|
||||||
|
|
||||||
|
if (!title) break;
|
||||||
lcdDrawText(INDENT_WIDTH, y, title);
|
lcdDrawText(INDENT_WIDTH, y, title);
|
||||||
if (title == STR_MULTI_RFTUNE) {
|
if (title == STR_MULTI_RFTUNE) {
|
||||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN + 23, y, "RSSI(", LEFT);
|
lcdDrawText(MODEL_SETUP_2ND_COLUMN + 23, y, "RSSI(", LEFT);
|
||||||
|
|||||||
@@ -277,7 +277,9 @@ class ModelCategoryPageBody : public FormWindow
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
y += MODEL_SELECT_CELL_HEIGHT + MODEL_CELL_PADDING;
|
if (index % MODEL_CELLS_PER_LINE != 0) {
|
||||||
|
y += MODEL_SELECT_CELL_HEIGHT + MODEL_CELL_PADDING;
|
||||||
|
}
|
||||||
setInnerHeight(y);
|
setInnerHeight(y);
|
||||||
|
|
||||||
if (category->empty()) {
|
if (category->empty()) {
|
||||||
|
|||||||
@@ -92,6 +92,10 @@ class FileNameEditWindow : public Page
|
|||||||
RadioSdManagerPage::RadioSdManagerPage() :
|
RadioSdManagerPage::RadioSdManagerPage() :
|
||||||
PageTab(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, ICON_RADIO_SD_MANAGER)
|
PageTab(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, ICON_RADIO_SD_MANAGER)
|
||||||
{
|
{
|
||||||
|
setOnSetVisibleHandler([]() {
|
||||||
|
TRACE("f_chdir(ROOT_PATH)");
|
||||||
|
f_chdir(ROOT_PATH);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioSdManagerPage::rebuild(FormWindow * window)
|
void RadioSdManagerPage::rebuild(FormWindow * window)
|
||||||
@@ -115,6 +119,13 @@ char * getFullPath(const std::string &filename)
|
|||||||
return full_path;
|
return full_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char * getCurrentPath()
|
||||||
|
{
|
||||||
|
static char path[FF_MAX_LFN + 1]; // TODO optimize that!
|
||||||
|
f_getcwd((TCHAR*)path, FF_MAX_LFN);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
class FilePreview : public Window
|
class FilePreview : public Window
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -209,6 +220,7 @@ void RadioSdManagerPage::build(FormWindow * window)
|
|||||||
std::list<std::string> files;
|
std::list<std::string> files;
|
||||||
std::list<std::string> directories;
|
std::list<std::string> directories;
|
||||||
|
|
||||||
|
std::string currentPath(getCurrentPath());
|
||||||
auto preview = new FilePreview(window, {LCD_W / 2 + 6, 0, LCD_W / 2 - 16, window->height()});
|
auto preview = new FilePreview(window, {LCD_W / 2 + 6, 0, LCD_W / 2 - 16, window->height()});
|
||||||
|
|
||||||
FRESULT res = f_opendir(&dir, "."); // Open the directory
|
FRESULT res = f_opendir(&dir, "."); // Open the directory
|
||||||
@@ -238,7 +250,8 @@ void RadioSdManagerPage::build(FormWindow * window)
|
|||||||
|
|
||||||
for (auto name: directories) {
|
for (auto name: directories) {
|
||||||
auto b = new TextButton(window, grid.getLabelSlot(), name, [=]() -> uint8_t {
|
auto b = new TextButton(window, grid.getLabelSlot(), name, [=]() -> uint8_t {
|
||||||
f_chdir(name.data());
|
std::string fullpath = currentPath + "/" + name;
|
||||||
|
f_chdir(fullpath.c_str());
|
||||||
window->clear();
|
window->clear();
|
||||||
build(window);
|
build(window);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -250,6 +263,7 @@ void RadioSdManagerPage::build(FormWindow * window)
|
|||||||
for (auto name: files) {
|
for (auto name: files) {
|
||||||
auto button = new TextButton(window, grid.getLabelSlot(), name, [=]() -> uint8_t {
|
auto button = new TextButton(window, grid.getLabelSlot(), name, [=]() -> uint8_t {
|
||||||
auto menu = new Menu(window);
|
auto menu = new Menu(window);
|
||||||
|
f_chdir(currentPath.c_str());
|
||||||
const char *ext = getFileExtension(name.data());
|
const char *ext = getFileExtension(name.data());
|
||||||
if (ext) {
|
if (ext) {
|
||||||
if (!strcasecmp(ext, SOUNDS_EXT)) {
|
if (!strcasecmp(ext, SOUNDS_EXT)) {
|
||||||
@@ -286,14 +300,14 @@ void RadioSdManagerPage::build(FormWindow * window)
|
|||||||
dialog->flash(getFullPath(name));
|
dialog->flash(getFullPath(name));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (isExtensionMatching(ext, BITMAPS_EXT)) {
|
// else if (isExtensionMatching(ext, BITMAPS_EXT)) {
|
||||||
// TODO
|
// // TODO
|
||||||
}
|
// }
|
||||||
else if (!strcasecmp(ext, TEXT_EXT)) {
|
// else if (!strcasecmp(ext, TEXT_EXT)) {
|
||||||
menu->addLine(STR_VIEW_TEXT, [=]() {
|
// menu->addLine(STR_VIEW_TEXT, [=]() {
|
||||||
// TODO
|
// // TODO
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
if (!READ_ONLY() && !strcasecmp(ext, FIRMWARE_EXT)) {
|
if (!READ_ONLY() && !strcasecmp(ext, FIRMWARE_EXT)) {
|
||||||
if (isBootloader(name.data())) {
|
if (isBootloader(name.data())) {
|
||||||
menu->addLine(STR_FLASH_BOOTLOADER, [=]() {
|
menu->addLine(STR_FLASH_BOOTLOADER, [=]() {
|
||||||
@@ -328,8 +342,9 @@ void RadioSdManagerPage::build(FormWindow * window)
|
|||||||
}
|
}
|
||||||
#if defined(LUA)
|
#if defined(LUA)
|
||||||
else if (isExtensionMatching(ext, SCRIPTS_EXT)) {
|
else if (isExtensionMatching(ext, SCRIPTS_EXT)) {
|
||||||
|
std::string fullpath = currentPath + "/" + name;
|
||||||
menu->addLine(STR_EXECUTE_FILE, [=]() {
|
menu->addLine(STR_EXECUTE_FILE, [=]() {
|
||||||
luaExec(getFullPath(name));
|
luaExec(fullpath.c_str());
|
||||||
//TODO: check 'luaState'
|
//TODO: check 'luaState'
|
||||||
StandaloneLuaWindow::instance()->attach(window);
|
StandaloneLuaWindow::instance()->attach(window);
|
||||||
});
|
});
|
||||||
@@ -374,7 +389,8 @@ void RadioSdManagerPage::build(FormWindow * window)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}, 0);
|
}, OPAQUE);
|
||||||
|
button->setBgColorHandler([=]() -> LcdFlags { return FIELD_BGCOLOR; });
|
||||||
button->setFocusHandler([=](bool active) {
|
button->setFocusHandler([=](bool active) {
|
||||||
if (active) {
|
if (active) {
|
||||||
preview->setFile(getFullPath(name));
|
preview->setFile(getFullPath(name));
|
||||||
|
|||||||
@@ -119,10 +119,14 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
auto b = new TextButton(
|
auto b = new TextButton(
|
||||||
window, grid.getFieldSlot(1), label,
|
window, grid.getFieldSlot(1), label,
|
||||||
[window, path_str]() -> uint8_t {
|
[window, path_str]() -> uint8_t {
|
||||||
f_chdir("/SCRIPTS/TOOLS/");
|
|
||||||
luaExec(path_str.c_str());
|
char toolPath[FF_MAX_LFN + 1];
|
||||||
// TODO: check 'luaState'
|
strncpy(toolPath, path_str.c_str(), sizeof(toolPath)-1);
|
||||||
|
*((char *)getBasename(toolPath)-1) = '\0';
|
||||||
|
f_chdir(toolPath);
|
||||||
|
|
||||||
StandaloneLuaWindow::instance()->attach(window);
|
StandaloneLuaWindow::instance()->attach(window);
|
||||||
|
luaExec(path_str.c_str());
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
OPAQUE);
|
OPAQUE);
|
||||||
@@ -255,6 +259,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(PXX2)
|
#if defined(PXX2)
|
||||||
|
#if 0 // disabled Power Meter: not yet implemented
|
||||||
if (isPXX2ModuleOptionAvailable(
|
if (isPXX2ModuleOptionAvailable(
|
||||||
reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE]
|
reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE]
|
||||||
.information.modelID,
|
.information.modelID,
|
||||||
@@ -282,8 +287,10 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(GHOST)
|
#if defined(GHOST)
|
||||||
|
#if 0
|
||||||
if (isModuleGhost(EXTERNAL_MODULE)) {
|
if (isModuleGhost(EXTERNAL_MODULE)) {
|
||||||
auto txt = new StaticText(window, grid.getLabelSlot(), "ghost",
|
auto txt = new StaticText(window, grid.getLabelSlot(), "ghost",
|
||||||
BUTTON_BACKGROUND, CENTERED);
|
BUTTON_BACKGROUND, CENTERED);
|
||||||
@@ -307,6 +314,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
});
|
});
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
window->setInnerHeight(grid.getWindowHeight());
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class SpecialFunctionEditPage : public Page
|
|||||||
window,
|
window,
|
||||||
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT,
|
||||||
LCD_W - PAGE_TITLE_LEFT, 20},
|
LCD_W - PAGE_TITLE_LEFT, 20},
|
||||||
(functions == g_model.customFn ? "SF" : "GF") + std::to_string(index),
|
(functions == g_model.customFn ? "SF" : "GF") + std::to_string(index+1),
|
||||||
0, FOCUS_COLOR);
|
0, FOCUS_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,7 +526,7 @@ void SpecialFunctionsPage::build(FormWindow *window, int8_t focusIndex)
|
|||||||
|
|
||||||
for (uint8_t i = 0; i < MAX_SPECIAL_FUNCTIONS; i++) {
|
for (uint8_t i = 0; i < MAX_SPECIAL_FUNCTIONS; i++) {
|
||||||
CustomFunctionData *cfn = &functions[i];
|
CustomFunctionData *cfn = &functions[i];
|
||||||
strAppendUnsigned(&s[2], i);
|
strAppendUnsigned(&s[2], i+1);
|
||||||
|
|
||||||
if (cfn->swtch == 0) {
|
if (cfn->swtch == 0) {
|
||||||
auto button = new TextButton(window, grid.getLabelSlot(), s);
|
auto button = new TextButton(window, grid.getLabelSlot(), s);
|
||||||
|
|||||||
@@ -146,9 +146,10 @@ void TabsGroup::setVisibleTab(PageTab * tab)
|
|||||||
Keyboard::hide();
|
Keyboard::hide();
|
||||||
#endif
|
#endif
|
||||||
currentTab = tab;
|
currentTab = tab;
|
||||||
|
if (tab->onSetVisible) tab->onSetVisible();
|
||||||
tab->build(&body);
|
tab->build(&body);
|
||||||
if (!focusWindow)
|
if (!focusWindow) setFocus(SET_FOCUS_DEFAULT);
|
||||||
setFocus(SET_FOCUS_DEFAULT);
|
|
||||||
header.setTitle(tab->title.c_str());
|
header.setTitle(tab->title.c_str());
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,17 +50,9 @@ class PageTab {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroy()
|
void setOnSetVisibleHandler(std::function<void()> handler)
|
||||||
{
|
{
|
||||||
if (onPageDestroyed) {
|
onSetVisible = std::move(handler);
|
||||||
onPageDestroyed();
|
|
||||||
}
|
|
||||||
delete this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setOnPageDestroyedHandler(std::function<void()> handler)
|
|
||||||
{
|
|
||||||
onPageDestroyed = std::move(handler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTitle(std::string value)
|
void setTitle(std::string value)
|
||||||
@@ -81,7 +73,7 @@ class PageTab {
|
|||||||
protected:
|
protected:
|
||||||
std::string title;
|
std::string title;
|
||||||
unsigned icon = 0;
|
unsigned icon = 0;
|
||||||
std::function<void()> onPageDestroyed;
|
std::function<void()> onSetVisible;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TabsCarousel: public Window {
|
class TabsCarousel: public Window {
|
||||||
|
|||||||
@@ -29,48 +29,44 @@ class ModelBitmapWidget: public Widget
|
|||||||
ModelBitmapWidget(const WidgetFactory * factory, FormGroup * parent, const rect_t & rect, Widget::PersistentData * persistentData):
|
ModelBitmapWidget(const WidgetFactory * factory, FormGroup * parent, const rect_t & rect, Widget::PersistentData * persistentData):
|
||||||
Widget(factory, parent, rect, persistentData)
|
Widget(factory, parent, rect, persistentData)
|
||||||
{
|
{
|
||||||
|
loadBitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void refresh(BitmapBuffer * dc) override
|
void refresh(BitmapBuffer * dc) override
|
||||||
{
|
{
|
||||||
if (buffer && ((buffer->width() != width()) || (buffer->height() != height()))) {
|
if (buffer &&
|
||||||
|
((buffer->width() != width()) || (buffer->height() != height()) ||
|
||||||
|
(deps_hash != getHash()))) {
|
||||||
loadBitmap();
|
loadBitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
// big space to draw
|
// big space to draw
|
||||||
if (rect.h >= 96 && rect.w >= 120) {
|
if (rect.h >= 96 && rect.w >= 120) {
|
||||||
|
|
||||||
dc->drawFilledRect(0, 0, rect.w, rect.h, SOLID, MAINVIEW_PANES_COLOR, OPACITY(5));
|
if (buffer) {
|
||||||
|
dc->drawBitmap(0, 0, buffer.get());
|
||||||
|
}
|
||||||
|
|
||||||
auto iconMask = theme->getIconMask(ICON_MODEL);
|
auto iconMask = theme->getIconMask(ICON_MODEL);
|
||||||
if (iconMask) {
|
if (iconMask) {
|
||||||
dc->drawMask(6, 4, iconMask, MAINVIEW_GRAPHICS_COLOR);
|
dc->drawMask(6, 4, iconMask, HEADER_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
dc->drawSizedText(45, 10, g_model.header.name, LEN_MODEL_NAME, FONT(XS));
|
dc->drawSizedText(45, 10, g_model.header.name, LEN_MODEL_NAME,
|
||||||
dc->drawSolidFilledRect(39, 27, rect.w - 48, 2, MAINVIEW_GRAPHICS_COLOR);
|
FONT(XS) | DEFAULT_COLOR);
|
||||||
|
dc->drawSolidFilledRect(39, 27, rect.w - 48, 2, HEADER_COLOR);
|
||||||
if (buffer) {
|
|
||||||
dc->drawBitmap(0, 38, buffer.get());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// smaller space to draw
|
// smaller space to draw
|
||||||
else if (buffer) {
|
else if (buffer) {
|
||||||
dc->drawBitmap(0, 38, buffer.get());
|
dc->drawBitmap(0, 0, buffer.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkEvents() override
|
void checkEvents() override
|
||||||
{
|
{
|
||||||
Widget::checkEvents();
|
Widget::checkEvents();
|
||||||
|
if (getHash() != deps_hash) {
|
||||||
uint32_t new_hash = hash(g_model.header.bitmap, sizeof(g_model.header.bitmap));
|
invalidate();
|
||||||
new_hash ^= hash(g_model.header.name, sizeof(g_model.header.name));
|
|
||||||
new_hash ^= hash(g_eeGeneral.themeName, sizeof(g_eeGeneral.themeName));
|
|
||||||
|
|
||||||
if (new_hash != deps_hash) {
|
|
||||||
deps_hash = new_hash;
|
|
||||||
loadBitmap();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,6 +74,11 @@ class ModelBitmapWidget: public Widget
|
|||||||
std::unique_ptr<BitmapBuffer> buffer;
|
std::unique_ptr<BitmapBuffer> buffer;
|
||||||
uint32_t deps_hash = 0;
|
uint32_t deps_hash = 0;
|
||||||
|
|
||||||
|
uint32_t getHash()
|
||||||
|
{
|
||||||
|
return hash(g_model.header.bitmap, sizeof(g_model.header.bitmap));
|
||||||
|
}
|
||||||
|
|
||||||
void loadBitmap()
|
void loadBitmap()
|
||||||
{
|
{
|
||||||
std::string filename = std::string(g_model.header.bitmap);
|
std::string filename = std::string(g_model.header.bitmap);
|
||||||
@@ -94,7 +95,7 @@ class ModelBitmapWidget: public Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
buffer->clear(DEFAULT_BGCOLOR);
|
buffer->clear(DEFAULT_BGCOLOR);
|
||||||
buffer->drawScaledBitmap(bitmap.get(), 0, 0, width(), height() - 38);
|
buffer->drawScaledBitmap(bitmap.get(), 0, 38, width(), height() - 38);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -783,9 +783,6 @@ Set a color for specific area
|
|||||||
*/
|
*/
|
||||||
static int luaLcdSetColor(lua_State *L)
|
static int luaLcdSetColor(lua_State *L)
|
||||||
{
|
{
|
||||||
if (!luaLcdAllowed)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
unsigned int index = luaL_checkunsigned(L, 1) >> 16;
|
unsigned int index = luaL_checkunsigned(L, 1) >> 16;
|
||||||
unsigned int color = luaL_checkunsigned(L, 2);
|
unsigned int color = luaL_checkunsigned(L, 2);
|
||||||
|
|
||||||
@@ -806,9 +803,6 @@ Get the color for specific area : see lcd.setColor for area list
|
|||||||
|
|
||||||
static int luaLcdGetColor(lua_State *L)
|
static int luaLcdGetColor(lua_State *L)
|
||||||
{
|
{
|
||||||
if (!luaLcdAllowed)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
unsigned int index = luaL_checkunsigned(L, 1) >> 16;
|
unsigned int index = luaL_checkunsigned(L, 1) >> 16;
|
||||||
lua_pushunsigned(L, lcdColorTable[index]);
|
lua_pushunsigned(L, lcdColorTable[index]);
|
||||||
|
|
||||||
@@ -834,9 +828,6 @@ Returns a 5/6/5 rgb color code, that can be used with lcd.setColor
|
|||||||
*/
|
*/
|
||||||
static int luaRGB(lua_State *L)
|
static int luaRGB(lua_State *L)
|
||||||
{
|
{
|
||||||
if (!luaLcdAllowed)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int r = luaL_checkinteger(L, 1);
|
int r = luaL_checkinteger(L, 1);
|
||||||
int g = luaL_checkinteger(L, 2);
|
int g = luaL_checkinteger(L, 2);
|
||||||
int b = luaL_checkinteger(L, 3);
|
int b = luaL_checkinteger(L, 3);
|
||||||
|
|||||||
@@ -678,7 +678,6 @@ inline void resetMultiProtocolsOptions(uint8_t moduleIdx)
|
|||||||
else {
|
else {
|
||||||
g_model.moduleData[moduleIdx].multi.autoBindMode = 0;
|
g_model.moduleData[moduleIdx].multi.autoBindMode = 0;
|
||||||
}
|
}
|
||||||
g_model.moduleData[moduleIdx].subType = 0;
|
|
||||||
g_model.moduleData[moduleIdx].multi.optionValue = 0;
|
g_model.moduleData[moduleIdx].multi.optionValue = 0;
|
||||||
g_model.moduleData[moduleIdx].multi.disableTelemetry = 0;
|
g_model.moduleData[moduleIdx].multi.disableTelemetry = 0;
|
||||||
g_model.moduleData[moduleIdx].multi.disableMapping = 0;
|
g_model.moduleData[moduleIdx].multi.disableMapping = 0;
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ void convertRadioData(int version)
|
|||||||
RTOS_WAIT_MS(200);
|
RTOS_WAIT_MS(200);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Load models list before converting
|
||||||
|
modelslist.load();
|
||||||
|
|
||||||
const char* error = nullptr;
|
const char* error = nullptr;
|
||||||
for (auto category_ptr : modelslist.getCategories()) {
|
for (auto category_ptr : modelslist.getCategories()) {
|
||||||
for (auto model_ptr : *category_ptr) {
|
for (auto model_ptr : *category_ptr) {
|
||||||
|
|||||||
@@ -149,9 +149,6 @@ void storageReadAll()
|
|||||||
// it's being reloaded after USB connection
|
// it's being reloaded after USB connection
|
||||||
modelslist.clear();
|
modelslist.clear();
|
||||||
|
|
||||||
// and reload the list
|
|
||||||
modelslist.load();
|
|
||||||
|
|
||||||
if (loadRadioSettings() != nullptr) {
|
if (loadRadioSettings() != nullptr) {
|
||||||
storageEraseAll(true);
|
storageEraseAll(true);
|
||||||
}
|
}
|
||||||
@@ -163,6 +160,9 @@ void storageReadAll()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// and reload the list
|
||||||
|
modelslist.load();
|
||||||
|
|
||||||
// Current model filename is empty...
|
// Current model filename is empty...
|
||||||
// Let's fix it!
|
// Let's fix it!
|
||||||
if (strlen(g_eeGeneral.currModelFilename) == 0) {
|
if (strlen(g_eeGeneral.currModelFilename) == 0) {
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ if (PCB STREQUAL X10)
|
|||||||
add_definitions(-DRADIO_FAMILY_T16)
|
add_definitions(-DRADIO_FAMILY_T16)
|
||||||
option(INTERNAL_MODULE_MULTI "Support for MULTI internal module" ON)
|
option(INTERNAL_MODULE_MULTI "Support for MULTI internal module" ON)
|
||||||
option(BLUETOOTH "Support for bluetooth module" OFF)
|
option(BLUETOOTH "Support for bluetooth module" OFF)
|
||||||
|
set(HARDWARE_TOUCH YES)
|
||||||
add_definitions(-DMANUFACTURER_JUMPER)
|
add_definitions(-DMANUFACTURER_JUMPER)
|
||||||
else()
|
else()
|
||||||
set(FLAVOUR x10)
|
set(FLAVOUR x10)
|
||||||
|
|||||||
@@ -707,15 +707,27 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// I2C Bus
|
// I2C Bus
|
||||||
#define I2C_RCC_AHB1Periph RCC_AHB1Periph_GPIOB
|
#if defined(RADIO_T18)
|
||||||
#define I2C_RCC_APB1Periph RCC_APB1Periph_I2C1
|
#define I2C_RCC_AHB1Periph RCC_AHB1Periph_GPIOH
|
||||||
#define I2C I2C1
|
#define I2C_RCC_APB1Periph RCC_APB1Periph_I2C3
|
||||||
#define I2C_GPIO GPIOB
|
#define I2C I2C3
|
||||||
#define I2C_SCL_GPIO_PIN GPIO_Pin_8 // PB.08
|
#define I2C_GPIO GPIOH
|
||||||
#define I2C_SDA_GPIO_PIN GPIO_Pin_9 // PB.09
|
#define I2C_SCL_GPIO_PIN GPIO_Pin_7 // PH.07
|
||||||
#define I2C_GPIO_AF GPIO_AF_I2C1
|
#define I2C_SDA_GPIO_PIN GPIO_Pin_8 // PH.08
|
||||||
#define I2C_SCL_GPIO_PinSource GPIO_PinSource8
|
#define I2C_GPIO_AF GPIO_AF_I2C3
|
||||||
#define I2C_SDA_GPIO_PinSource GPIO_PinSource9
|
#define I2C_SCL_GPIO_PinSource GPIO_PinSource7
|
||||||
|
#define I2C_SDA_GPIO_PinSource GPIO_PinSource8
|
||||||
|
#else
|
||||||
|
#define I2C_RCC_AHB1Periph RCC_AHB1Periph_GPIOB
|
||||||
|
#define I2C_RCC_APB1Periph RCC_APB1Periph_I2C1
|
||||||
|
#define I2C I2C1
|
||||||
|
#define I2C_GPIO GPIOB
|
||||||
|
#define I2C_SCL_GPIO_PIN GPIO_Pin_8 // PB.08
|
||||||
|
#define I2C_SDA_GPIO_PIN GPIO_Pin_9 // PB.09
|
||||||
|
#define I2C_GPIO_AF GPIO_AF_I2C1
|
||||||
|
#define I2C_SCL_GPIO_PinSource GPIO_PinSource8
|
||||||
|
#define I2C_SDA_GPIO_PinSource GPIO_PinSource9
|
||||||
|
#endif
|
||||||
#define I2C_SPEED 400000
|
#define I2C_SPEED 400000
|
||||||
|
|
||||||
// Haptic
|
// Haptic
|
||||||
|
|||||||
@@ -22,6 +22,196 @@
|
|||||||
#include "tp_gt911.h"
|
#include "tp_gt911.h"
|
||||||
#include "touch.h"
|
#include "touch.h"
|
||||||
|
|
||||||
|
#if defined (RADIO_T18)
|
||||||
|
const uint8_t TOUCH_GT911_Cfg[] = {
|
||||||
|
GT911_CFG_NUMER, // 0x8047 Config version
|
||||||
|
0xE0, // 0x8048 X output map : x 480
|
||||||
|
0x01,
|
||||||
|
0x10, // 0x804A Y ouptut max : y 272
|
||||||
|
0x01,
|
||||||
|
GT911_MAX_TP, // 0x804C Touch number
|
||||||
|
0x0C, // 0x804D Module switch 1 : bit4= xy change Int mode
|
||||||
|
0x00, // 0x804E Module switch 2
|
||||||
|
0x01, // 0x804F Shake_Count
|
||||||
|
0x18, // 0x8050 Filter
|
||||||
|
0x28, // 0x8051 Larger touch
|
||||||
|
0x0F, // 0x8052 Noise reduction
|
||||||
|
0x50, // 0x8053 Screen touch level
|
||||||
|
0x3C, // 0x8054 Screen touch leave
|
||||||
|
0x03, // 0x8055 Low power control
|
||||||
|
0x05, // 0x8056 Refresh rate
|
||||||
|
0x00, // 0x8057 X threshold
|
||||||
|
0x00, // 0x8058 Y threshold
|
||||||
|
0x00, // 0x8059 Reserved
|
||||||
|
0x00, // 0x805A Reserved
|
||||||
|
0x00, // 0x805B Space (top, bottom)
|
||||||
|
0x00, // 0x805C Space (left, right)
|
||||||
|
0x04, // 0x805D Mini filter
|
||||||
|
0x18, // 0x805E Strech R0
|
||||||
|
0x1A, // 0x805F Strech R1
|
||||||
|
0x1E, // 0x8060 Strech R2
|
||||||
|
0x14, // 0x8061 Strech RM
|
||||||
|
0x87, // 0x8062 Drv groupA num
|
||||||
|
0x29, // 0x8063 Drv groupB num
|
||||||
|
0x0A, // 0x8064 Sensor num
|
||||||
|
0x4B, // 0x8065 FreqA factor
|
||||||
|
0x4D, // 0x8066 FreqB factor
|
||||||
|
0xD3, // 0x8067 Panel bit freq
|
||||||
|
0x07,
|
||||||
|
0x00, // 0x8069 Reserved
|
||||||
|
0x00,
|
||||||
|
0x00, // 0x806B Panel tx gain
|
||||||
|
0x19, // 0x806C Panel rx gain
|
||||||
|
0x02, // 0x806D Panel dump shift
|
||||||
|
0x10, // 0x806E Drv frame control
|
||||||
|
0x32, // 0x806F Charging level up
|
||||||
|
0x00, // 0x8070 Module switch 3
|
||||||
|
0x00, // 0x8071 Gesture distance
|
||||||
|
0x00, // 0x8072 Gesture long press time
|
||||||
|
0x00, // 0x8073 X/Y slope adjust
|
||||||
|
0x03, // 0x8074 Gesture control
|
||||||
|
0x00, // 0x8075 Gesture switch 1
|
||||||
|
0x00, // 0x8076 Gesture switch 2
|
||||||
|
0x00, // 0x8077 Gesture refresh rate
|
||||||
|
0x00, // 0x8078 Gesture touch level
|
||||||
|
0x00, // 0x8079 New green wake up level
|
||||||
|
0x32, // 0x807A Freq hopping start
|
||||||
|
0x73, // 0x807B Freq hopping end
|
||||||
|
0x94, // 0x807C Noise detect time
|
||||||
|
0xD5, // 0x807D Hopping flag
|
||||||
|
0x02, // 0x807E Hopping flag
|
||||||
|
0x07, // 0x807F Noise threshold
|
||||||
|
0x00, // 0x8080 Nois min threshold old
|
||||||
|
0x00, // 0x8081 Reserved
|
||||||
|
0x04, // 0x8082 Hopping sensor group
|
||||||
|
0xAE, // 0x8083 Hopping Seg1 normalize
|
||||||
|
0x36, // 0x8084 Hopping Seg1 factor
|
||||||
|
0x00, // 0x8085 Main clock adjust
|
||||||
|
0x94, // 0x8086 Hopping Seg2 normalize
|
||||||
|
0x40, // 0x8087 Hopping Seg2 factor
|
||||||
|
0x00, // 0x8088 Reserved
|
||||||
|
0x7E, // 0x8089 Hopping Seg3 normalize
|
||||||
|
0x4C, // 0x808A Hopping Seg3 factor
|
||||||
|
0x00, // 0x808B Reserved
|
||||||
|
0x6D, // 0x808C Hopping Seg4 normalize
|
||||||
|
0x59, // 0x808D Hopping Seg4 factor
|
||||||
|
0x00, // 0x808E Reserved
|
||||||
|
0x5D, // 0x808F Hopping Seg5 normalize
|
||||||
|
0x6A, // 0x8090 Hopping Seg5 factor
|
||||||
|
0x00, // 0x8091 Reserved
|
||||||
|
0x5D, // 0x8092 Hopping Seg6 normalize
|
||||||
|
0x00, // 0x8093 Key1
|
||||||
|
0x00, // 0x8094 Key2
|
||||||
|
0x00, // 0x8095 Key3
|
||||||
|
0x00, // 0x8096 Key4
|
||||||
|
0x00, // 0x8097 Key area
|
||||||
|
0x00, // 0x8098 Key touch level
|
||||||
|
0x00, // 0x8099 Key leave level
|
||||||
|
0x00, // 0x809A Key sens
|
||||||
|
0x00, // 0x809B Key sens
|
||||||
|
0x00, // 0x809C Key restrain
|
||||||
|
0x00, // 0x809D Key restrain time
|
||||||
|
0x00, // 0x809E Large gesture touch
|
||||||
|
0x00, // 0x809F Reserved
|
||||||
|
0x00, // 0x80A0 Reserved
|
||||||
|
0x00, // 0x80A1 Hotknot noise map
|
||||||
|
0x00, // 0x80A2 Link threshold
|
||||||
|
0x00, // 0x80A3 Pxy threshold
|
||||||
|
0x00, // 0x80A4 GHot dump shift
|
||||||
|
0x00, // 0x80A5 GHot rx gain
|
||||||
|
0x00, // 0x80A6 Freg gain
|
||||||
|
0x00, // 0x80A7 Freg gain 1
|
||||||
|
0x00, // 0x80A8 Freg gain 2
|
||||||
|
0x00, // 0x80A9 Freg gain 3
|
||||||
|
0x00, // 0x80AA Reserved
|
||||||
|
0x00, // 0x80AB Reserved
|
||||||
|
0x00, // 0x80AC Reserved
|
||||||
|
0x00, // 0x80AD Reserved
|
||||||
|
0x00, // 0x80AE Reserved
|
||||||
|
0x00, // 0x80AF Reserved
|
||||||
|
0x00, // 0x80B0 Reserved
|
||||||
|
0x00, // 0x80B1 Reserved
|
||||||
|
0x00, // 0x80B2 Reserved
|
||||||
|
0x00, // 0x80B3 Combine dis
|
||||||
|
0x00, // 0x80B4 Split set
|
||||||
|
0x00, // 0x80B5 Reserved
|
||||||
|
0x00, // 0x80B6 Reserved
|
||||||
|
0x0A, // 0x80B7 Sensor CH0
|
||||||
|
0x0C, // 0x80B8 Sensor CH1
|
||||||
|
0x0E, // 0x80B9 Sensor CH2
|
||||||
|
0x10, // 0x80BA Sensor CH3
|
||||||
|
0x12, // 0x80BB Sensor CH4
|
||||||
|
0x14, // 0x80BC Sensor CH5
|
||||||
|
0x16, // 0x80BD Sensor CH6
|
||||||
|
0x18, // 0x80BE Sensor CH7
|
||||||
|
0x1A, // 0x80BF Sensor CH8
|
||||||
|
0x1C, // 0x80C0 Sensor CH9
|
||||||
|
0xFF, // 0x80C1 Sensor CH10
|
||||||
|
0xFF, // 0x80C2 Sensor CH11
|
||||||
|
0xFF, // 0x80C3 Sensor CH12
|
||||||
|
0xFF, // 0x80C4 Sensor CH13
|
||||||
|
0xFF, // 0x80C5 Reserved
|
||||||
|
0xFF, // 0x80C6 Reserved
|
||||||
|
0xFF, // 0x80C7 Reserved
|
||||||
|
0xFF, // 0x80C8 Reserved
|
||||||
|
0xFF, // 0x80C9 Reserved
|
||||||
|
0xFF, // 0x80CA Reserved
|
||||||
|
0xFF, // 0x80CB Reserved
|
||||||
|
0xFF, // 0x80CC Reserved
|
||||||
|
0xFF, // 0x80CD Reserved
|
||||||
|
0xFF, // 0x80CE Reserved
|
||||||
|
0xFF, // 0x80CF Reserved
|
||||||
|
0xFF, // 0x80D0 Reserved
|
||||||
|
0xFF, // 0x80D1 Reserved
|
||||||
|
0xFF, // 0x80D2 Reserved
|
||||||
|
0xFF, // 0x80D3 Reserved
|
||||||
|
0xFF, // 0x80D4 Reserved
|
||||||
|
0x00, // 0x80D5 Driver CH0
|
||||||
|
0x02, // 0x80D6 Driver CH1
|
||||||
|
0x04, // 0x80D7 Driver CH2
|
||||||
|
0x06, // 0x80D8 Driver CH3
|
||||||
|
0x08, // 0x80D9 Driver CH4
|
||||||
|
0x0A, // 0x80DA Driver CH5
|
||||||
|
0x0C, // 0x80DB Driver CH6
|
||||||
|
0x1D, // 0x80DC Driver CH7
|
||||||
|
0x1E, // 0x80DD Driver CH8
|
||||||
|
0x1F, // 0x80DE Driver CH9
|
||||||
|
0x20, // 0x80DF Driver CH10
|
||||||
|
0x21, // 0x80E0 Driver CH11
|
||||||
|
0x22, // 0x80E1 Driver CH12
|
||||||
|
0x24, // 0x80E2 Driver CH13
|
||||||
|
0x26, // 0x80E3 Driver CH14
|
||||||
|
0x28, // 0x80E4 Driver CH15
|
||||||
|
0xFF, // 0x80E5 Driver CH16
|
||||||
|
0xFF, // 0x80E6 Driver CH17
|
||||||
|
0xFF, // 0x80E7 Driver CH18
|
||||||
|
0xFF, // 0x80E8 Driver CH19
|
||||||
|
0xFF, // 0x80E9 Driver CH20
|
||||||
|
0xFF, // 0x80EA Driver CH21
|
||||||
|
0xFF, // 0x80EB Driver CH22
|
||||||
|
0xFF, // 0x80EC Driver CH23
|
||||||
|
0xFF, // 0x80ED Driver CH24
|
||||||
|
0xFF, // 0x80EE Driver CH25
|
||||||
|
0xFF, // 0x80EF Reserved
|
||||||
|
0xFF, // 0x80F0 Reserved
|
||||||
|
0xFF, // 0x80F1 Reserved
|
||||||
|
0xFF, // 0x80F2 Reserved
|
||||||
|
0xFF, // 0x80F3 Reserved
|
||||||
|
0xFF, // 0x80F4 Reserved
|
||||||
|
0xFF, // 0x80F5 Reserved
|
||||||
|
0xFF, // 0x80F6 Reserved
|
||||||
|
0xFF, // 0x80F7 Reserved
|
||||||
|
0xFF, // 0x80F8 Reserved
|
||||||
|
0xFF, // 0x80F9 Reserved
|
||||||
|
0xFF, // 0x80FA Reserved
|
||||||
|
0xFF, // 0x80FB Reserved
|
||||||
|
0xFF, // 0x80FC Reserved
|
||||||
|
0xFF, // 0x80FD Reserved
|
||||||
|
0xFF // 0x80FE Reserved
|
||||||
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
//GT911 param table
|
//GT911 param table
|
||||||
const uint8_t TOUCH_GT911_Cfg[] =
|
const uint8_t TOUCH_GT911_Cfg[] =
|
||||||
{
|
{
|
||||||
@@ -211,6 +401,8 @@ const uint8_t TOUCH_GT911_Cfg[] =
|
|||||||
0x00 // 0x80FE Reserved
|
0x00 // 0x80FE Reserved
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t touchGT911Flag = 0;
|
uint8_t touchGT911Flag = 0;
|
||||||
uint8_t touchEventOccured = 0;
|
uint8_t touchEventOccured = 0;
|
||||||
struct TouchData touchData;
|
struct TouchData touchData;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ void touchPanelRead();
|
|||||||
bool touchPanelEventOccured();
|
bool touchPanelEventOccured();
|
||||||
|
|
||||||
#define GT911_MAX_TP 5
|
#define GT911_MAX_TP 5
|
||||||
#define GT911_CFG_NUMER 0x6A
|
#define GT911_CFG_NUMER 0x6C
|
||||||
|
|
||||||
//I2C
|
//I2C
|
||||||
#define GT_CMD_WR 0X28
|
#define GT_CMD_WR 0X28
|
||||||
|
|||||||
@@ -100,6 +100,9 @@ case $FLAVOR in
|
|||||||
XLITES)
|
XLITES)
|
||||||
BUILD_OPTIONS+="-DPCB=XLITES"
|
BUILD_OPTIONS+="-DPCB=XLITES"
|
||||||
;;
|
;;
|
||||||
|
X9D)
|
||||||
|
BUILD_OPTIONS+="-DPCB=X9D"
|
||||||
|
;;
|
||||||
X9DP)
|
X9DP)
|
||||||
BUILD_OPTIONS+="-DPCB=X9D+"
|
BUILD_OPTIONS+="-DPCB=X9D+"
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in New Issue
Block a user