-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(rebase/build) Add M117 support (print progress with octoprint) #3147
Open
Monkopedia
wants to merge
4
commits into
prusa3d:master
Choose a base branch
from
Monkopedia:octostatus
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2021 Matthew Lloyd <[email protected]> | ||
* All rights reserved. | ||
* | ||
* This file is part of Llama Mini. | ||
* | ||
* Llama Mini is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Llama Mini is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Llama Mini. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "window_lcd_message.hpp" | ||
#include "gui.hpp" | ||
#include <algorithm> | ||
#include "ScreenHandler.hpp" | ||
#include "marlin_client.hpp" | ||
|
||
char lcd_message_text[LCD_MESSAGE_MAX_LEN + 1]; | ||
|
||
/*****************************************************************************/ | ||
//WindowLCDMessage | ||
WindowLCDMessage::WindowLCDMessage(window_t *parent, Rect16 rect) | ||
: AddSuperWindow<window_text_t>(parent, rect, is_multiline::no) { | ||
last_lcd_message_text[0] = 0; | ||
last_lcd_message_text[LCD_MESSAGE_MAX_LEN] = 0; | ||
lcd_message_text[0] = 0; | ||
lcd_message_text[LCD_MESSAGE_MAX_LEN] = 0; | ||
font = resource_font(IDR_FNT_SMALL); | ||
SetAlignment(Align_t::Center()); | ||
} | ||
|
||
void WindowLCDMessage::windowEvent(EventLock /*has private ctor*/, window_t *sender, GUI_event_t event, void *param) { | ||
if (event == GUI_event_t::LOOP) { | ||
if (strncmp(lcd_message_text, last_lcd_message_text, LCD_MESSAGE_MAX_LEN) != 0) { | ||
strncpy(last_lcd_message_text, lcd_message_text, LCD_MESSAGE_MAX_LEN); | ||
SetText(string_view_utf8::MakeRAM((const uint8_t *)lcd_message_text)); | ||
Invalidate(); | ||
} | ||
} | ||
SuperWindowEvent(sender, event, param); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) 2021 Matthew Lloyd <[email protected]> | ||
* All rights reserved. | ||
* | ||
* This file is part of Llama Mini. | ||
* | ||
* Llama Mini is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Llama Mini is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Llama Mini. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "window_text.hpp" | ||
|
||
#define LCD_MESSAGE_MAX_LEN 30 | ||
extern char lcd_message_text[LCD_MESSAGE_MAX_LEN + 1]; | ||
|
||
class WindowLCDMessage : public AddSuperWindow<window_text_t> { | ||
char last_lcd_message_text[LCD_MESSAGE_MAX_LEN + 1]; | ||
|
||
public: | ||
WindowLCDMessage(window_t *parent, Rect16 rect); | ||
|
||
protected: | ||
void windowEvent(EventLock /*has private ctor*/, window_t *sender, GUI_event_t event, void *param) override; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ target_sources( | |
PRIVATE G26.cpp | ||
G64.cpp | ||
gcode.cpp | ||
M117.cpp | ||
M300.cpp | ||
M330.cpp | ||
M505.cpp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "window_lcd_message.hpp" | ||
#include "../../lib/Marlin/Marlin/src/gcode/gcode.h" | ||
|
||
#include "M117.hpp" | ||
#include <stdint.h> | ||
|
||
/** | ||
* M117: LCD message | ||
*/ | ||
void PrusaGcodeSuite::M117() { | ||
if (parser.string_arg && parser.string_arg[0]) | ||
strncpy(lcd_message_text, parser.string_arg, LCD_MESSAGE_MAX_LEN); | ||
else | ||
lcd_message_text[0] = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
namespace PrusaGcodeSuite { | ||
void M117(); // LCD message | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just break here. The ok_to_send stuff is handled below.