簡體   English   中英

(C ++)需要幫助制作reprapdiscount智能控制器4x20 LCD顯示屏的啟動畫面-編輯

[英](C++) Need help making splash screen for reprapdiscount smart controller 4x20 LCD display - EDITED

我最近購買了使用馬林軟件,MKS mini(kossel)主板(使用Arduino bootloader和馬林固件)和reprapdiscount智能控制器LCD顯示屏(4行x 20個字符)的delta 3d打印機套件。

我的編程經驗幾乎為零,我希望獲得一些幫助來創建僅在啟動時調用的“啟動畫面”,然后在一段時間后返回到狀態畫面。 我已經在互聯網上搜索了如何執行此操作,但是唯一有任何可行選擇的是FULL GRAPHICS版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個...所以我將嘗試發布

相關代碼段:

提前致謝!!


已編輯


〜LCD狀態屏幕代碼〜

#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. 如何使代碼進入狀態屏幕而不會自行循環。

嘗試編輯您的帖子/將您的問題拆分為單個帖子。 您可能會因此獲得更好的響應率。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM