mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-12-02 22:11:48 +00:00
Fixed LCR and Xylos transmitters
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
const char md5_baseband[16] = {0x37,0x04,0xf7,0x51,0x68,0x66,0x8a,0x20,0x73,0xa0,0xf7,0x69,0xa2,0xe2,0xb4,0x3a,};
|
||||
const char md5_baseband_tx[16] = {0x6c,0x1a,0x90,0x6b,0x68,0x78,0x6e,0xd2,0x08,0x3b,0x05,0xb1,0xbe,0x61,0xf8,0xe7,};
|
||||
const char md5_baseband[16] = {0xf2,0x01,0x2e,0xbf,0xc2,0xee,0x9f,0x0e,0x36,0x75,0x0e,0xb7,0x87,0x28,0x49,0xbd,};
|
||||
const char md5_baseband_tx[16] = {0xb1,0xe1,0xca,0x79,0x83,0x86,0x2f,0x20,0xba,0x94,0xd3,0x0c,0xc7,0x9d,0x43,0xe2,};
|
||||
|
||||
@@ -30,12 +30,18 @@ using Coord = int16_t;
|
||||
using Dim = int16_t;
|
||||
|
||||
struct Color {
|
||||
uint16_t v;
|
||||
uint16_t v; // rrrrrGGGGGGbbbbb
|
||||
|
||||
constexpr Color(
|
||||
) : v { 0 }
|
||||
{
|
||||
}
|
||||
|
||||
constexpr Color(
|
||||
uint16_t v
|
||||
) : v { v }
|
||||
{
|
||||
}
|
||||
|
||||
constexpr Color(
|
||||
uint8_t r,
|
||||
@@ -49,6 +55,10 @@ struct Color {
|
||||
)}
|
||||
{
|
||||
}
|
||||
|
||||
Color operator-() const {
|
||||
return (v ^ 0xffff);
|
||||
}
|
||||
|
||||
static constexpr Color black() {
|
||||
return { 0, 0, 0 };
|
||||
@@ -75,7 +85,7 @@ struct Color {
|
||||
}
|
||||
|
||||
static constexpr Color cyan() {
|
||||
return { 0, 128, 255 };
|
||||
return { 0, 255, 255 };
|
||||
}
|
||||
|
||||
static constexpr Color white() {
|
||||
|
||||
@@ -292,6 +292,36 @@ void Text::paint(Painter& painter) {
|
||||
);
|
||||
}
|
||||
|
||||
/* ProgressBar ***********************************************************/
|
||||
|
||||
ProgressBar::ProgressBar(
|
||||
Rect parent_rect
|
||||
) : Widget { parent_rect }
|
||||
{
|
||||
}
|
||||
|
||||
void ProgressBar::set_value(const uint16_t value) {
|
||||
if (value > 100)
|
||||
_value = 100;
|
||||
else
|
||||
_value = value;
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
void ProgressBar::paint(Painter& painter) {
|
||||
uint16_t v_sized;
|
||||
|
||||
const auto rect = screen_rect();
|
||||
const auto s = style();
|
||||
|
||||
v_sized = (rect.size.w * _value) / 100;
|
||||
|
||||
painter.fill_rectangle({rect.pos, {v_sized, rect.size.h}}, ui::Color::green());
|
||||
painter.fill_rectangle({{rect.pos.x + v_sized, rect.pos.y}, {rect.size.w - v_sized, rect.size.h}}, s.background);
|
||||
|
||||
painter.draw_rectangle(rect, s.foreground);
|
||||
}
|
||||
|
||||
/* Checkbox **************************************************************/
|
||||
|
||||
Checkbox::Checkbox(
|
||||
@@ -427,12 +457,16 @@ void Button::paint(Painter& painter) {
|
||||
paint_style.background
|
||||
);
|
||||
|
||||
const auto label_r = paint_style.font.size_of(text_);
|
||||
painter.draw_string(
|
||||
{ r.pos.x + (r.size.w - label_r.w) / 2, r.pos.y + (r.size.h - label_r.h) / 2 },
|
||||
paint_style,
|
||||
text_
|
||||
);
|
||||
//char *token = strtok(text_.c_str(), "\n");
|
||||
//while(token) {
|
||||
const auto label_r = paint_style.font.size_of(text_);
|
||||
painter.draw_string(
|
||||
{ r.pos.x + (r.size.w - label_r.w) / 2, r.pos.y + (r.size.h - label_r.h) / 2 },
|
||||
paint_style,
|
||||
text_
|
||||
);
|
||||
// token = strtok(NULL, " ");
|
||||
//}
|
||||
}
|
||||
|
||||
bool Button::on_key(const KeyEvent key) {
|
||||
|
||||
@@ -111,6 +111,8 @@ public:
|
||||
|
||||
bool highlighted() const;
|
||||
void set_highlighted(const bool value);
|
||||
|
||||
uint16_t id = 0;
|
||||
|
||||
protected:
|
||||
void dirty_overlapping_children_in_rect(const Rect& child_rect);
|
||||
@@ -195,6 +197,19 @@ private:
|
||||
std::string text;
|
||||
};
|
||||
|
||||
class ProgressBar : public Widget {
|
||||
public:
|
||||
ProgressBar(Rect parent_rect);
|
||||
|
||||
void set_value(const uint16_t value);
|
||||
uint16_t value() const;
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
private:
|
||||
uint16_t _value = 0;
|
||||
};
|
||||
|
||||
class Checkbox : public Widget {
|
||||
public:
|
||||
std::function<void(Checkbox&)> on_select;
|
||||
|
||||
Reference in New Issue
Block a user