Added waveform widget and a frequency field in encoders tx

This commit is contained in:
furrtek 2017-01-09 02:45:29 +00:00
parent be3d477352
commit a0c248d567
11 changed files with 180 additions and 72 deletions

View file

@ -24,6 +24,7 @@
#include "ui_widget.hpp"
#include "ui_navigation.hpp"
#include "ui_font_fixed_8x16.hpp"
#include "ui_receiver.hpp"
#include "encoders.hpp"
#include "message.hpp"
#include "transmitter_model.hpp"
@ -39,18 +40,18 @@ public:
void focus() override;
void on_show() override;
void paint(Painter& painter) override;
std::string title() const override { return "Encoders TX"; };
private:
void on_tuning_frequency_changed(rf::Frequency f);
enum tx_modes {
IDLE = 0,
SINGLE,
SCAN
};
Painter * painter_;
uint8_t enc_type = 0;
const encoder_def_t * encoder_def;
tx_modes tx_mode = IDLE;
@ -59,8 +60,8 @@ private:
//double scan_progress;
//unsigned int scan_index;
std::string debug_text = "0";
//rf::Frequency f;
uint8_t repeat_index;
int8_t waveform_buffer[512];
void draw_waveform();
void on_bitfield();
@ -92,75 +93,79 @@ private:
.foreground = Color::blue(),
};
FrequencyField field_frequency {
{ 1 * 8, 4 },
};
Text text_enctype {
{ 1 * 8, 24, 5 * 8, 16 },
{ 1 * 8, 32, 5 * 8, 16 },
"Type:"
};
OptionsField options_enctype { // Options are loaded at runtime
{ 6 * 8, 24 },
{ 6 * 8, 32 },
7,
{
}
};
Text text_clk {
{ 16 * 8, 3 * 8, 4 * 8, 16 },
{ 16 * 8, 4 * 8, 4 * 8, 16 },
"Clk:"
};
NumberField numberfield_clk {
{ 21 * 8, 3 * 8 },
{ 21 * 8, 4 * 8 },
3,
{ 1, 500 },
1,
' '
};
Text text_kHz {
{ 24 * 8, 3 * 8, 3 * 8, 16 },
{ 24 * 8, 4 * 8, 3 * 8, 16 },
"kHz"
};
Text text_bitduration {
{ 16 * 8, 5 * 8, 4 * 8, 16 },
{ 16 * 8, 6 * 8, 4 * 8, 16 },
"Bit:"
};
NumberField numberfield_bitduration {
{ 21 * 8, 5 * 8 },
{ 21 * 8, 6 * 8 },
4,
{ 50, 9999 },
1,
' '
};
Text text_us1 {
{ 25 * 8, 5 * 8, 2 * 8, 16 },
{ 25 * 8, 6 * 8, 2 * 8, 16 },
"us"
};
Text text_wordduration {
{ 15 * 8, 7 * 8, 5 * 8, 16 },
{ 15 * 8, 8 * 8, 5 * 8, 16 },
"Word:"
};
NumberField numberfield_wordduration {
{ 21 * 8, 7 * 8 },
{ 21 * 8, 8 * 8 },
5,
{ 300, 99999 },
100,
' '
};
Text text_us2 {
{ 26 * 8, 7 * 8, 2 * 8, 16 },
{ 26 * 8, 8 * 8, 2 * 8, 16 },
"us"
};
Text text_symfield {
{ 2 * 8, 9 * 8, 5 * 8, 16 },
{ 2 * 8, 10 * 8, 5 * 8, 16 },
"Word:"
};
SymField symfield_word {
{ 2 * 8, 11 * 8 },
{ 2 * 8, 12 * 8 },
20
};
Text text_format {
{ 2 * 8, 13 * 8, 24 * 8, 16 },
{ 2 * 8, 14 * 8, 24 * 8, 16 },
""
};
@ -172,6 +177,14 @@ private:
"Waveform:"
};
Waveform waveform {
{ 0, 160, 240, 32 },
waveform_buffer,
0,
0,
Color::yellow()
};
Text text_status {
{ 2 * 8, 224, 128, 16 },
"Ready"