2#include "core/subsystems/odometry/odometry_base.h" 
    3#include "core/utils/controls/pid.h" 
    4#include "core/utils/controls/pidff.h" 
    5#include "core/utils/graph_drawer.h" 
    6#include "core/utils/math/geometry/pose2d.h" 
    7#include "core/utils/math/geometry/translation2d.h" 
   23        : onpress(onpress), rect(rect), name(name) {}
 
 
   28    ButtonWidget(
void (*onpress)(), 
Rect rect, std::string name) : onpress(onpress), rect(rect), name(name) {}
 
   35    bool update(
bool was_pressed, 
int x, 
int y);
 
   37    void draw(vex::brain::lcd &, 
bool first_draw, 
unsigned int frame_number);
 
   40    std::function<void(
void)> onpress;
 
   42    std::string name = 
"";
 
   43    bool was_pressed_last = 
false;
 
 
   57        : value(val), low(low), high(high), rect(rect), name(name) {}
 
 
   64    bool update(
bool was_pressed, 
int x, 
int y);
 
   66    void draw(vex::brain::lcd &, 
bool first_draw, 
unsigned int frame_number);
 
   75    std::string name = 
"";
 
 
   86    std::function<void()> onclick;
 
   88struct CheckboxConfig {
 
   89    std::function<void(
bool)> onupdate;
 
   96    std::function<std::string()> text;
 
  100    WidgetConfig &widget;
 
  115        std::vector<SizedWidget> widgets;
 
  118        CheckboxConfig checkbox;
 
  137    virtual void update(
bool was_pressed, 
int x, 
int y);
 
  145    virtual void draw(vex::brain::lcd &screen, 
bool first_draw, 
unsigned int frame_number);
 
 
  154void draw_widget(WidgetConfig &widget, ScreenRect rect);
 
  156class WidgetPage : 
public Page {
 
  158    WidgetPage(WidgetConfig &cfg) : base_widget(cfg) {}
 
  159    void update(
bool was_pressed, 
int x, 
int y) 
override;
 
  161    void draw(vex::brain::lcd &, 
bool first_draw, 
unsigned int frame_number)
 override {
 
  162        draw_widget(base_widget, {.x1 = 20, .y1 = 0, .x2 = 440, .y2 = 240});
 
  166    WidgetConfig &base_widget;
 
  175void start_screen(vex::brain::lcd &screen, std::vector<Page *> pages, 
int first_page = 0);
 
  179void goto_page(
size_t page);
 
  185using update_func_t = std::function<void(
bool, 
int, 
int)>;
 
  188using draw_func_t = std::function<void(vex::brain::lcd &screen, 
bool, 
unsigned int)>;
 
  195    StatsPage(std::map<std::string, vex::motor &> motors);
 
  197    void update(
bool was_pressed, 
int x, 
int y) 
override;
 
  199    void draw(vex::brain::lcd &, 
bool first_draw, 
unsigned int frame_number) 
override;
 
  203    draw_motor_stats(
const std::string &name, vex::motor &mot, 
unsigned int frame, 
int x, 
int y, vex::brain::lcd &scr);
 
  205    std::map<std::string, vex::motor &> motors;
 
  206    static const int y_start = 0;
 
  207    static const int per_column = 4;
 
  208    static const int row_height = 20;
 
  209    static const int row_width = 200;
 
 
  225    void update(
bool was_pressed, 
int x, 
int y) 
override;
 
  227    void draw(vex::brain::lcd &, 
bool first_draw, 
unsigned int frame_number) 
override;
 
  230    static const int path_len = 40;
 
  231    static constexpr char const *field_filename = 
"vex_field_240p.png";
 
  236    uint8_t *buf = 
nullptr;
 
  241    GraphDrawer velocity_graph;
 
 
  251    FunctionPage(update_func_t update_f, draw_func_t draw_t);
 
  253    void update(
bool was_pressed, 
int x, 
int y) 
override;
 
  255    void draw(vex::brain::lcd &, 
bool first_draw, 
unsigned int frame_number) 
override;
 
  258    update_func_t update_f;
 
 
  270    PIDPage(
PID &pid, std::string name, std::function<
void(
void)> onchange = []() {});
 
  271    PIDPage(PIDFF &pidff, std::string name, std::function<
void(
void)> onchange = []() {});
 
  274    void update(
bool was_pressed, 
int x, 
int y) 
override;
 
  276    void draw(vex::brain::lcd &, 
bool first_draw, 
unsigned int frame_number) 
override;
 
  280    void zero_d_f() { cfg.d = 0; }
 
  282    void zero_i_f() { cfg.i = 0; }
 
  286    const std::string name;
 
  287    std::function<void(
void)> onchange;
 
 
Definition odometry_base.h:31
 
void draw(vex::brain::lcd &, bool first_draw, unsigned int frame_number) override
draw uses the supplied draw function to draw to the screen
Definition screen.cpp:171
 
FunctionPage(update_func_t update_f, draw_func_t draw_t)
Creates a function page.
Definition screen.cpp:166
 
void update(bool was_pressed, int x, int y) override
update uses the supplied update function to update this page
Definition screen.cpp:169
 
void update(bool was_pressed, int x, int y) override
Definition screen.cpp:332
 
void draw(vex::brain::lcd &, bool first_draw, unsigned int frame_number) override
Definition screen.cpp:258
 
OdometryPage(OdometryBase &odom, double robot_width, double robot_height, bool do_trail)
Create an odometry trail. Make sure odometry is initilized before now.
Definition screen.cpp:238
 
void update(bool was_pressed, int x, int y) override
Definition screen.cpp:418
 
PIDPage(PID &pid, std::string name, std::function< void(void)> onchange=[]() {})
Create a PIDPage.
Definition screen.cpp:407
 
void draw(vex::brain::lcd &, bool first_draw, unsigned int frame_number) override
Definition screen.cpp:430
 
Page describes one part of the screen slideshow.
Definition screen.h:127
 
virtual void draw(vex::brain::lcd &screen, bool first_draw, unsigned int frame_number)
draw stored data to the screen (runs at 10 hz and only runs if this page is in front)
 
virtual void update(bool was_pressed, int x, int y)
collect data, respond to screen input, do fast things (runs at 50hz even if you're not focused on thi...
 
StatsPage(std::map< std::string, vex::motor & > motors)
Creates a stats page.
Definition screen.cpp:175
 
void draw(vex::brain::lcd &, bool first_draw, unsigned int frame_number) override
Definition screen.cpp:208
 
void update(bool was_pressed, int x, int y) override
Definition screen.cpp:176