Added repeat setting for AFSK TX, fixed LCR scan, cleaned up LCR

Added max setting for progressbars, default = 100
This commit is contained in:
furrtek
2016-07-28 00:08:05 +02:00
parent e958b4bd7d
commit 1beac3bdbd
12 changed files with 169 additions and 165 deletions

View File

@@ -139,6 +139,10 @@ uint32_t afsk_config() {
return data->afsk_config;
}
uint8_t afsk_repeats() {
return (data->afsk_config >> 8);
}
void set_afsk_config(const uint32_t new_value) {
data->afsk_config = new_value;
}

View File

@@ -47,6 +47,7 @@ int32_t afsk_bitrate();
void set_afsk_bitrate(const int32_t new_value);
uint32_t afsk_config();
uint8_t afsk_repeats();
void set_afsk_config(const uint32_t new_value);
int32_t afsk_bw();

View File

@@ -395,9 +395,15 @@ ProgressBar::ProgressBar(
{
}
void ProgressBar::set_max(const uint16_t max) {
_value = 0;
_max = max;
set_dirty();
}
void ProgressBar::set_value(const uint16_t value) {
if (value > 100)
_value = 100;
if (value > _max)
_value = _max;
else
_value = value;
set_dirty();
@@ -409,7 +415,7 @@ void ProgressBar::paint(Painter& painter) {
const auto rect = screen_rect();
const auto s = style();
v_sized = (rect.size.w * _value) / 100;
v_sized = (rect.size.w * _value) / _max;
painter.fill_rectangle({rect.pos, {v_sized, rect.size.h}}, style().foreground);
painter.fill_rectangle({{rect.pos.x + v_sized, rect.pos.y}, {rect.size.w - v_sized, rect.size.h}}, s.background);

View File

@@ -215,12 +215,14 @@ class ProgressBar : public Widget {
public:
ProgressBar(Rect parent_rect);
void set_max(const uint16_t max);
void set_value(const uint16_t value);
void paint(Painter& painter) override;
private:
uint16_t _value = 0;
uint16_t _max = 100;
};
class Checkbox : public Widget {
@@ -229,6 +231,11 @@ public:
Checkbox(Point parent_pos, size_t length, std::string text);
Checkbox(
) : Checkbox { { }, { }, { } }
{
}
void set_text(const std::string value);
std::string text() const;
void set_value(const bool value);