Skip to content

Commit

Permalink
feat(color): Add layout 4+2B right side 3QRT+1QRT (#3315)
Browse files Browse the repository at this point in the history
* Add layout 4+2B right side 3QRT+1QRT

* Fix Layout 4+2B LayoutId, length max 9 char

* Maybe this will work?

---------

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
  • Loading branch information
daniel-snowsurf and pfeerick authored Apr 10, 2023
1 parent 227780d commit f935ce8
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 12 deletions.
1 change: 1 addition & 0 deletions companion/src/companion.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -1288,5 +1288,6 @@
<file alias="mask_layout2x3.png">images/layouts/mask_layout2x3.png</file>
<file alias="mask_layout2x4.png">images/layouts/mask_layout2x4.png</file>
<file alias="mask_layout4p2.png">images/layouts/mask_layout4+2.png</file>
<file alias="mask_layout4p2b.png">images/layouts/mask_layout4+2b.png</file>
</qresource>
</RCC>
2 changes: 1 addition & 1 deletion companion/src/firmwares/customisation_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ constexpr int WIDGET_NAME_LEN {10};
constexpr int MAX_WIDGET_OPTIONS {5};
constexpr int MAX_TOPBAR_ZONES {4};
constexpr int MAX_TOPBAR_OPTIONS {1};
constexpr int LAYOUT_ID_LEN {10};
constexpr int LAYOUT_ID_LEN {12};

// Common 'ZoneOptionValue's among all layouts
enum {
Expand Down
Binary file added companion/src/images/layouts/mask_layout4+2b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions radio/src/datastructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static inline void check_struct()
CHKSIZE(SwashRingData, 8);
CHKSIZE(ModelHeader, 131);
CHKSIZE(CurveHeader, 4);
CHKSIZE(CustomScreenData, 850);
CHKSIZE(CustomScreenData, 852);
CHKTYPE(TopBarPersistentData, 300);
#elif defined(PCBNV14)
// TODO
Expand Down Expand Up @@ -140,14 +140,14 @@ static inline void check_struct()
#elif defined(PCBHORUS)
#if defined(PCBX10)
CHKSIZE(RadioData, 950);
CHKSIZE(ModelData, 15431);
CHKSIZE(ModelData, 15451);
#else
CHKSIZE(RadioData, 932);
CHKSIZE(ModelData, 15429);
CHKSIZE(ModelData, 15449);
#endif
#elif defined(PCBNV14)
CHKSIZE(RadioData, 878);
CHKSIZE(ModelData, 15245);
CHKSIZE(ModelData, 15265);
#endif

#undef CHKSIZE
Expand Down
2 changes: 1 addition & 1 deletion radio/src/datastructs_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ typedef uint32_t swarnstate_t;
#elif defined(COLORLCD)
#include "gui/colorlcd/layout.h"
#include "gui/colorlcd/topbar.h"
#define LAYOUT_ID_LEN 10
#define LAYOUT_ID_LEN 12
PACK(struct CustomScreenData {
char LayoutId[LAYOUT_ID_LEN];
LayoutPersistentData layoutData;
Expand Down
36 changes: 36 additions & 0 deletions radio/src/gui/colorlcd/layouts/layout4+2b.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* 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 "layout.h"
#include "layout_factory_impl.h"

static uint8_t zmap[] = {
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
LAYOUT_MAP_0, LAYOUT_MAP_1QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
LAYOUT_MAP_0, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
LAYOUT_MAP_HALF, LAYOUT_MAP_0, LAYOUT_MAP_HALF, LAYOUT_MAP_3QTR,
LAYOUT_MAP_HALF, LAYOUT_MAP_3QTR, LAYOUT_MAP_HALF, LAYOUT_MAP_1QTR,
};

BaseLayoutFactory<Layout> layout4P2B("Layout4P2B", "4 + 2B",
defaultZoneOptions,
6, zmap);
4 changes: 2 additions & 2 deletions radio/src/storage/yaml/yaml_datastructs_nv14.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ static const struct YamlNode struct_LayoutPersistentData[] = {
};
static const struct YamlNode struct_CustomScreenData[] = {
YAML_IDX,
YAML_STRING("LayoutId", 10),
YAML_STRING("LayoutId", 12),
YAML_STRUCT("layoutData", 6720, struct_LayoutPersistentData, NULL),
YAML_END
};
Expand Down Expand Up @@ -914,7 +914,7 @@ static const struct YamlNode struct_ModelData[] = {
YAML_UNSIGNED( "potsWarnEnabled", 16 ),
YAML_ARRAY("potsWarnPosition", 8, 5, struct_signed_8, NULL),
YAML_ARRAY("telemetrySensors", 112, 60, struct_TelemetrySensor, NULL),
YAML_ARRAY("screenData", 6800, 10, struct_CustomScreenData, NULL),
YAML_ARRAY("screenData", 6816, 10, struct_CustomScreenData, NULL),
YAML_STRUCT("topbarData", 1248, struct_TopBarPersistentData, NULL),
YAML_UNSIGNED( "view", 8 ),
YAML_STRING("modelRegistrationID", 8),
Expand Down
4 changes: 2 additions & 2 deletions radio/src/storage/yaml/yaml_datastructs_x10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ static const struct YamlNode struct_LayoutPersistentData[] = {
};
static const struct YamlNode struct_CustomScreenData[] = {
YAML_IDX,
YAML_STRING("LayoutId", 10),
YAML_STRING("LayoutId", 12),
YAML_STRUCT("layoutData", 6720, struct_LayoutPersistentData, NULL),
YAML_END
};
Expand Down Expand Up @@ -945,7 +945,7 @@ static const struct YamlNode struct_ModelData[] = {
YAML_UNSIGNED( "potsWarnEnabled", 16 ),
YAML_ARRAY("potsWarnPosition", 8, 11, struct_signed_8, NULL),
YAML_ARRAY("telemetrySensors", 112, 60, struct_TelemetrySensor, NULL),
YAML_ARRAY("screenData", 6800, 10, struct_CustomScreenData, NULL),
YAML_ARRAY("screenData", 6816, 10, struct_CustomScreenData, NULL),
YAML_STRUCT("topbarData", 2400, struct_TopBarPersistentData, NULL),
YAML_UNSIGNED( "view", 8 ),
YAML_STRING("modelRegistrationID", 8),
Expand Down
4 changes: 2 additions & 2 deletions radio/src/storage/yaml/yaml_datastructs_x12s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ static const struct YamlNode struct_LayoutPersistentData[] = {
};
static const struct YamlNode struct_CustomScreenData[] = {
YAML_IDX,
YAML_STRING("LayoutId", 10),
YAML_STRING("LayoutId", 12),
YAML_STRUCT("layoutData", 6720, struct_LayoutPersistentData, NULL),
YAML_END
};
Expand Down Expand Up @@ -943,7 +943,7 @@ static const struct YamlNode struct_ModelData[] = {
YAML_UNSIGNED( "potsWarnEnabled", 16 ),
YAML_ARRAY("potsWarnPosition", 8, 9, struct_signed_8, NULL),
YAML_ARRAY("telemetrySensors", 112, 60, struct_TelemetrySensor, NULL),
YAML_ARRAY("screenData", 6800, 10, struct_CustomScreenData, NULL),
YAML_ARRAY("screenData", 6816, 10, struct_CustomScreenData, NULL),
YAML_STRUCT("topbarData", 2400, struct_TopBarPersistentData, NULL),
YAML_UNSIGNED( "view", 8 ),
YAML_STRING("modelRegistrationID", 8),
Expand Down

0 comments on commit f935ce8

Please sign in to comment.