Skip to content

Commit 49c90b4

Browse files
author
vertex
committed
update docs, add preview, fix gauge issue
1 parent 9446693 commit 49c90b4

File tree

5 files changed

+54
-5
lines changed

5 files changed

+54
-5
lines changed

README.md

+52-3
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ spi_bus: spi0a
8484
> Currently only PNG images are supported
8585
```ini
8686
[imonk image smily-face]
87-
path: ~/smily-face.png
87+
path: ~/imonk/doc/smily-face.png
8888
```
8989
_Can appear multiple times, each section defines one image that can be identified by name provided in section brackets. Images are synchronized to device on Klipper start (or with g-code commands) to save on communication during print and operation._
9090

@@ -127,8 +127,8 @@ background: 333333
127127
widgets: [
128128
{
129129
"type": "image",
130-
"x": 120, # X Coordinate of the widget
131-
"y": 120, # Y Coordinate of the widget
130+
"x": 70, # X Coordinate of the widget
131+
"y": 60, # Y Coordinate of the widget
132132
"name": "smily-face" # Name of the image to display - same as in [imonk image ...] section
133133
},
134134
{
@@ -217,6 +217,55 @@ the extension provides macro helpers for stage/set commands that output `stage_i
217217
}
218218
```
219219

220+
#### Test macros
221+
222+
Test gcode macros using above configuration examples
223+
224+
```jinja
225+
[gcode_macro IMONK_TEST_GAUGE]
226+
gcode:
227+
{% set progress = params.PROGRESS|default(0)|int %}
228+
{% set stage_id = printer.imonk.set_view('test-gauge', {'progress': progress}) %}
229+
# {action_respond_info('test-gauge sid: {} {}%'.format(stage_id, progress))}
230+
231+
[gcode_macro IMONK_TEST_IMAGES]
232+
gcode:
233+
{% set stage_id = printer.imonk.set_view('test-images', {'text': 'Text between images'}) %}
234+
# {action_respond_info('test-images sid: {}'.format(stage_id))}
235+
236+
237+
[gcode_macro IMONK_TEST_TEXT]
238+
gcode:
239+
{% set stage_id = printer.imonk.set_view('test-text', {'text1': 'aaa'}) %}
240+
G4 P3000
241+
IMONK_SET_VALUE SID={stage_id} SLOT=text1 VALUE=bbb
242+
G4 P3000
243+
IMONK_SET_VALUE SID={stage_id} SLOT=text1 VALUE=ccc
244+
G4 P3000
245+
# {action_respond_info('test-text sid: {}'.format(stage_id))}
246+
247+
248+
[gcode_macro IMONK_TEST]
249+
gcode:
250+
{% for i in range(101) %}
251+
IMONK_TEST_GAUGE PROGRESS={i}
252+
{% endfor %}
253+
254+
IMONK_TEST_IMAGES
255+
G4 P5000
256+
257+
IMONK_TEST_TEXT
258+
259+
{% for i in range(101) %}
260+
IMONK_TEST_GAUGE PROGRESS={100 - i}
261+
{% endfor %}
262+
263+
```
264+
265+
Result
266+
267+
![preview.gif](doc%2Fpreview.gif)
268+
220269

221270
## Motivation
222271

doc/preview.gif

19.2 MB
Loading

doc/smily-face.png

7.27 KB
Loading

src/View/Initial.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ View::Initial::Initial()
1010
: line(120, 90, Display::Align::Center, 0XFFFFFF, &Display::Fonts::Font0)
1111
, line2(120, 105, Display::Align::Center, 0XFF00FF, &Display::Fonts::Font2)
1212
{
13-
line.setString("Initializing...");
13+
line.setString("Initialized");
1414
line2.setString(String("Flash Size: ") + Filesystem::Filesystem::getFlashSize() + "B"); // todo remove
1515
}
1616

src/Widget/Gauge.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Widget::Gauge::Gauge(Display::Unit x, Display::Unit y, Display::Unit radius, Dis
3333
}
3434

3535
std::unique_ptr<Widget::BaseWidget> Widget::Gauge::clone() {
36-
auto gauge = std::make_unique<Gauge>(_x, _y, _r, _thickness, _color, _rotation, _gaugeArc);
36+
auto gauge = std::make_unique<Gauge>(_x, _y, _r, _thickness, _color, _background, _rotation, _gaugeArc);
3737
gauge->setPercent(_percentage);
3838
return std::move(gauge);
3939
}

0 commit comments

Comments
 (0)