Selector

group Selector

A function selector.

../../_images/selector.png

A function selector for easily managing autonomous routines. If available, automatically saves the current configuration to an SD card and loads it on the next run. Also supports displaying images from the SD card.

Selector Typedefs

typedef std::function<void()> routine_action_t
typedef struct rd::Selector::routine routine_t
typedef std::function<void(std::optional<routine_t>)> select_action_t

Selector Functions

Selector(std::string name, std::vector<routine_t> autons)

Create autonomous selector.

Parameters:
  • name – Name of the autonomous selector

  • autons – Vector of autonomous rotuines

Selector(std::vector<routine_t> autons)

Create autonomous selector.

Parameters:

autons – Vector of autonomous rotuines

void run_auton()

Run selected auton.

std::optional<routine_t> get_auton()

Get the selected auton

Returns:

Selected auton

void on_select(select_action_t callback)

Add a selection callback.

Parameters:

callback – The callback function

void next_auton(bool wrap_around = true)

Select the next auton in the list.

Selects the next auton in the list for use with physical buttons such as limit switches.

Parameters:

wrap_around – Whether to wrap around to the beginning once the last auton is reached

void prev_auton(bool wrap_around = true)

Select the previous auton in the list.

Selects the previous auton in the list for use with physical buttons such as limit switches.

Parameters:

wrap_around – Whether to wrap around to the end once the first auton is reached

void focus()

Set this view to the active view.

Functions

void sd_save()
void sd_load()
void run_callbacks()
static void select_cb(lv_event_t *event)
static void up_cb(lv_event_t *event)
static void down_cb(lv_event_t *event)
static void pg_up_cb(lv_event_t *event)
static void pg_down_cb(lv_event_t *event)

Variables

std::string name
routine_action_t action
std::string img = ""
int color_hue = -1
rd_view_t *view
lv_obj_t *routine_list
lv_obj_t *selected_cont
lv_obj_t *selected_label
lv_obj_t *selected_img
std::string name
std::vector<rd::Selector::routine_t> routines
std::vector<rd::Selector::select_action_t> select_callbacks
rd::Selector::routine_t *selected_routine
class Selector
#include <selector.hpp>

Selector class.

Selector Functions

Selector(std::string name, std::vector<routine_t> autons)

Create autonomous selector.

Parameters:
  • name – Name of the autonomous selector

  • autons – Vector of autonomous rotuines

Selector(std::vector<routine_t> autons)

Create autonomous selector.

Parameters:

autons – Vector of autonomous rotuines

void run_auton()

Run selected auton.

std::optional<routine_t> get_auton()

Get the selected auton

Returns:

Selected auton

void on_select(select_action_t callback)

Add a selection callback.

Parameters:

callback – The callback function

void next_auton(bool wrap_around = true)

Select the next auton in the list.

Selects the next auton in the list for use with physical buttons such as limit switches.

Parameters:

wrap_around – Whether to wrap around to the beginning once the last auton is reached

void prev_auton(bool wrap_around = true)

Select the previous auton in the list.

Selects the previous auton in the list for use with physical buttons such as limit switches.

Parameters:

wrap_around – Whether to wrap around to the end once the first auton is reached

void focus()

Set this view to the active view.

struct routine
struct routine