@@ -16,6 +16,29 @@ const scrollToBottom = (target) => {
1616} ;
1717
1818const daemon = new Daemon ( 'hfejhkbipnickajaidoppbadcomekkde' ) ;
19+ const handleUpload = ( ) => {
20+ const target = {
21+ board : 'arduino:samd:mkr1000' ,
22+ port : '/dev/ttyACM0' ,
23+ network : false
24+ } ;
25+
26+ const data = {
27+ files : [ {
28+ name : 'serial_mirror.bin' ,
29+ data : HEX
30+ } ] ,
31+ commandline : '\"{runtime.tools.bossac-1.7.0.path}/bossac\" {upload.verbose} --port={serial.port.file} -U true -i -e -w -v \"{build.path}/{build.project_name}.bin\" -R' ,
32+ signature : '66695789d14908f52cb1964da58ec9fa816d6ddb321900c60ad6ec2d84a7c713abb2b71404030c043e32cf548736eb706180da8256f2533bd132430896437c72b396abe19e632446f16e43b80b73f5cf40aec946d00e7543721cc72d77482a84d2d510e46ea6ee0aaf063ec267b5046a1ace36b7eb04c64b4140302586f1e10eda8452078498ab5c9985e8f5d521786064601daa5ba2978cf91cfeb64e83057b3475ec029a1b835460f4e203c1635eaba812b076248a3589cd5d84c52398f09d255f8aae25d66a40d5ab2b1700247defbdfd044c77d44078197d1f543800e11f79d6ef1c6eb46df65fe2fffd81716b11d798ba21a3ca2cb20f6d955d8e1f8aef' ,
33+ extrafiles : [ ] ,
34+ options : {
35+ wait_for_upload_port : true ,
36+ use_1200bps_touch : true ,
37+ params_verbose : '-v'
38+ }
39+ } ;
40+ daemon . upload ( target , data ) ;
41+ } ;
1942
2043class App extends React . Component {
2144 constructor ( ) {
@@ -30,15 +53,14 @@ class App extends React.Component {
3053 serialMonitorContent : '' ,
3154 serialPortOpen : '' ,
3255 uploadStatus : '' ,
33- ulploadError : '' ,
56+ uploadError : '' ,
3457 supportedBoards : [ ]
3558 } ;
3659 this . handleOpen = this . handleOpen . bind ( this ) ;
3760 this . handleClose = this . handleClose . bind ( this ) ;
3861 this . handleSend = this . handleSend . bind ( this ) ;
3962 this . showError = this . showError . bind ( this ) ;
4063 this . clearError = this . clearError . bind ( this ) ;
41- this . handleUpload = this . handleUpload . bind ( this ) ;
4264 }
4365
4466 componentDidMount ( ) {
@@ -109,30 +131,6 @@ class App extends React.Component {
109131 serialInput . value = '' ;
110132 }
111133
112- handleUpload ( ) {
113- const target = {
114- board : 'arduino:samd:mkr1000' ,
115- port : '/dev/ttyACM1' ,
116- network : false
117- } ;
118-
119- const data = {
120- files : [ {
121- name : 'serial_mirror.bin' ,
122- data : HEX
123- } ] ,
124- commandline : '\"{runtime.tools.bossac-1.7.0.path}/bossac\" {upload.verbose} --port={serial.port.file} -U true -i -e -w -v \"{build.path}/{build.project_name}.bin\" -R' ,
125- signature : '66695789d14908f52cb1964da58ec9fa816d6ddb321900c60ad6ec2d84a7c713abb2b71404030c043e32cf548736eb706180da8256f2533bd132430896437c72b396abe19e632446f16e43b80b73f5cf40aec946d00e7543721cc72d77482a84d2d510e46ea6ee0aaf063ec267b5046a1ace36b7eb04c64b4140302586f1e10eda8452078498ab5c9985e8f5d521786064601daa5ba2978cf91cfeb64e83057b3475ec029a1b835460f4e203c1635eaba812b076248a3589cd5d84c52398f09d255f8aae25d66a40d5ab2b1700247defbdfd044c77d44078197d1f543800e11f79d6ef1c6eb46df65fe2fffd81716b11d798ba21a3ca2cb20f6d955d8e1f8aef' ,
126- extrafiles : [ ] ,
127- options : {
128- wait_for_upload_port : true ,
129- use_1200bps_touch : true ,
130- params_verbose : '-v'
131- }
132- } ;
133- daemon . upload ( target , data ) ;
134- }
135-
136134 render ( ) {
137135 const listSerialDevices = this . state . serialDevices . map ( ( device , i ) =>
138136 < li key = { i } >
@@ -219,9 +217,10 @@ class App extends React.Component {
219217 </ div >
220218
221219 < div className = "section" >
222- < button onClick = { this . handleUpload } disabled = { this . state . uploadStatus === UPLOAD_STATUS_IN_PROGRESS } > Upload Sketch</ button >
220+ < h2 > Upload a sample sketch on a MKR1000 at /dev/ttyACM0</ h2 >
221+ < button onClick = { handleUpload } disabled = { this . state . uploadStatus === UPLOAD_STATUS_IN_PROGRESS } > Upload Sketch</ button > < br />
223222 < div > Upload status: < span className = { uploadClass } > { this . state . uploadStatus } </ span > </ div >
224- < div > { this . state . ulploadError } </ div >
223+ < div > { this . state . uploadError } </ div >
225224 </ div >
226225 </ div >
227226 ) ;
0 commit comments