mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-10 08:39:29 +00:00
RDS radiotext transmit (group 2A)
Keyboard/Unistroke text input method selection
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
const char md5_baseband[16] = {0xb8,0x9e,0x9b,0x08,0x44,0x34,0x04,0x20,0x0b,0xbc,0x60,0x7e,0x67,0x88,0x53,0xf7,};
|
||||
const char md5_baseband_tx[16] = {0xf2,0x82,0xb2,0x1e,0xc7,0xaa,0x15,0x73,0x02,0x74,0xbf,0x51,0xbe,0x6c,0xca,0xd0,};
|
||||
const char md5_baseband_tx[16] = {0x76,0x21,0x56,0xb0,0x12,0x45,0xdd,0x66,0x87,0xee,0x8a,0x97,0xda,0xee,0xc5,0xac,};
|
||||
|
||||
@@ -72,7 +72,7 @@ struct data_t {
|
||||
uint32_t playing_dead;
|
||||
uint32_t playdead_sequence;
|
||||
|
||||
int32_t ui_config;
|
||||
uint32_t ui_config;
|
||||
};
|
||||
|
||||
static_assert(sizeof(data_t) <= backup_ram.size(), "Persistent memory structure too large for VBAT-maintained region");
|
||||
@@ -164,7 +164,7 @@ uint32_t ui_config() {
|
||||
|
||||
// Cap value
|
||||
bloff_value = (data->ui_config >> 5) & 7;
|
||||
if (bloff_value > 4) bloff_value = 1;
|
||||
if (bloff_value > 4) bloff_value = 1; // 15s default
|
||||
|
||||
data->ui_config = (data->ui_config & 0x1F) | (bloff_value << 5);
|
||||
|
||||
@@ -184,6 +184,14 @@ uint16_t ui_config_bloff() {
|
||||
return bloff_seconds[bloff_value];
|
||||
}
|
||||
|
||||
void set_config_textentry(uint8_t new_value) {
|
||||
data->ui_config = (data->ui_config & ~0b1100) | ((new_value & 1) << 2);
|
||||
}
|
||||
|
||||
uint8_t ui_config_textentry() {
|
||||
return ((data->ui_config >> 2) & 1);
|
||||
}
|
||||
|
||||
void set_ui_config(const uint32_t new_value) {
|
||||
data->ui_config = new_value;
|
||||
}
|
||||
|
||||
@@ -60,8 +60,12 @@ void set_playdead_sequence(const uint32_t new_value);
|
||||
|
||||
uint32_t ui_config();
|
||||
void set_ui_config(const uint32_t new_value);
|
||||
|
||||
uint16_t ui_config_bloff();
|
||||
|
||||
uint8_t ui_config_textentry();
|
||||
void set_config_textentry(uint8_t new_value);
|
||||
|
||||
} /* namespace persistent_memory */
|
||||
} /* namespace portapack */
|
||||
|
||||
|
||||
@@ -53,10 +53,10 @@ struct SharedMemory {
|
||||
TouchADCFrame touch_adc_frame;
|
||||
|
||||
int test;
|
||||
|
||||
uint8_t radio_data[256];
|
||||
size_t bit_length;
|
||||
|
||||
uint32_t rdsdata[16];
|
||||
|
||||
uint8_t lcrdata[256];
|
||||
uint32_t afsk_samples_per_bit;
|
||||
uint32_t afsk_phase_inc_mark;
|
||||
uint32_t afsk_phase_inc_space;
|
||||
@@ -69,6 +69,7 @@ struct SharedMemory {
|
||||
char xylosdata[21];
|
||||
char epardata[13];
|
||||
int32_t excursion;
|
||||
|
||||
bool transmit_done;
|
||||
};
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ Style Style::invert() const {
|
||||
return {
|
||||
.font = font,
|
||||
.background = foreground,
|
||||
.foreground = background,
|
||||
.foreground = background
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@ public:
|
||||
private:
|
||||
void draw_hline(Point p, int width, const Color c);
|
||||
void draw_vline(Point p, int height, const Color c);
|
||||
|
||||
void paint_widget(Widget* const w);
|
||||
};
|
||||
|
||||
|
||||
@@ -538,23 +538,19 @@ void Button::paint(Painter& painter) {
|
||||
|
||||
const auto paint_style = (has_focus() || highlighted()) ? style().invert() : style();
|
||||
|
||||
painter.draw_rectangle(r, style().foreground);
|
||||
painter.draw_rectangle(r, paint_style.foreground);
|
||||
|
||||
painter.fill_rectangle(
|
||||
{ r.pos.x + 1, r.pos.y + 1, r.size.w - 2, r.size.h - 2 },
|
||||
paint_style.background
|
||||
);
|
||||
|
||||
//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, " ");
|
||||
//}
|
||||
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_
|
||||
);
|
||||
}
|
||||
|
||||
bool Button::on_key(const KeyEvent key) {
|
||||
@@ -735,10 +731,10 @@ size_t ImageOptionsField::selected_index_value() const {
|
||||
}
|
||||
|
||||
void ImageOptionsField::set_selected_index(const size_t new_index) {
|
||||
if( new_index < options.size() ) {
|
||||
if( new_index != selected_index() ) {
|
||||
if ( new_index < options.size() ) {
|
||||
if ( new_index != selected_index() ) {
|
||||
selected_index_ = new_index;
|
||||
if( on_change ) {
|
||||
if ( on_change ) {
|
||||
on_change(selected_index(), options[selected_index()].second);
|
||||
}
|
||||
set_dirty();
|
||||
@@ -768,7 +764,7 @@ void ImageOptionsField::paint(Painter& painter) {
|
||||
|
||||
if( selected_index() < options.size() ) {
|
||||
const auto bmp_ptr = options[selected_index()].first;
|
||||
portapack::display.fill_rectangle({screen_rect().pos, {screen_rect().size.w + 4, screen_rect().size.h + 4}}, ui::Color::black());
|
||||
painter.fill_rectangle({screen_rect().pos, {screen_rect().size.w + 4, screen_rect().size.h + 4}}, ui::Color::black());
|
||||
painter.draw_rectangle({screen_rect().pos, {screen_rect().size.w + 4, screen_rect().size.h + 4}}, paint_style.background);
|
||||
portapack::display.drawBMP({screen_pos().x + 2, screen_pos().y + 1}, bmp_ptr, true);
|
||||
}
|
||||
@@ -844,7 +840,9 @@ void OptionsField::set_options(options_t new_options) {
|
||||
|
||||
void OptionsField::paint(Painter& painter) {
|
||||
const auto paint_style = has_focus() ? style().invert() : style();
|
||||
|
||||
|
||||
painter.fill_rectangle({screen_rect().pos, {length_ * 8, 16}}, ui::Color::black());
|
||||
|
||||
if( selected_index() < options.size() ) {
|
||||
const auto text = options[selected_index()].first;
|
||||
painter.draw_string(
|
||||
|
||||
Reference in New Issue
Block a user