Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase max OOK clock #696

Merged
merged 3 commits into from Oct 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions firmware/application/apps/ui_encoders.cpp
Expand Up @@ -46,7 +46,9 @@ EncodersConfigView::EncodersConfigView(
&labels,
&options_enctype,
&field_clk,
&field_clk_step,
&field_frameduration,
&field_frameduration_step,
&symfield_word,
&text_format,
&waveform
Expand Down Expand Up @@ -74,6 +76,10 @@ EncodersConfigView::EncodersConfigView(
if (new_value != field_frameduration.value())
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
field_frameduration.on_change = [this](int32_t value) {
Expand All @@ -82,6 +88,10 @@ EncodersConfigView::EncodersConfigView(
if (new_value != field_clk.value())
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() {
Expand Down
49 changes: 36 additions & 13 deletions firmware/application/apps/ui_encoders.hpp
Expand Up @@ -66,12 +66,14 @@ class EncodersConfigView : public View {

Labels labels {
{ { 1 * 8, 0 }, "Type:", Color::light_grey() },
{ { 16 * 8, 0 }, "Clk:", Color::light_grey() },
{ { 24 * 8, 0 }, "kHz", Color::light_grey() },
{ { 14 * 8, 2 * 8 }, "Frame:", Color::light_grey() },
{ { 26 * 8, 2 * 8 }, "us", Color::light_grey() },
{ { 2 * 8, 4 * 8 }, "Symbols:", Color::light_grey() },
{ { 1 * 8, 11 * 8 }, "Waveform:", Color::light_grey() }
{ { 1 * 8, 2 * 8 }, "Clk:", Color::light_grey() },
{ { 10 * 8, 2 * 8 }, "kHz", Color::light_grey() },
{ { 17 * 8, 2 * 8 }, "Step:", Color::light_grey() },
{ { 1 * 8, 4 * 8 }, "Frame:", Color::light_grey() },
{ { 13 * 8, 4 * 8 }, "us", 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
Expand All @@ -82,34 +84,55 @@ class EncodersConfigView : public View {
};

NumberField field_clk {
{ 21 * 8, 0 },
3,
{ 1, 500 },
{ 5 * 8, 2 * 8 },
4,
{ 1, 1000 },
1,
' '
};

OptionsField field_clk_step {
{ 22 * 8, 2 * 8 },
7,
{
{ "1", 1 },
{ "10", 10 },
{ "100", 100 }
}
};

NumberField field_frameduration {
{ 21 * 8, 2 * 8 },
{ 7 * 8, 4 * 8 },
5,
{ 300, 99999 },
100,
' '
};

OptionsField field_frameduration_step {
{ 22 * 8, 4 * 8 },
7,
{
{ "1", 1 },
{ "10", 10 },
{ "100", 100 },
{ "1000", 1000 }
}
};

SymField symfield_word {
{ 2 * 8, 6 * 8 },
{ 2 * 8, 9 * 8 },
20,
SymField::SYMFIELD_DEF
};

Text text_format {
{ 2 * 8, 8 * 8, 24 * 8, 16 },
{ 2 * 8, 11 * 8, 24 * 8, 16 },
""
};

Waveform waveform {
{ 0, 14 * 8, 240, 32 },
{ 0, 17 * 8, 240, 32 },
waveform_buffer,
0,
0,
Expand Down