Signal Generator app: UI update (#1829)
* Signal Generator: UI update * icons renamed Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
parent
4000f0cac5
commit
1a1f711897
@ -1,12 +1,17 @@
|
||||
#include "../signal_gen_app_i.h"
|
||||
|
||||
typedef enum {
|
||||
LineIndexPin,
|
||||
LineIndexSource,
|
||||
LineIndexDivision,
|
||||
} LineIndex;
|
||||
|
||||
static const char* const mco_pin_names[] = {
|
||||
"13(Tx)",
|
||||
};
|
||||
|
||||
static const char* const mco_source_names[] = {
|
||||
"32768",
|
||||
"32768Hz",
|
||||
"64MHz",
|
||||
"~100K",
|
||||
"~200K",
|
||||
@ -81,14 +86,22 @@ void signal_gen_scene_mco_on_enter(void* context) {
|
||||
|
||||
VariableItem* item;
|
||||
|
||||
item = variable_item_list_add(var_item_list, "GPIO Pin", COUNT_OF(mco_pin_names), NULL, NULL);
|
||||
variable_item_set_current_value_index(item, 0);
|
||||
variable_item_set_current_value_text(item, mco_pin_names[0]);
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list, "Source", COUNT_OF(mco_source_names), mco_source_list_change_callback, app);
|
||||
var_item_list,
|
||||
"Frequency",
|
||||
COUNT_OF(mco_source_names),
|
||||
mco_source_list_change_callback,
|
||||
app);
|
||||
variable_item_set_current_value_index(item, 0);
|
||||
variable_item_set_current_value_text(item, mco_source_names[0]);
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"Division",
|
||||
"Freq. divider",
|
||||
COUNT_OF(mco_divisor_names),
|
||||
mco_divisor_list_change_callback,
|
||||
app);
|
||||
|
@ -16,10 +16,10 @@ void signal_gen_scene_start_on_enter(void* context) {
|
||||
Submenu* submenu = app->submenu;
|
||||
|
||||
submenu_add_item(
|
||||
submenu, "PWM", SubmenuIndexPwm, signal_gen_scene_start_submenu_callback, app);
|
||||
submenu, "PWM Generator", SubmenuIndexPwm, signal_gen_scene_start_submenu_callback, app);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Clock Output",
|
||||
"Clock Generator",
|
||||
SubmenuIndexClockOutput,
|
||||
signal_gen_scene_start_submenu_callback,
|
||||
app);
|
||||
|
@ -9,7 +9,7 @@ typedef enum {
|
||||
LineIndexTotalCount
|
||||
} LineIndex;
|
||||
|
||||
static const char* const pwm_ch_names[] = {"TIM1(2)", "LPTIM2(4)"};
|
||||
static const char* const pwm_ch_names[] = {"2(A7)", "4(A4)"};
|
||||
|
||||
struct SignalGenPwm {
|
||||
View* view;
|
||||
@ -31,8 +31,8 @@ typedef struct {
|
||||
#define ITEM_H 64 / 3
|
||||
#define ITEM_W 128
|
||||
|
||||
#define VALUE_X 95
|
||||
#define VALUE_W 55
|
||||
#define VALUE_X 100
|
||||
#define VALUE_W 45
|
||||
|
||||
#define FREQ_VALUE_X 62
|
||||
#define FREQ_MAX 1000000UL
|
||||
@ -126,11 +126,11 @@ static void signal_gen_pwm_draw_callback(Canvas* canvas, void* _model) {
|
||||
|
||||
for(uint8_t line = 0; line < LineIndexTotalCount; line++) {
|
||||
if(line == LineIndexChannel) {
|
||||
line_label = "PWM Channel";
|
||||
line_label = "GPIO Pin";
|
||||
} else if(line == LineIndexFrequency) {
|
||||
line_label = "Frequency";
|
||||
} else if(line == LineIndexDuty) {
|
||||
line_label = "Duty Cycle";
|
||||
line_label = "Pulse width";
|
||||
}
|
||||
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
@ -162,9 +162,9 @@ static void signal_gen_pwm_draw_callback(Canvas* canvas, void* _model) {
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
|
||||
if(model->edit_mode) {
|
||||
uint8_t icon_x = (FREQ_VALUE_X - 1) + (FREQ_DIGITS_NB - model->edit_digit - 1) * 6;
|
||||
canvas_draw_icon(canvas, icon_x, text_y - 9, &I_SmallArrowUp_4x7);
|
||||
canvas_draw_icon(canvas, icon_x, text_y + 4, &I_SmallArrowDown_4x7);
|
||||
uint8_t icon_x = (FREQ_VALUE_X) + (FREQ_DIGITS_NB - model->edit_digit - 1) * 6;
|
||||
canvas_draw_icon(canvas, icon_x, text_y - 9, &I_SmallArrowUp_3x5);
|
||||
canvas_draw_icon(canvas, icon_x, text_y + 5, &I_SmallArrowDown_3x5);
|
||||
}
|
||||
} else if(line == LineIndexDuty) {
|
||||
snprintf(val_text, sizeof(val_text), "%d%%", model->duty);
|
||||
|
BIN
assets/icons/Interface/SmallArrowDown_3x5.png
Normal file
BIN
assets/icons/Interface/SmallArrowDown_3x5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
assets/icons/Interface/SmallArrowUp_3x5.png
Normal file
BIN
assets/icons/Interface/SmallArrowUp_3x5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
@ -1,5 +1,5 @@
|
||||
entry,status,name,type,params
|
||||
Version,+,2.1,,
|
||||
Version,+,2.2,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/cli/cli.h,,
|
||||
Header,+,applications/services/cli/cli_vcp.h,,
|
||||
@ -2739,7 +2739,9 @@ Variable,+,I_SDQuestion_35x43,const Icon,
|
||||
Variable,+,I_SDcardFail_11x8,const Icon,
|
||||
Variable,+,I_SDcardMounted_11x8,const Icon,
|
||||
Variable,+,I_Scanning_123x52,const Icon,
|
||||
Variable,+,I_SmallArrowDown_3x5,const Icon,
|
||||
Variable,+,I_SmallArrowDown_4x7,const Icon,
|
||||
Variable,+,I_SmallArrowUp_3x5,const Icon,
|
||||
Variable,+,I_SmallArrowUp_4x7,const Icon,
|
||||
Variable,+,I_Smile_18x18,const Icon,
|
||||
Variable,+,I_Space_65x18,const Icon,
|
||||
|
|
Loading…
Reference in New Issue
Block a user