File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ <H3>Loading....</H3>
112112 < script src ="js/dropmenu.js "> </ script >
113113 < script src ="js/localstorage.js "> </ script >
114114 < script src ="js/UIdisableddlg.js "> </ script >
115+ < script src ="js/custom.js "> </ script >
115116 <!--endRemoveIf(cleanheader)-->
116117 <!-- smoosh -->
117118 < script src ="js/app.js "> </ script >
Original file line number Diff line number Diff line change @@ -694,6 +694,9 @@ function process_socket_response(msg) {
694694 if ( msg . startsWith ( "X:" ) ) {
695695 process_Position ( msg ) ;
696696 }
697+ if ( msg . startsWith ( "esp3d:" ) ) {
698+ process_Custom ( msg ) ; // handles custom messages sent via M118
699+ }
697700 if ( msg . startsWith ( "ok" ) ) {
698701 if ( socket_is_settings ) {
699702 //update settings
Original file line number Diff line number Diff line change 1+ // Functions to handle custom messages sent via serial.
2+ // In gcode file, M118 can be used to send messages on serial.
3+ // This allows the microcontroller to communicate with hosts.
4+ // Example:
5+ // M118 esp3d:<your message>
6+ // will send "esp3d:<your message>" over serial, which can be picked up by host
7+ // to trigger certain actions.
8+
9+ function process_Custom ( response ) {
10+ var freq = 440 ; // beep frequency on end of print
11+ var dur = 100 ; // beep duration on end of print
12+ if ( response . startsWith ( "esp3d:eop" ) ) {
13+ // Sound to play on end of print
14+ // Triggered by message on serial terminal
15+ // ESP3D:eop
16+ //
17+ // This message can be sent via M118.
18+ beep ( dur , freq ) ;
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments