File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 48
48
< form >
49
49
< input type ="text " name ="webrepl_url " id ="url " value ="ws://192.168.4.1:8266/ " />
50
50
< input type ="submit " id ="button " value ="Connect " onclick ="button_click(); return false; " />
51
+ < span id ="version "> </ span >
51
52
</ form >
52
53
< div id ="term ">
53
54
</ div >
88
89
var put_file_data = null ;
89
90
var get_file_name = null ;
90
91
var get_file_data = null ;
92
+ var version = null ;
91
93
92
94
function calculate_size ( win ) {
93
95
var cols = Math . max ( 80 , Math . min ( 150 , ( win . innerWidth - 280 ) / 7 ) ) | 0 ;
154
156
term . write ( '\x1b[31mWelcome to MicroPython!\x1b[m\r\n' ) ;
155
157
156
158
ws . onmessage = function ( event ) {
159
+ if ( version == undefined && typeof event . data == 'string' && event . data . indexOf ( 'WebREPL connected' ) > 0 ) {
160
+ get_ver ( ) ;
161
+ }
157
162
if ( event . data instanceof ArrayBuffer ) {
158
163
var data = new Uint8Array ( event . data ) ;
159
164
switch ( binary_state ) {
224
229
case 31 :
225
230
// first (and last) response for GET_VER
226
231
console . log ( 'GET_VER' , data ) ;
232
+ version = data . join ( '.' ) ;
233
+ document . getElementById ( 'version' ) . innerText = 'MicroPython ' + version ;
227
234
binary_state = 0 ;
228
235
break ;
229
236
}
You can’t perform that action at this time.
0 commit comments