(C++)需要帮助制作初始屏幕以重新贴现智能控制器 4x20 LCD 显示器 - 已编辑



我最近购买了使用marlin软件,MKS mini(kossel)主板(使用Arduino引导加载程序和Marlin固件)和reprapdiscount智能控制器LCD显示屏(4行x 20个字符)的delta 3d打印机套件。

我的编程经验几乎为零,我希望得到一些帮助来创建仅在启动时调用的"启动画面",然后在一段时间后返回到状态屏幕。我已经在互联网上搜索了如何做到这一点,但唯一有任何可行选择的是全图形版本的 LCD 显示器 - 这不是我所拥有的。我找到了用于此特定LCD显示器的.cpp文件 - 但是由于我有限的编程知识,我无法弄清楚如何在开始时添加启动画面。

我很确定我必须在菜单实现的开头创建一个 void 函数(见下文),但我不确定如何/如何调用它,以便它首先启动,然后切换到状态屏幕。我可以为它编写伪代码,但不知道完整的代码...

旁注:我刚刚意识到在菜单项中,它显示了文本的引用变量,该变量实际上包含在另一个名为 language.h 的文件中

我希望它做什么的伪代码:

//start->boot printer
static void splashscreen()
{
    /*splashlines are defined in language.h file*/
    static void splashline1(); // hello
    static void splashline2(); // world
    static void splashline3(); // i'm
    static void splashline4(); // here!
    wait 3 seconds;
    switch to -> static void lcd_status_screen();
}

任何帮助将不胜感激!

不幸的是,该帖子限制在 30,000 个字符以内,发布原始代码将使我超过 50,000 个字符......所以我会尝试发布

相关代码片段:

提前感谢!!


编辑


~

液晶屏状态屏代码 ~

#ifdef ULTIPANEL
static float manual_feedrate[] = MANUAL_FEEDRATE;
#endif // ULTIPANEL
/* !Configuration settings */
//Function pointer to menu functions.
typedef void (*menuFunc_t)();
uint8_t lcd_status_message_level;
char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG;
/** forward declerations **/
void copy_and_scalePID_i();
void copy_and_scalePID_d();
/* Different menus */
static void lcd_status_screen();
#ifdef ULTIPANEL
  extern bool powersupply;
  static void lcd_main_menu();
  static void lcd_tune_menu();
  static void lcd_prepare_menu();
  static void lcd_move_menu();
  static void lcd_control_menu();
  static void lcd_control_temperature_menu();
  static void lcd_control_temperature_preheat_pla_settings_menu();
  static void lcd_control_temperature_preheat_abs_settings_menu();
  static void lcd_control_motion_menu();
~

已编辑 编码开始 ~

menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */
uint32_t lcd_next_update_millis;
uint8_t lcd_status_update_delay;
uint8_t lcdDrawUpdate = 2;                  /* Set to none-zero when the LCD needs to draw, decreased after every draw. Set to 2 in LCD routines so the LCD gets atleast 1 full redraw (first redraw is partial) */
//prevMenu and prevEncoderPosition are used to store the previous menu location when editing settings.
menuFunc_t prevMenu = NULL;
uint16_t prevEncoderPosition;
//Variables used when editing values.
const char* editLabel;
void* editValue;
int32_t minEditValue, maxEditValue;
menuFunc_t callbackFunc;
// placeholders for Ki and Kd edits
float raw_Ki, raw_Kd;
/* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependend */
static void lcd_status_screen()
{
    if (lcd_status_update_delay)
        lcd_status_update_delay--;
    else
        lcdDrawUpdate = 1;
    if (lcdDrawUpdate)
    {
        lcd_implementation_status_screen();
        lcd_status_update_delay = 10;   /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */
    }
#ifdef ULTIPANEL
    if (LCD_CLICKED)
    {
        currentMenu = lcd_main_menu;
        encoderPosition = 0;
        lcd_quick_feedback();
    }
    // Dead zone at 100% feedrate
    if ((feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100) ||
            (feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100))
    {
        encoderPosition = 0;
        feedmultiply = 100;
    }
    if (feedmultiply == 100 && int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE)
    {
        feedmultiply += int(encoderPosition) - ENCODER_FEEDRATE_DEADZONE;
        encoderPosition = 0;
    }
    else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE)
    {
        feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
        encoderPosition = 0;
    }
    else if (feedmultiply != 100)
    {
        feedmultiply += int(encoderPosition);
        encoderPosition = 0;
    }
    if (feedmultiply < 10)
        feedmultiply = 10;
    if (feedmultiply > 999)
        feedmultiply = 999;
#endif//ULTIPANEL
}

正如乔尔·科内特(Joel Cornett)所建议的那样,查找知识差距并具体询问这些差距。在这种情况下,您似乎需要以下内容:

  1. 如何编写要显示的"飞溅"的定时暂停。
  2. 在哪里初始化你想要的代码(我想你可能忽略了它,因为我认为在你发布的代码中看不到它)。
  3. 如何使代码进入状态屏幕而不循环

尝试编辑您的帖子/将您的问题拆分为单独的帖子。您可能会从中获得更好的响应率。

最新更新