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:
Nikolay Minaylov 2022-10-07 16:58:36 +03:00 committed by GitHub
parent 4000f0cac5
commit 1a1f711897
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 14 deletions

View File

@ -1,12 +1,17 @@
#include "../signal_gen_app_i.h" #include "../signal_gen_app_i.h"
typedef enum { typedef enum {
LineIndexPin,
LineIndexSource, LineIndexSource,
LineIndexDivision, LineIndexDivision,
} LineIndex; } LineIndex;
static const char* const mco_pin_names[] = {
"13(Tx)",
};
static const char* const mco_source_names[] = { static const char* const mco_source_names[] = {
"32768", "32768Hz",
"64MHz", "64MHz",
"~100K", "~100K",
"~200K", "~200K",
@ -81,14 +86,22 @@ void signal_gen_scene_mco_on_enter(void* context) {
VariableItem* item; 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( 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_index(item, 0);
variable_item_set_current_value_text(item, mco_source_names[0]); variable_item_set_current_value_text(item, mco_source_names[0]);
item = variable_item_list_add( item = variable_item_list_add(
var_item_list, var_item_list,
"Division", "Freq. divider",
COUNT_OF(mco_divisor_names), COUNT_OF(mco_divisor_names),
mco_divisor_list_change_callback, mco_divisor_list_change_callback,
app); app);

View File

@ -16,10 +16,10 @@ void signal_gen_scene_start_on_enter(void* context) {
Submenu* submenu = app->submenu; Submenu* submenu = app->submenu;
submenu_add_item( 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_add_item(
submenu, submenu,
"Clock Output", "Clock Generator",
SubmenuIndexClockOutput, SubmenuIndexClockOutput,
signal_gen_scene_start_submenu_callback, signal_gen_scene_start_submenu_callback,
app); app);

View File

@ -9,7 +9,7 @@ typedef enum {
LineIndexTotalCount LineIndexTotalCount
} LineIndex; } 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 { struct SignalGenPwm {
View* view; View* view;
@ -31,8 +31,8 @@ typedef struct {
#define ITEM_H 64 / 3 #define ITEM_H 64 / 3
#define ITEM_W 128 #define ITEM_W 128
#define VALUE_X 95 #define VALUE_X 100
#define VALUE_W 55 #define VALUE_W 45
#define FREQ_VALUE_X 62 #define FREQ_VALUE_X 62
#define FREQ_MAX 1000000UL #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++) { for(uint8_t line = 0; line < LineIndexTotalCount; line++) {
if(line == LineIndexChannel) { if(line == LineIndexChannel) {
line_label = "PWM Channel"; line_label = "GPIO Pin";
} else if(line == LineIndexFrequency) { } else if(line == LineIndexFrequency) {
line_label = "Frequency"; line_label = "Frequency";
} else if(line == LineIndexDuty) { } else if(line == LineIndexDuty) {
line_label = "Duty Cycle"; line_label = "Pulse width";
} }
canvas_set_color(canvas, ColorBlack); 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); canvas_set_font(canvas, FontSecondary);
if(model->edit_mode) { if(model->edit_mode) {
uint8_t icon_x = (FREQ_VALUE_X - 1) + (FREQ_DIGITS_NB - model->edit_digit - 1) * 6; 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_4x7); canvas_draw_icon(canvas, icon_x, text_y - 9, &I_SmallArrowUp_3x5);
canvas_draw_icon(canvas, icon_x, text_y + 4, &I_SmallArrowDown_4x7); canvas_draw_icon(canvas, icon_x, text_y + 5, &I_SmallArrowDown_3x5);
} }
} else if(line == LineIndexDuty) { } else if(line == LineIndexDuty) {
snprintf(val_text, sizeof(val_text), "%d%%", model->duty); snprintf(val_text, sizeof(val_text), "%d%%", model->duty);

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -1,5 +1,5 @@
entry,status,name,type,params entry,status,name,type,params
Version,+,2.1,, Version,+,2.2,,
Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.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_SDcardFail_11x8,const Icon,
Variable,+,I_SDcardMounted_11x8,const Icon, Variable,+,I_SDcardMounted_11x8,const Icon,
Variable,+,I_Scanning_123x52,const Icon, Variable,+,I_Scanning_123x52,const Icon,
Variable,+,I_SmallArrowDown_3x5,const Icon,
Variable,+,I_SmallArrowDown_4x7,const Icon, Variable,+,I_SmallArrowDown_4x7,const Icon,
Variable,+,I_SmallArrowUp_3x5,const Icon,
Variable,+,I_SmallArrowUp_4x7,const Icon, Variable,+,I_SmallArrowUp_4x7,const Icon,
Variable,+,I_Smile_18x18,const Icon, Variable,+,I_Smile_18x18,const Icon,
Variable,+,I_Space_65x18,const Icon, Variable,+,I_Space_65x18,const Icon,

1 entry status name type params
2 Version + 2.1 2.2
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/cli/cli.h
5 Header + applications/services/cli/cli_vcp.h
2739 Variable + I_SDcardFail_11x8 const Icon
2740 Variable + I_SDcardMounted_11x8 const Icon
2741 Variable + I_Scanning_123x52 const Icon
2742 Variable + I_SmallArrowDown_3x5 const Icon
2743 Variable + I_SmallArrowDown_4x7 const Icon
2744 Variable + I_SmallArrowUp_3x5 const Icon
2745 Variable + I_SmallArrowUp_4x7 const Icon
2746 Variable + I_Smile_18x18 const Icon
2747 Variable + I_Space_65x18 const Icon