@@ -1547,7 +1547,7 @@ <h3 class="modal-title" id="modalTitle">Confirm Action</h3>
15471547 reconnectTimeout = null ;
15481548 }
15491549 updateStatus ( false ) ;
1550- const wsUrl = 'ws://' + window . location . hostname + '/ws' ;
1550+ const wsUrl = 'ws://' + "192.168.178.101" + '/ws' ;
15511551 ws = new WebSocket ( wsUrl ) ;
15521552
15531553 ws . onopen = ( ) => {
@@ -1719,6 +1719,7 @@ <h3 class="modal-title" id="modalTitle">Confirm Action</h3>
17191719 }
17201720
17211721 function sendAction ( cardId , action , data = { } ) {
1722+ console . log ( `[Dashboard] Sending action: ${ action } for card: ${ cardId } ` , data ) ;
17221723 if ( ws && ws . readyState === WebSocket . OPEN ) {
17231724 ws . send ( JSON . stringify ( { type : 'action' , cardId, action, data } ) ) ;
17241725 }
@@ -2442,7 +2443,6 @@ <h3 class="modal-title" id="modalTitle">Confirm Action</h3>
24422443 const chunk = data . slice ( offset , offset + chunkSize ) ;
24432444 const b64 = btoa ( String . fromCharCode . apply ( null , chunk ) ) ;
24442445 sendAction ( id , 'ota_chunk' , { data : b64 } ) ;
2445-
24462446 offset += chunkSize ;
24472447 const pct = Math . min ( 100 , Math . round ( ( offset / data . length ) * 100 ) ) ;
24482448 document . getElementById ( `progress-fill-${ id } ` ) . style . width = pct + '%' ;
@@ -2615,6 +2615,8 @@ <h3 class="modal-title" id="modalTitle">Confirm Action</h3>
26152615 zone . style . display = 'none' ;
26162616 progress . style . display = 'block' ;
26172617
2618+ console . log ( 'Starting OTA upload: ' + file . name + ' (' + file . size + ' bytes)' ) ;
2619+
26182620 // Send OTA start
26192621 if ( ws && ws . readyState === WebSocket . OPEN ) {
26202622 ws . send ( JSON . stringify ( { type : 'ota_start' , name : file . name , size : file . size } ) ) ;
@@ -2628,6 +2630,7 @@ <h3 class="modal-title" id="modalTitle">Confirm Action</h3>
26282630 const data = new Uint8Array ( reader . result ) ;
26292631
26302632 function sendChunk ( ) {
2633+ console . log ( 'Sending chunk: ' + offset + ' - ' + Math . min ( offset + chunkSize , data . length ) + ' / ' + data . length ) ;
26312634 if ( offset >= data . length ) {
26322635 if ( ws && ws . readyState === WebSocket . OPEN ) {
26332636 ws . send ( JSON . stringify ( { type : 'ota_end' } ) ) ;
@@ -2639,7 +2642,7 @@ <h3 class="modal-title" id="modalTitle">Confirm Action</h3>
26392642
26402643 const chunk = data . slice ( offset , offset + chunkSize ) ;
26412644 const b64 = btoa ( String . fromCharCode . apply ( null , chunk ) ) ;
2642-
2645+ console . log ( 'Sending chunk: ' + b64 . length + ' bytes' ) ;
26432646 if ( ws && ws . readyState === WebSocket . OPEN ) {
26442647 ws . send ( JSON . stringify ( { type : 'ota_chunk' , data : b64 } ) ) ;
26452648 }
0 commit comments