chore(color): LVGLify spectrum analyser footer (#3077)
* LVGL flex conversion for spectrum analyser footer. Fix header title display for spectrum analyser. * fix: `DEF` touch keyboard wasn't using freqDefault
This commit is contained in:
@@ -28,6 +28,11 @@
|
|||||||
constexpr coord_t SPECTRUM_HEIGHT = 180;
|
constexpr coord_t SPECTRUM_HEIGHT = 180;
|
||||||
constexpr coord_t SCALE_HEIGHT = 20;
|
constexpr coord_t SCALE_HEIGHT = 20;
|
||||||
|
|
||||||
|
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_FR(1),
|
||||||
|
LV_GRID_TEMPLATE_LAST};
|
||||||
|
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT,
|
||||||
|
LV_GRID_TEMPLATE_LAST};
|
||||||
|
|
||||||
coord_t getAverage(uint8_t number, const uint8_t * value)
|
coord_t getAverage(uint8_t number, const uint8_t * value)
|
||||||
{
|
{
|
||||||
uint16_t sum = 0;
|
uint16_t sum = 0;
|
||||||
@@ -37,40 +42,36 @@ coord_t getAverage(uint8_t number, const uint8_t * value)
|
|||||||
return sum / number;
|
return sum / number;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SpectrumFooterWindow: public FormGroup
|
class SpectrumFooterWindow: public FormWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SpectrumFooterWindow(FormGroup * parent, const rect_t & rect, int moduleIdx) :
|
SpectrumFooterWindow(FormGroup * parent, const rect_t & rect, int moduleIdx) :
|
||||||
FormGroup(parent, rect// , FORM_FORWARD_FOCUS
|
FormWindow(parent, rect)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
FormGridLayout grid;
|
setFlexLayout();
|
||||||
grid.spacer(4);
|
padAll(0);
|
||||||
grid.setLabelWidth(5);
|
padLeft(4);
|
||||||
|
padRight(4);
|
||||||
|
|
||||||
// Tracker
|
FlexGridLayout grid(col_dsc, row_dsc, 4);
|
||||||
auto tracker = new NumberEdit(this, grid.getFieldSlot(3, 2), (reusableBuffer.spectrumAnalyser.freq - reusableBuffer.spectrumAnalyser.span / 2) / 1000000,
|
|
||||||
(reusableBuffer.spectrumAnalyser.freq + reusableBuffer.spectrumAnalyser.span / 2) / 1000000,
|
auto line = newLine(&grid);
|
||||||
GET_DEFAULT(reusableBuffer.spectrumAnalyser.track / 1000000),
|
line->padAll(1);
|
||||||
SET_VALUE(reusableBuffer.spectrumAnalyser.track, newValue * 1000000));
|
|
||||||
tracker->setSuffix("MHz");
|
|
||||||
tracker->setPrefix("T: ");
|
|
||||||
// tracker->setFocus(SET_FOCUS_DEFAULT);
|
|
||||||
|
|
||||||
if (isModuleMultimodule(moduleIdx)) {
|
if (isModuleMultimodule(moduleIdx)) {
|
||||||
char label[16];
|
char label[16];
|
||||||
|
|
||||||
// Frequency
|
// Frequency
|
||||||
sprintf(label,"T: %dMHz", int(reusableBuffer.spectrumAnalyser.freq / 1000000));
|
sprintf(label,"T: %dMHz", int(reusableBuffer.spectrumAnalyser.freq / 1000000));
|
||||||
new StaticText(this, grid.getFieldSlot(3, 0), label);
|
new StaticText(line, rect_t{0, 0, lv_pct(30), LV_GRID_CONTENT}, label);
|
||||||
|
|
||||||
// Span
|
// Span
|
||||||
sprintf(label,"S: %dMHz", int(reusableBuffer.spectrumAnalyser.span / 1000000));
|
sprintf(label,"S: %dMHz", int(reusableBuffer.spectrumAnalyser.span / 1000000));
|
||||||
new StaticText(this, grid.getFieldSlot(3, 1), label);
|
new StaticText(line, rect_t{0, 0, lv_pct(30), LV_GRID_CONTENT}, label);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Frequency
|
// Frequency
|
||||||
auto freq = new NumberEdit(this, grid.getFieldSlot(3, 0), reusableBuffer.spectrumAnalyser.freqMin,
|
auto freq = new NumberEdit(line, rect_t{0, 0, lv_pct(30), LV_GRID_CONTENT}, reusableBuffer.spectrumAnalyser.freqMin,
|
||||||
reusableBuffer.spectrumAnalyser.freqMax,
|
reusableBuffer.spectrumAnalyser.freqMax,
|
||||||
GET_DEFAULT(reusableBuffer.spectrumAnalyser.freq / 1000000),
|
GET_DEFAULT(reusableBuffer.spectrumAnalyser.freq / 1000000),
|
||||||
SET_VALUE(reusableBuffer.spectrumAnalyser.freq, newValue * 1000000));
|
SET_VALUE(reusableBuffer.spectrumAnalyser.freq, newValue * 1000000));
|
||||||
@@ -78,12 +79,21 @@ class SpectrumFooterWindow: public FormGroup
|
|||||||
freq->setPrefix("F: ");
|
freq->setPrefix("F: ");
|
||||||
|
|
||||||
// Span
|
// Span
|
||||||
auto span = new NumberEdit(this, grid.getFieldSlot(3, 1), 1, reusableBuffer.spectrumAnalyser.spanMax,
|
auto span = new NumberEdit(line, rect_t{0, 0, lv_pct(30), LV_GRID_CONTENT}, 1, reusableBuffer.spectrumAnalyser.spanMax,
|
||||||
GET_DEFAULT(reusableBuffer.spectrumAnalyser.span / 1000000),
|
GET_DEFAULT(reusableBuffer.spectrumAnalyser.span / 1000000),
|
||||||
SET_VALUE(reusableBuffer.spectrumAnalyser.span, newValue * 1000000));
|
SET_VALUE(reusableBuffer.spectrumAnalyser.span, newValue * 1000000));
|
||||||
span->setSuffix("MHz");
|
span->setSuffix("MHz");
|
||||||
span->setPrefix("S: ");
|
span->setPrefix("S: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tracker
|
||||||
|
auto tracker = new NumberEdit(line, rect_t{0, 0, lv_pct(30), LV_GRID_CONTENT}, (reusableBuffer.spectrumAnalyser.freq - reusableBuffer.spectrumAnalyser.span / 2) / 1000000,
|
||||||
|
(reusableBuffer.spectrumAnalyser.freq + reusableBuffer.spectrumAnalyser.span / 2) / 1000000,
|
||||||
|
GET_DEFAULT(reusableBuffer.spectrumAnalyser.track / 1000000),
|
||||||
|
SET_VALUE(reusableBuffer.spectrumAnalyser.track, newValue * 1000000));
|
||||||
|
tracker->setSuffix("MHz");
|
||||||
|
tracker->setPrefix("T: ");
|
||||||
|
tracker->setDefault(reusableBuffer.spectrumAnalyser.freqDefault);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -211,8 +221,8 @@ RadioSpectrumAnalyser::RadioSpectrumAnalyser(uint8_t moduleIdx) :
|
|||||||
|
|
||||||
void RadioSpectrumAnalyser::buildHeader(Window * window)
|
void RadioSpectrumAnalyser::buildHeader(Window * window)
|
||||||
{
|
{
|
||||||
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + 10, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENU_SPECTRUM_ANALYSER, 0, COLOR_THEME_SECONDARY1);
|
header.setTitle(STR_MENU_SPECTRUM_ANALYSER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioSpectrumAnalyser::buildBody(FormWindow * window)
|
void RadioSpectrumAnalyser::buildBody(FormWindow * window)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user