File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -223,8 +223,8 @@ To add a new serial device, you must add an object to
223
223
return ;
224
224
}
225
225
var txItem = connection . txDataQueue [ 0 ] ;
226
- uart . writeProgress ( txItem . maxLength - txItem . data . length , txItem . maxLength ) ;
227
- connection . updateProgress ( txItem . maxLength - txItem . data . length , txItem . maxLength ) ;
226
+ uart . writeProgress ( txItem . maxLength - ( txItem . data ? txItem . data . length : 0 ) , txItem . maxLength ) ;
227
+ connection . updateProgress ( txItem . maxLength - ( txItem . data ? txItem . data . length : 0 ) , txItem . maxLength ) ;
228
228
if ( txItem . data . length <= connection . chunkSize ) {
229
229
chunk = txItem . data ;
230
230
txItem . data = undefined ;
@@ -759,10 +759,11 @@ To add a new serial device, you must add an object to
759
759
//console.log("serial: Sending block "+JSON.stringify(d)+", wait "+split.delay+"ms");
760
760
Espruino . Core . Serial . connection . write ( d , function ( ) { // write data, but the callback returns a promise that delays
761
761
return new Promise ( resolve => setTimeout ( function ( ) {
762
- if ( isLast && writeData . showStatus )
762
+ if ( isLast && writeData . showStatus ) {
763
763
Espruino . Core . Status . setStatus ( "Sent" ) ;
764
- if ( writeData . callback )
765
- writeData . callback ( ) ;
764
+ if ( writeData . callback )
765
+ writeData . callback ( ) ;
766
+ }
766
767
resolve ( ) ;
767
768
} , split . delay ) ) ;
768
769
} ) ;
You can’t perform that action at this time.
0 commit comments