Merge pull request #696 from andrej-mk/ook

Increase max OOK clock
This commit is contained in:
GullCode 2022-10-09 18:23:33 +02:00 committed by GitHub
commit 5474487751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 13 deletions

View File

@ -47,7 +47,9 @@ EncodersConfigView::EncodersConfigView(
&labels, &labels,
&options_enctype, &options_enctype,
&field_clk, &field_clk,
&field_clk_step,
&field_frameduration, &field_frameduration,
&field_frameduration_step,
&symfield_word, &symfield_word,
&text_format, &text_format,
&waveform &waveform
@ -76,6 +78,10 @@ EncodersConfigView::EncodersConfigView(
field_frameduration.set_value(new_value * encoder_def->word_length, false); field_frameduration.set_value(new_value * encoder_def->word_length, false);
}; };
field_clk_step.on_change = [this](size_t, int32_t value) {
field_clk.set_step(value);
};
// Selecting word duration changes input clock and symbol duration // Selecting word duration changes input clock and symbol duration
field_frameduration.on_change = [this](int32_t value) { field_frameduration.on_change = [this](int32_t value) {
// value is in us, new_value is in kHz // value is in us, new_value is in kHz
@ -83,6 +89,10 @@ EncodersConfigView::EncodersConfigView(
if (new_value != field_clk.value()) if (new_value != field_clk.value())
field_clk.set_value(1000000 / new_value, false); field_clk.set_value(1000000 / new_value, false);
}; };
field_frameduration_step.on_change = [this](size_t, int32_t value) {
field_frameduration.set_step(value);
};
} }
void EncodersConfigView::focus() { void EncodersConfigView::focus() {

View File

@ -66,12 +66,14 @@ private:
Labels labels { Labels labels {
{ { 1 * 8, 0 }, "Type:", Color::light_grey() }, { { 1 * 8, 0 }, "Type:", Color::light_grey() },
{ { 16 * 8, 0 }, "Clk:", Color::light_grey() }, { { 1 * 8, 2 * 8 }, "Clk:", Color::light_grey() },
{ { 24 * 8, 0 }, "kHz", Color::light_grey() }, { { 10 * 8, 2 * 8 }, "kHz", Color::light_grey() },
{ { 14 * 8, 2 * 8 }, "Frame:", Color::light_grey() }, { { 17 * 8, 2 * 8 }, "Step:", Color::light_grey() },
{ { 26 * 8, 2 * 8 }, "us", Color::light_grey() }, { { 1 * 8, 4 * 8 }, "Frame:", Color::light_grey() },
{ { 2 * 8, 4 * 8 }, "Symbols:", Color::light_grey() }, { { 13 * 8, 4 * 8 }, "us", Color::light_grey() },
{ { 1 * 8, 11 * 8 }, "Waveform:", Color::light_grey() } { { 17 * 8, 4 * 8 }, "Step", Color::light_grey() },
{ { 2 * 8, 7 * 8 }, "Symbols:", Color::light_grey() },
{ { 1 * 8, 14 * 8 }, "Waveform:", Color::light_grey() }
}; };
OptionsField options_enctype { // Options are loaded at runtime OptionsField options_enctype { // Options are loaded at runtime
@ -82,34 +84,55 @@ private:
}; };
NumberField field_clk { NumberField field_clk {
{ 21 * 8, 0 }, { 5 * 8, 2 * 8 },
3, 4,
{ 1, 500 }, { 1, 1000 },
1, 1,
' ' ' '
}; };
OptionsField field_clk_step {
{ 22 * 8, 2 * 8 },
7,
{
{ "1", 1 },
{ "10", 10 },
{ "100", 100 }
}
};
NumberField field_frameduration { NumberField field_frameduration {
{ 21 * 8, 2 * 8 }, { 7 * 8, 4 * 8 },
5, 5,
{ 300, 99999 }, { 300, 99999 },
100, 100,
' ' ' '
}; };
OptionsField field_frameduration_step {
{ 22 * 8, 4 * 8 },
7,
{
{ "1", 1 },
{ "10", 10 },
{ "100", 100 },
{ "1000", 1000 }
}
};
SymField symfield_word { SymField symfield_word {
{ 2 * 8, 6 * 8 }, { 2 * 8, 9 * 8 },
20, 20,
SymField::SYMFIELD_DEF SymField::SYMFIELD_DEF
}; };
Text text_format { Text text_format {
{ 2 * 8, 8 * 8, 24 * 8, 16 }, { 2 * 8, 11 * 8, 24 * 8, 16 },
"" ""
}; };
Waveform waveform { Waveform waveform {
{ 0, 14 * 8, 240, 32 }, { 0, 17 * 8, 240, 32 },
waveform_buffer, waveform_buffer,
0, 0,
0, 0,