Skip to content

Commit 38b3222

Browse files
author
Greg Smith
committed
- Added Valeton parameter storage
- refactored some param names/types to be more generic - more work on Valeton comms protocol - code to enable Valeton UI when connected
1 parent f7138a9 commit 38b3222

18 files changed

+1266
-258
lines changed

source/main/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
idf_component_register(SRCS "midi_control.c" "control.c" "footswitches.c" "CH422G.c" "display.c" "main.c" "tonex_params.c" "SX1509.c"
2+
idf_component_register(SRCS "valeton_params.c" "midi_control.c" "control.c" "footswitches.c" "CH422G.c" "display.c" "main.c" "tonex_params.c" "SX1509.c"
33
"usb_comms.c" "usb_tonex_one.c" "usb_tonex_common.c" "usb_tonex.c" "usb_valeton_gp5.c" "CH422G.c" "midi_serial.c" "wifi_config.c" "leds.c" "midi_helper.c" "LP5562.c"
44
"platform_devkitc.c" "platform_lgtdisps3.c" "platform_m5atoms3r.c" "platform_ws19t.c" "platform_ws43.c" "platform_wszero.c" "platform_ws169.c"
55
"platform_ws35b.c" "platform_jc3248w.c"

source/main/control.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,24 @@ enum IOExpanderPins
245245
IO_EXPANDER_PIN_16
246246
};
247247

248+
enum ParamTypes
249+
{
250+
MODELLER_PARAM_TYPE_SWITCH, // on/off
251+
MODELLER_PARAM_TYPE_SELECT, // 0,1,2,3 etc
252+
MODELLER_PARAM_TYPE_RANGE // floating point range
253+
};
254+
255+
#define MAX_PARAM_NAME 12
256+
257+
typedef struct
258+
{
259+
float Value;
260+
float Min;
261+
float Max;
262+
char Name[MAX_PARAM_NAME];
263+
uint8_t Type;
264+
} tModellerParameter;
265+
248266
typedef struct __attribute__ ((packed))
249267
{
250268
uint8_t Switch;

source/main/display.c

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ void ui_show_settings_tab(lv_event_t * e)
449449
*****************************************************************************/
450450
void action_effect_icon_clicked(lv_event_t * e)
451451
{
452-
tTonexParameter* param_ptr;
452+
tModellerParameter* param_ptr;
453453
float value;
454454
lv_event_code_t event_code = lv_event_get_code(e);
455455
lv_obj_t* event_object = lv_event_get_target(e);
@@ -1784,6 +1784,31 @@ static uint8_t update_ui_element(tUIUpdate* update)
17841784
case UI_ELEMENT_USB_STATUS:
17851785
{
17861786
element_1 = objects.ui_usb_status_fail;
1787+
1788+
if (update->Value == 1)
1789+
{
1790+
// if enabled, adjust UI to suit modeller
1791+
switch (usb_get_connected_modeller_type())
1792+
{
1793+
case AMP_MODELLER_TONEX_ONE: // fallthrough
1794+
case AMP_MODELLER_TONEX: // fallthrough
1795+
default:
1796+
{
1797+
lv_obj_clear_flag(objects.ui_bottom_panel_tonex, LV_OBJ_FLAG_HIDDEN);
1798+
lv_obj_add_flag(objects.ui_bottom_panel_valeton, LV_OBJ_FLAG_HIDDEN);
1799+
1800+
lv_label_set_text(objects.ui_project_heading_label, "Tonex Controller");
1801+
} break;
1802+
1803+
case AMP_MODELLER_VALETON_GP5:
1804+
{
1805+
lv_obj_add_flag(objects.ui_bottom_panel_tonex, LV_OBJ_FLAG_HIDDEN);
1806+
lv_obj_clear_flag(objects.ui_bottom_panel_valeton, LV_OBJ_FLAG_HIDDEN);
1807+
1808+
lv_label_set_text(objects.ui_project_heading_label, "Valeton Controller");
1809+
} break;
1810+
}
1811+
}
17871812
} break;
17881813

17891814
case UI_ELEMENT_BT_STATUS:
@@ -1827,13 +1852,13 @@ static uint8_t update_ui_element(tUIUpdate* update)
18271852
#if CONFIG_TONEX_CONTROLLER_DISPLAY_FULL_UI
18281853
ESP_LOGI(TAG, "Syncing params to UI");
18291854

1830-
tTonexParameter* param_ptr;
1855+
tModellerParameter* param_ptr;
18311856

18321857
for (uint16_t param = 0; param < TONEX_GLOBAL_LAST; param++)
18331858
{
18341859
if (tonex_params_get_locked_access(&param_ptr) == ESP_OK)
18351860
{
1836-
tTonexParameter* param_entry = &param_ptr[param];
1861+
tModellerParameter* param_entry = &param_ptr[param];
18371862

18381863
// debug
18391864
//ESP_LOGI(TAG, "Param %d: val: %02f, min: %02f, max: %02f", param, param_entry->Value, param_entry->Min, param_entry->Max);
@@ -3327,13 +3352,13 @@ static uint8_t update_ui_element(tUIUpdate* update)
33273352
|| CONFIG_TONEX_CONTROLLER_HARDWARE_PLATFORM_WAVESHARE_19TOUCH
33283353
ESP_LOGI(TAG, "Syncing params to UI");
33293354

3330-
tTonexParameter* param_ptr;
3355+
tModellerParameter* param_ptr;
33313356

33323357
for (uint16_t param = 0; param < TONEX_GLOBAL_LAST; param++)
33333358
{
33343359
if (tonex_params_get_locked_access(&param_ptr) == ESP_OK)
33353360
{
3336-
tTonexParameter* param_entry = &param_ptr[param];
3361+
tModellerParameter* param_entry = &param_ptr[param];
33373362

33383363
// debug
33393364
//ESP_LOGI(TAG, "Param %d: val: %02f, min: %02f, max: %02f", param, param_entry->Value, param_entry->Min, param_entry->Max);

source/main/footswitches.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ static void footswitch_handle_effects(tFootswitchHandler* handler, tFootswitchEf
613613
uint8_t value;
614614
uint16_t param;
615615
float new_value;
616-
tTonexParameter* param_ptr;
616+
tModellerParameter* param_ptr;
617617

618618
// handle state
619619
switch (handler->state)
@@ -642,7 +642,7 @@ static void footswitch_handle_effects(tFootswitchHandler* handler, tFootswitchEf
642642
if (tonex_params_get_locked_access(&param_ptr) == ESP_OK)
643643
{
644644
// is the parameter a boolean type?
645-
if (param_ptr[param].Type == TONEX_PARAM_TYPE_SWITCH)
645+
if (param_ptr[param].Type == MODELLER_PARAM_TYPE_SWITCH)
646646
{
647647
// toggle the current value
648648
if (param_ptr[param].Value == 0)
@@ -657,7 +657,7 @@ static void footswitch_handle_effects(tFootswitchHandler* handler, tFootswitchEf
657657
tonex_params_release_locked_access();
658658
usb_modify_parameter(param, new_value);
659659
}
660-
else if (param_ptr[param].Type == TONEX_PARAM_TYPE_SELECT)
660+
else if (param_ptr[param].Type == MODELLER_PARAM_TYPE_SELECT)
661661
{
662662
// save current value before we release the locked access
663663
// select params are really integers saved as floats
@@ -677,7 +677,7 @@ static void footswitch_handle_effects(tFootswitchHandler* handler, tFootswitchEf
677677

678678
midi_helper_adjust_param_via_midi(fx_handler[loop].config.CC, new_value);
679679
}
680-
else if (param_ptr[param].Type == TONEX_PARAM_TYPE_RANGE)
680+
else if (param_ptr[param].Type == MODELLER_PARAM_TYPE_RANGE)
681681
{
682682
// save current value before we release the locked access
683683
float current_param_value = param_ptr[param].Value;

source/main/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ limitations under the License.
6767
#include "wifi_config.h"
6868
#include "leds.h"
6969
#include "tonex_params.h"
70+
#include "valeton_params.h"
7071
#include "platform_common.h"
7172

7273
#define I2C_MASTER_FREQ_HZ 400000 /*!< I2C master clock frequency */
@@ -261,6 +262,7 @@ void app_main(void)
261262
// init parameters
262263
ESP_LOGI(TAG, "Init Params");
263264
tonex_params_init();
265+
valeton_params_init();
264266

265267
// init control task
266268
ESP_LOGI(TAG, "Init Control");

source/main/midi_helper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static float midi_helper_boolean_midi_to_float(uint8_t midi_value)
9393
*****************************************************************************/
9494
static uint8_t midi_helper_boolean_midi_toggle(uint16_t param, uint8_t midi_value, float* value)
9595
{
96-
tTonexParameter* param_ptr;
96+
tModellerParameter* param_ptr;
9797

9898
if (midi_value == MIDI_BOOL_TOGGLE)
9999
{
@@ -133,7 +133,7 @@ esp_err_t midi_helper_adjust_param_via_midi(uint8_t change_num, uint8_t midi_val
133133
{
134134
uint16_t param;
135135
float value;
136-
tTonexParameter* param_ptr;
136+
tModellerParameter* param_ptr;
137137

138138
// Midi mapping done to match the big Tonex pedal
139139
switch (change_num)
@@ -1305,7 +1305,7 @@ esp_err_t midi_helper_adjust_param_via_midi(uint8_t change_num, uint8_t midi_val
13051305
uint16_t midi_helper_get_param_for_change_num(uint8_t change_num, uint8_t midi_value_1, uint8_t midi_value_2)
13061306
{
13071307
uint16_t param = TONEX_UNKNOWN;
1308-
tTonexParameter* param_ptr;
1308+
tModellerParameter* param_ptr;
13091309

13101310
// Midi mapping done to match the big Tonex pedal
13111311
switch (change_num)

0 commit comments

Comments
 (0)