@@ -736,9 +736,8 @@ To add a new serial device, you must add an object to
736
736
* sent blocks to 512 because on Mac we seem to lose
737
737
* data otherwise (not on any other platforms!) */
738
738
if ( slowWrite ) blockSize = 19 ;
739
- writeData . blockSize = blockSize ;
740
739
741
- writeData . showStatus &= writeData . data . length > writeData . blockSize ;
740
+ writeData . showStatus &= writeData . data . length > blockSize ;
742
741
if ( writeData . showStatus ) {
743
742
Espruino . Core . Status . setStatus ( "Sending..." , writeData . data . length ) ;
744
743
console . log ( "serial: ---> " + JSON . stringify ( writeData . data ) ) ;
@@ -775,12 +774,13 @@ To add a new serial device, you must add an object to
775
774
}
776
775
777
776
let isLast = writeData . data . length == 0 ;
778
- // update status
779
- if ( writeData . showStatus )
780
- Espruino . Core . Status . incrementProgress ( d . length ) ;
781
777
// actually write data
782
778
//console.log("serial: Sending block "+JSON.stringify(d)+", wait "+split.delay+"ms");
779
+ Espruino . Core . Serial . connection . chunkSize = blockSize ;
783
780
Espruino . Core . Serial . connection . write ( d , function ( ) { // write data, but the callback returns a promise that delays
781
+ // update status
782
+ if ( writeData . showStatus )
783
+ Espruino . Core . Status . incrementProgress ( d . length ) ;
784
784
return new Promise ( resolve => setTimeout ( function ( ) {
785
785
if ( isLast && writeData . showStatus ) {
786
786
Espruino . Core . Status . setStatus ( "Sent" ) ;
0 commit comments