forked from Duet3D/T113_Screen_for_RepRapFirmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainLogic.cc
1284 lines (1066 loc) · 36.4 KB
/
mainLogic.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#pragma once
#include "DebugLevels.h"
#define DEBUG_LEVEL DEBUG_LEVEL_DBG
#include "Comm/Communication.h"
#include "Comm/JsonDecoder.h"
#include "Configuration.h"
#include "Debug.h"
#include "DebugCommands.h"
#include "Hardware/Duet.h"
#include "Hardware/Reset.h"
#include "Hardware/Usb.h"
#include "Library/bmp.h"
#include "ObjectModel/Alert.h"
#include "ObjectModel/Fan.h"
#include "ObjectModel/Files.h"
#include "ObjectModel/Heightmap.h"
#include "ObjectModel/PrinterStatus.h"
#include "ObjectModel/Utils.h"
#include "Storage.h"
#include "UI/Graph.h"
#include "UI/GuidedSetup.h"
#include "UI/Logic/Console.h"
#include "UI/Logic/ExtrusionControl.h"
#include "UI/Logic/FileList.h"
#include "UI/Logic/Heightmap.h"
#include "UI/Logic/HomeScreen.h"
#include "UI/Logic/Move.h"
#include "UI/Logic/ObjectCancel.h"
#include "UI/Logic/PrintStatus.h"
#include "UI/Logic/Settings.h"
#include "UI/Logic/Sidebar.h"
#include "UI/Logic/Webcam.h"
#include "UI/OmObserver.h"
#include "UI/Themes.h"
#include "UI/UserInterface.h"
#include "Upgrade/Upgrade.h"
#include "manager/LanguageManager.h"
#include "os/MountMonitor.h"
#include "os/UpgradeMonitor.h"
#include "storage/StoragePreferences.h"
#include "timer.h"
#include "utils/BrightnessHelper.h"
#include "utils/TimeHelper.h"
#include <string>
#include <sys/reboot.h>
#include <sys/stat.h>
#include <unistd.h>
#include <vector>
/*
* This file is generated by the GUI tool
* File function: logic corresponding code for processing users
* Function Description:
*========================onButtonClick_XXXX
When the button on the page is pressed, the system will call the corresponding function.
XXX represents the [ID value] name in the GUI tool, such as Button1.
When the return value is false, the system will no longer process this button,
and when it returns true, the system will continue to process this button. Such as SYS_BACK.
*========================onSlideWindowItemClick_XXXX(int index)
When there is a sliding window on the page and the user clicks the icon of the sliding window, the system will call this function.
XXX represents the [ID value] name in the GUI tool, for example: slideWindow1.
index represents the offset value of the pressed icon
*========================onSeekBarChange_XXXX(int progress)
When there is a slider on the page and the user changes the progress, the system will call this function.
XXX represents the [ID value] name in the GUI tool, such as SeekBar1.
progress represents the current progress value
*========================ogetListItemCount_XXXX()
When there is a sliding list on the page, the system will call this interface to obtain the total number of lists when updating.
XXX represents the [ID value] name in the GUI tool, such as List1.
The return value is the total number of items in the current list
*========================oobtainListItemData_XXXX(ZKListView::ZKListItem *pListItem, int index)
When there is a sliding list on the page, the system will call this interface
to obtain the content information under the current item of the list when updating,
XXX represents the [ID value] name in the GUI tool. For example, List1.
pListItem is a single item object in the map and index is the offset of the list's total purpose.
See function description for details
*========================Commonly used interface===============
* LOGD(...) interface to print debugging information
* mTextXXXPtr->setText("****") Display text on the control TextXXX
* mButton1Ptr->setSelected(true); Set the control mButton1 to the selected mode, the picture will be switched to the selected picture, and the button text will be switched to the selected color
* mSeekBarPtr->setProgress(12) Adjust the progress to 12 on the control mSeekBar
* mListView1Ptr->refreshListView() Make mListView1 re-refresh, call when the list data changes
* mDashbroadView1Ptr->setTargetAngle(120) Adjust the pointer display angle on the control mDashbroadView1 to 120 degrees
*
* In Eclipse IDE, use the "alt + /" shortcut key to open the smart prompt
*/
/**
* Register timer
* Fill the array to register the timer
* Note: id cannot be repeated
*/
static S_ACTIVITY_TIMEER REGISTER_ACTIVITY_TIMER_TAB[] = {
{TIMER_DELAYED_TASK, 50},
{TIMER_ASYNC_HTTP_REQUEST, 50},
{TIMER_THUMBNAIL, 50},
};
/**
* Triggered when the interface is constructed
*/
static void onUI_init()
{
// Tips : Add the display code for UI initialization here, such as: mText1Ptr->setText("123");
srand(0);
InitUpgradeMountListener();
initTimer(mActivityPtr);
registerUserTimer(TIMER_UPDATE_DATA,
(int)DEFAULT_PRINTER_POLL_INTERVAL); // Register here so it can be reset with stored poll interval
// Comm
Comm::DUET.Init();
// UI
UI::Init(mRootWindowPtr);
UI::Settings::Init(); // Sets various UI elements states
UI::Sidebar::Init();
UI::HomeScreen::Init();
UI::Move::Init();
UI::ExtrusionControl::Init();
UI::PrintStatus::Init();
UI::FileList::Init();
UI::Heightmap::Init();
UI::ObjectCancel::Init();
UI::WINDOW.AddHome(mMainWindowPtr);
UI::CONSOLE.Init(mConsoleListViewPtr, mConsoleInputPtr);
UI::NUMPAD_WINDOW.Init(mNumPadWindowPtr, mNumPadHeaderPtr, mNumPadInputPtr);
UI::SLIDER_WINDOW.Init(
mSliderWindowPtr, mSliderPtr, mSliderHeaderPtr, mSliderValuePtr, mSliderPrefixPtr, mSliderSuffixPtr);
// Guided setup
UI::GuidedSetup::Init(mGuidedSetupWindowPtr);
// Hide clock here so that it is visible when editing the GUI
mDigitalClock1Ptr->setVisible(false);
/* Initialise UI observer updaters that run on each field value that is received from the OM */
auto* observer = UI::g_omFieldObserverHead;
while (observer != nullptr)
{
observer->Init(UI::g_observerMap);
observer = observer->next;
}
/* Initialise UI observer updaters that run after an array has been received */
auto* observerArrayEnd = UI::g_omArrayEndObserverHead;
while (observerArrayEnd != nullptr)
{
observerArrayEnd->Init(UI::g_observerMapArrayEnd);
observerArrayEnd = observerArrayEnd->next;
}
info("UI initialized");
}
/**
* Triggered when switching to this interface
*/
static void onUI_intent(const Intent *intentPtr)
{
if (intentPtr != NULL)
{
//TODO
}
}
/*
* Triggered when the interface is displayed
*/
static void onUI_show() {}
/*
* Triggered when the interface is hidden
*/
static void onUI_hide() {}
/*
* Triggered when the interface completely exits
*/
static void onUI_quit() {}
/**
* Serial data callback interface
*/
static void onProtocolDataUpdate(const SProtocolData &rxData)
{
// We want a single decoder for all uart data
static Comm::JsonDecoder decoder;
decoder.CheckInput(rxData.data, rxData.len);
}
/**
* Timer trigger function
* It is not recommended to write time-consuming operations in this function, otherwise it will affect UI refresh
* Parameters:
* - id: The id of the currently triggered timer is the same as the id at registration
* Return value:
* - True: Continue to run the current timer
* - False: Stop running the current timer
*/
static bool onUI_Timer(int id)
{
switch (id)
{
case TIMER_UPDATE_DATA:
{
static OM::PrinterStatus status = OM::PrinterStatus::unknown;
if (status != OM::GetStatus())
{
status = OM::GetStatus();
mStatusTextPtr->setTextTr(OM::GetStatusText());
}
Comm::sendNext();
break;
}
case TIMER_DELAYED_TASK: {
runDelayedCallbacks();
break;
}
case TIMER_ASYNC_HTTP_REQUEST: {
Comm::ProcessQueuedAsyncRequests();
break;
}
case TIMER_THUMBNAIL: {
FILEINFO_CACHE->Spin();
break;
}
default:
break;
}
return true;
}
/**
* Triggered when there is a new touch event
* Parameters:
* - ev: New touch event
* Return value:
* - True: Indicates that the touch event is intercepted here, and the system will no longer pass this touch event to the control
* - False: Touch events will continue to be passed to the control
*/
static bool onmainActivityTouchEvent(const MotionEvent &ev)
{
switch (ev.mActionStatus)
{
case MotionEvent::E_ACTION_DOWN: // touch pressed
break;
case MotionEvent::E_ACTION_MOVE: // touch slide
break;
case MotionEvent::E_ACTION_UP: // touch released
break;
default:
break;
}
return false;
}
// =====================================================================================================================
// Side Bar
// =====================================================================================================================
static bool onButtonClick_HomeBtn(ZKButton *pButton)
{
UI::WINDOW.Home();
return false;
}
static bool onButtonClick_BackBtn(ZKButton *pButton)
{
UI::WINDOW.Back();
return false;
}
static bool onButtonClick_MacroBtn(ZKButton *pButton)
{
UI::Sidebar::OpenMacros();
return false;
}
static bool onButtonClick_ConsoleBtn(ZKButton* pButton)
{
UI::Sidebar::OpenConsole();
return false;
}
static bool onButtonClick_EStopBtn(ZKButton *pButton)
{
UI::Sidebar::EStop();
return false;
}
static bool onButtonClick_ToolTempSnapshot(ZKButton* pButton)
{
return false;
}
static bool onButtonClick_BedTempSnapshot(ZKButton* pButton)
{
return false;
}
static bool onButtonClick_ChamberTempSnapshot(ZKButton* pButton)
{
return false;
}
// =====================================================================================================================
// Main Window
// =====================================================================================================================
static int getListItemCount_ToolListView(const ZKListView *pListView)
{
return UI::HomeScreen::GetToolsListCount();
}
static void obtainListItemData_ToolListView(ZKListView *pListView, ZKListView::ZKListItem *pListItem, int index)
{
UI::HomeScreen::SetToolsListItem(pListItem, index);
}
static void onListItemClick_ToolListView(ZKListView *pListView, int index, int id)
{
UI::HomeScreen::ToolsListItemCallback(index, id);
}
static int getListItemCount_WindowSelectList(const ZKListView* pListView)
{
return UI::HomeScreen::GetWindowSelectCount();
}
static void obtainListItemData_WindowSelectList(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::HomeScreen::SetWindowSelectListItem(pListItem, index);
}
static void onListItemClick_WindowSelectList(ZKListView* pListView, int index, int id)
{
UI::HomeScreen::WindowSelectListItemCallback(index);
}
static void onSlideItemClick_SlideWindow1(ZKSlideWindow *pSlideWindow, int index)
{
UI::HomeScreen::WindowSelectListItemCallback(index);
}
static int getListItemCount_TemperatureGraphLegend(const ZKListView *pListView)
{
return UI::HomeScreen::GetTemperatureGraphLegendCount();
}
static void obtainListItemData_TemperatureGraphLegend(ZKListView *pListView, ZKListView::ZKListItem *pListItem, int index)
{
UI::HomeScreen::SetTemperatureGraphLegendItem(pListItem, index);
}
static void onListItemClick_TemperatureGraphLegend(ZKListView *pListView, int index, int id)
{
UI::HomeScreen::TemperatureGraphLegendItemCallback(index);
}
static int getListItemCount_TempGraphXLabels(const ZKListView* pListView)
{
return pListView->getCols();
}
static void obtainListItemData_TempGraphXLabels(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::HomeScreen::SetTemperatureGraphXLabel(pListView, pListItem, index);
}
static void onListItemClick_TempGraphXLabels(ZKListView* pListView, int index, int id) {}
static int getListItemCount_TempGraphYLabels(const ZKListView* pListView)
{
return pListView->getRows();
}
static void obtainListItemData_TempGraphYLabels(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::HomeScreen::SetTemperatureGraphYLabel(pListView, pListItem, index);
}
static void onListItemClick_TempGraphYLabels(ZKListView* pListView, int index, int id) {}
// =====================================================================================================================
// Popups
// =====================================================================================================================
static bool onButtonClick_OverlayModalZone(ZKButton* pButton)
{
UI::WINDOW.CloseOverlay();
return false;
}
static bool onButtonClick_NumPad0(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.AddOneChar('0');
return false;
}
static bool onButtonClick_NumPad1(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.AddOneChar('1');
return false;
}
static bool onButtonClick_NumPad2(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.AddOneChar('2');
return false;
}
static bool onButtonClick_NumPad3(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.AddOneChar('3');
return false;
}
static bool onButtonClick_NumPad4(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.AddOneChar('4');
return false;
}
static bool onButtonClick_NumPad5(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.AddOneChar('5');
return false;
}
static bool onButtonClick_NumPad6(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.AddOneChar('6');
return false;
}
static bool onButtonClick_NumPad7(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.AddOneChar('7');
return false;
}
static bool onButtonClick_NumPad8(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.AddOneChar('8');
return false;
}
static bool onButtonClick_NumPad9(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.AddOneChar('9');
return false;
}
static bool onButtonClick_NumPadDel(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.DelOneChar();
return false;
}
static bool onButtonClick_NumPadConfirm(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.Confirm();
return false;
}
static bool onButtonClick_NumPadCloseBtn(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.Close();
return false;
}
static bool onButtonClick_NumPadClearBtn(ZKButton* pButton)
{
UI::NUMPAD_WINDOW.ClearValue();
return false;
}
static void onProgressChanged_Slider(ZKSeekBar* pSeekBar, int progress)
{
UI::SLIDER_WINDOW.Callback();
}
static bool onButtonClick_SliderCloseBtn(ZKButton* pButton)
{
UI::WINDOW.CloseOverlay();
return false;
}
static bool onButtonClick_PopupCancelBtn(ZKButton* pButton)
{
UI::POPUP_WINDOW.Cancel();
return false;
}
static bool onButtonClick_PopupOkBtn(ZKButton* pButton)
{
UI::POPUP_WINDOW.Ok();
return false;
}
static int getListItemCount_PopupSelectionList(const ZKListView* pListView)
{
return OM::g_currentAlert.choices_count;
}
static void obtainListItemData_PopupSelectionList(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
pListItem->setText(OM::g_currentAlert.choices[index].c_str());
}
static void onListItemClick_PopupSelectionList(ZKListView* pListView, int index, int id)
{
Comm::DUET.SendGcodef("M292 R{%lu} S%lu\n", index, OM::g_currentAlert.seq);
}
static void onEditTextChanged_PopupTextInput(const std::string& text)
{
if (UI::POPUP_WINDOW.GetMode() != OM::Alert::Mode::Text)
return;
UI::POPUP_WINDOW.ValidateTextInput(text.c_str());
}
static void onEditTextChanged_PopupNumberInput(const std::string& text)
{
switch (UI::POPUP_WINDOW.GetMode())
{
case OM::Alert::Mode::NumberInt: {
UI::POPUP_WINDOW.ValidateIntegerInput(text.c_str());
break;
}
case OM::Alert::Mode::NumberFloat: {
UI::POPUP_WINDOW.ValidateFloatInput(text.c_str());
break;
}
default:
break;
}
}
static int getListItemCount_PopupAxisSelection(const ZKListView* pListView)
{
return UI::POPUP_WINDOW.GetJogAxisCount();
}
static void obtainListItemData_PopupAxisSelection(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
pListItem->setSelected(index == UI::POPUP_WINDOW.selectedAxis);
pListItem->setText(UI::POPUP_WINDOW.GetJogAxis(index)->letter);
}
static void onListItemClick_PopupAxisSelection(ZKListView* pListView, int index, int id)
{
dbg("Popup axis selection %d", index);
UI::POPUP_WINDOW.selectedAxis = index;
}
static int getListItemCount_PopupAxisAdjusment(const ZKListView* pListView)
{
return ARRAY_SIZE(UI::POPUP_WINDOW.jogAmounts);
}
static void obtainListItemData_PopupAxisAdjusment(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
pListItem->setText(UI::POPUP_WINDOW.jogAmounts[index]);
}
static void onListItemClick_PopupAxisAdjusment(ZKListView* pListView, int index, int id)
{
Comm::DUET.SendGcode("M120\n"); // Push
Comm::DUET.SendGcode("G91\n"); // Relative move
Comm::DUET.SendGcodef("G1 %s%.3f F%d\n",
UI::POPUP_WINDOW.GetJogAxis(UI::POPUP_WINDOW.selectedAxis)->letter,
UI::POPUP_WINDOW.jogAmounts[index],
300);
Comm::DUET.SendGcode("M121\n"); // Pop
}
static void onProgressChanged_PopupProgress(ZKSeekBar* pSeekBar, int progress) {}
// =====================================================================================================================
// Console Window
// =====================================================================================================================
static int getListItemCount_ConsoleListView(const ZKListView* pListView)
{
return UI::ConsoleWindow::GetConsoleListCount();
}
static void obtainListItemData_ConsoleListView(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::ConsoleWindow::SetConsoleListItem(pListItem, index);
}
static void onListItemClick_ConsoleListView(ZKListView* pListView, int index, int id) {}
static int getListItemCount_GcodeListView(const ZKListView* pListView)
{
return UI::ConsoleWindow::GetGcodeListCount();
}
static void obtainListItemData_GcodeListView(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::ConsoleWindow::SetGcodeListItem(pListItem, index);
}
static void onListItemClick_GcodeListView(ZKListView* pListView, int index, int id) {}
static void onEditTextChanged_ConsoleInput(const std::string& text)
{
UI::ConsoleWindow::ConsoleInputCallback(text);
}
static bool onButtonClick_SendBtn(ZKButton* pButton)
{
UI::ConsoleWindow::SendConsoleInput();
return true;
}
static bool onButtonClick_ConsoleClearBtn(ZKButton* pButton)
{
UI::ConsoleWindow::ClearConsole();
return false;
}
static bool onButtonClick_ConsoleMacroBtn1(ZKButton* pButton)
{
UI::ConsoleWindow::OpenDebugCommands();
return false;
}
static bool onButtonClick_ConsoleMacroBtn2(ZKButton* pButton)
{
return false;
}
static bool onButtonClick_ConsoleMacroBtn3(ZKButton* pButton)
{
Comm::DUET.SendGcode("M122");
return false;
}
static int getListItemCount_DebugCommandList(const ZKListView* pListView)
{
return UI::ConsoleWindow::GetDebugCommandsCount();
}
static void obtainListItemData_DebugCommandList(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::ConsoleWindow::SetDebugCommandsListItem(pListItem, index);
}
static void onListItemClick_DebugCommandList(ZKListView* pListView, int index, int id)
{
UI::ConsoleWindow::DebugCommandCallback(index);
}
// =====================================================================================================================
// Move Window
// =====================================================================================================================
static bool onButtonClick_HomeAllBtn(ZKButton *pButton) {
UI::Move::HomeAll();
return false;
}
static bool onButtonClick_TrueLevelBtn(ZKButton* pButton)
{
UI::Move::TrueLevel();
return false;
}
static bool onButtonClick_MeshLevelBtn(ZKButton* pButton)
{
UI::Move::MeshLevel();
return false;
}
static bool onButtonClick_DisableMotorsBtn(ZKButton* pButton)
{
UI::Move::DisableMotors();
return false;
}
static bool onButtonClick_HeightmapBtn(ZKButton* pButton)
{
UI::Move::OpenHeightmap();
return false;
}
static int getListItemCount_AxisControlListView(const ZKListView* pListView)
{
return UI::Move::GetAxisListCount();
}
static void obtainListItemData_AxisControlListView(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::Move::SetAxisListItem(pListItem, index);
}
static void onListItemClick_AxisControlListView(ZKListView* pListView, int index, int id)
{
UI::Move::AxisListItemCallback(index, id);
}
static int getListItemCount_MoveFeedrate(const ZKListView* pListView)
{
return UI::Move::GetFeedRateCount();
}
static void obtainListItemData_MoveFeedrate(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::Move::SetFeedRateListItem(pListItem, index);
}
static void onListItemClick_MoveFeedrate(ZKListView* pListView, int index, int id)
{
UI::Move::FeedRateListItemCallback(index);
}
// =====================================================================================================================
// Extrude Window
// =====================================================================================================================
static int getListItemCount_ExtruderFeedDist(const ZKListView* pListView)
{
return UI::ExtrusionControl::GetExtrusionDistanceCount();
}
static void obtainListItemData_ExtruderFeedDist(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::ExtrusionControl::SetExtrusionDistanceListItem(pListItem, index);
}
static void onListItemClick_ExtruderFeedDist(ZKListView* pListView, int index, int id)
{
UI::ExtrusionControl::ExtrusionDistanceListItemCallback(index);
}
static int getListItemCount_ExtruderFeedrate(const ZKListView* pListView)
{
return UI::ExtrusionControl::GetExtrusionSpeedCount();
}
static void obtainListItemData_ExtruderFeedrate(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::ExtrusionControl::SetExtrusionSpeedListItem(pListItem, index);
}
static void onListItemClick_ExtruderFeedrate(ZKListView* pListView, int index, int id)
{
UI::ExtrusionControl::ExtrusionSpeedListItemCallback(index);
}
static bool onButtonClick_RetractBtn(ZKButton* pButton)
{
UI::ExtrusionControl::RetractFilament();
return false;
}
static bool onButtonClick_ExtrudeBtn(ZKButton* pButton)
{
UI::ExtrusionControl::ExtrudeFilament();
return false;
}
static int getListItemCount_ExtrudeToolList(const ZKListView* pListView)
{
return UI::ExtrusionControl::GetListCount();
}
static void obtainListItemData_ExtrudeToolList(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::ExtrusionControl::SetExtrudeListItem(pListItem, index);
}
static void onListItemClick_ExtrudeToolList(ZKListView* pListView, int index, int id)
{
UI::ExtrusionControl::ExtrudeListItemCallback(index, id);
}
static int getListItemCount_FilamentList(const ZKListView* pListView)
{
return UI::ExtrusionControl::GetFilamentListCount();
}
static void obtainListItemData_FilamentList(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::ExtrusionControl::SetFilamentListItem(pListItem, index);
}
static void onListItemClick_FilamentList(ZKListView* pListView, int index, int id)
{
UI::ExtrusionControl::FilamentListItemCallback(index, id);
}
static bool onButtonClick_UnloadFilamentBtn(ZKButton* pButton)
{
UI::ExtrusionControl::UnloadFilament();
return false;
}
// =====================================================================================================================
// Files Window
// =====================================================================================================================
static bool onButtonClick_FileRefreshBtn(ZKButton* pButton)
{
UI::FileList::ReloadFileList();
return false;
}
static int getListItemCount_FileListView(const ZKListView* pListView)
{
return UI::FileList::GetFileListCount();
}
static void obtainListItemData_FileListView(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::FileList::SetFileListItem(pListItem, index);
}
static void onListItemClick_FileListView(ZKListView* pListView, int index, int id)
{
UI::FileList::FileListItemCallback(index);
}
static bool onButtonClick_UsbFiles(ZKButton* pButton)
{
UI::FileList::RequestUSBFiles();
return false;
}
// =====================================================================================================================
// Print Status Window
// =====================================================================================================================
static bool onButtonClick_PrintBabystepDecBtn(ZKButton* pButton)
{
UI::PrintStatus::BabyStepDown();
return false;
}
static bool onButtonClick_PrintBabystepIncBtn(ZKButton* pButton)
{
UI::PrintStatus::BabyStepUp();
return false;
}
static int getListItemCount_PrintFanList(const ZKListView* pListView)
{
return UI::PrintStatus::GetFanListCount();
}
static void obtainListItemData_PrintFanList(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::PrintStatus::SetFanListItem(pListItem, index);
}
static void onListItemClick_PrintFanList(ZKListView* pListView, int index, int id)
{
UI::PrintStatus::FanListItemCallback(index);
}
static bool onButtonClick_PrintPauseBtn(ZKButton* pButton)
{
UI::PrintStatus::PausePrint();
return false;
}
static bool onButtonClick_PrintCancelBtn(ZKButton* pButton)
{
UI::PrintStatus::StopPrint();
return false;
}
static bool onButtonClick_PrintResumeBtn(ZKButton* pButton)
{
UI::PrintStatus::ResumePrint();
return false;
}
static bool onButtonClick_PrintAgainBtn(ZKButton* pButton)
{
UI::PrintStatus::PrintAgain();
return false;
}
static int getListItemCount_PrintPositionList(const ZKListView* pListView)
{
return UI::PrintStatus::GetAxisListCount();
}
static void obtainListItemData_PrintPositionList(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::PrintStatus::SetAxisListItem(pListItem, index);
}
static void onListItemClick_PrintPositionList(ZKListView* pListView, int index, int id) {}
static int getListItemCount_PrintExtruderPositionList(const ZKListView* pListView)
{
return UI::PrintStatus::GetExtruderListCount();
}
static void obtainListItemData_PrintExtruderPositionList(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::PrintStatus::SetExtruderListItem(pListItem, index);
}
static void onListItemClick_PrintExtruderPositionList(ZKListView* pListView, int index, int id)
{
UI::PrintStatus::ExtruderListItemCallback(index);
}
static void onProgressChanged_PrintSpeedMultiplierBar(ZKSeekBar* pSeekBar, int progress)
{
UI::PrintStatus::SpeedMultiplierCallback(progress);
}
static bool onButtonClick_PrintSpeedFactor(ZKButton* pButton)
{
UI::PrintStatus::OpenPrintSpeedFactorPopup();
return false;
}
static int getListItemCount_PrintTemperatureList(const ZKListView* pListView)
{
return UI::PrintStatus::GetToolsListCount();
}
static void obtainListItemData_PrintTemperatureList(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::PrintStatus::SetToolsListItem(pListItem, index);
}
static void onListItemClick_PrintTemperatureList(ZKListView *pListView, int index, int id) {
UI::PrintStatus::ToolsListItemCallback(index, id);
}
// =====================================================================================================================
// Settings Window
// =====================================================================================================================
static int getListItemCount_SettingsWindowSelectList(const ZKListView* pListView)
{
return UI::Settings::GetWindowSelectCount();
}
static void obtainListItemData_SettingsWindowSelectList(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::Settings::SetWindowSelectListItem(pListItem, index);
}
static void onListItemClick_SettingsWindowSelectList(ZKListView* pListView, int index, int id)
{
UI::Settings::WindowSelectListItemCallback(index);
}
static void onSlideItemClick_SettingsSlideWindow(ZKSlideWindow* pSlideWindow, int index)
{
UI::Settings::WindowSelectListItemCallback(index);
}
static int getListItemCount_BaudRateList(const ZKListView* pListView)
{
return UI::Settings::GetBaudRateCount();
}
static void obtainListItemData_BaudRateList(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::Settings::SetBaudRateListItem(pListItem, index);
}
static void onListItemClick_BaudRateList(ZKListView* pListView, int index, int id)
{
UI::Settings::BaudRateListItemCallback(index);
}
static int getListItemCount_DuetCommList(const ZKListView* pListView)
{
return UI::Settings::GetDuetCommMethodCount();
}
static void obtainListItemData_DuetCommList(ZKListView* pListView, ZKListView::ZKListItem* pListItem, int index)
{
UI::Settings::SetDuetCommMethodListItem(pListItem, index);
}
static void onListItemClick_DuetCommList(ZKListView* pListView, int index, int id)
{
UI::Settings::DuetCommMethodListItemCallback(index);
}
static void onEditTextChanged_PollIntervalInput(const std::string& text)
{
UI::Settings::DuetPollIntervalInputCallback(text);
}