1+ //https://blockly-demo.appspot.com/static/demos/blockfactory_old/index.html#5ag74x
2+ var mainUrl = 'https://tutorials.webduino.io/zh-tw/docs/' ;
3+ var utmUrl = '?utm_source=cloud-blockly&utm_medium=contextMenu&utm_campaign=tutorials' ;
4+
5+ Blockly . Blocks [ 'lora_new' ] = {
6+ init : function ( ) {
7+ this . appendDummyInput ( )
8+ . appendField ( "LORA , Reset" )
9+ . appendField ( new Blockly . FieldDropdown ( [ [ "0" , "0" ] , [ "1" , "1" ] , [ "2" , "2" ] , [ "3" , "3" ] , [ "4" , "4" ] , [ "5" , "5" ] , [ "6" , "6" ] , [ "7" , "7" ] , [ "8" , "8" ] , [ "9" , "9" ] , [ "15" , "15" ] ] ) , "resetPin" )
10+ . appendField ( " Address" )
11+ . appendField ( new Blockly . FieldDropdown ( [ [ "0" , "0" ] , [ "1" , "1" ] , [ "2" , "2" ] , [ "3" , "3" ] , [ "4" , "4" ] , [ "5" , "5" ] , [ "6" , "6" ] , [ "7" , "7" ] , [ "8" , "8" ] , [ "9" , "9" ] , [ "15" , "15" ] ] ) , "address" ) ;
12+ this . setOutput ( true , null ) ;
13+ this . setColour ( 230 ) ;
14+ this . setTooltip ( '' ) ;
15+ this . setHelpUrl ( mainUrl + 'basic/index.html' + utmUrl ) ;
16+ }
17+ } ;
18+
19+ Blockly . Blocks [ 'lora_send' ] = {
20+ init : function ( ) {
21+ this . appendValueInput ( "data" )
22+ . setCheck ( null )
23+ . appendField ( new Blockly . FieldVariable ( "lora" ) , "lora" )
24+ . appendField ( Blockly . Msg . WEBDUINO_LORA_SEND_STRING ) ;
25+ this . setPreviousStatement ( true , null ) ;
26+ this . setNextStatement ( true , null ) ;
27+ this . setColour ( 65 ) ;
28+ this . setTooltip ( '' ) ;
29+ this . setHelpUrl ( mainUrl + 'basic/index.html' + utmUrl ) ;
30+ }
31+ } ;
32+
33+ //https://blockly-demo.appspot.com/static/demos/blockfactory_old/index.html#hv345s
34+ Blockly . Blocks [ 'lora_send_ack' ] = {
35+ init : function ( ) {
36+ this . appendValueInput ( "data" )
37+ . setCheck ( null )
38+ . appendField ( new Blockly . FieldVariable ( "lora" ) , "lora" )
39+ . appendField ( Blockly . Msg . WEBDUINO_LORA_SEND_STRING ) ;
40+ this . appendStatementInput ( "send_ok" )
41+ . setCheck ( null )
42+ . appendField ( Blockly . Msg . WEBDUINO_LORA_SUCCESS_CALLBACK )
43+ . setAlign ( Blockly . ALIGN_RIGHT ) ;
44+ this . appendStatementInput ( "send_failure" )
45+ . setCheck ( null )
46+ . appendField ( Blockly . Msg . WEBDUINO_LORA_FAIL_CALLBACK )
47+ . setAlign ( Blockly . ALIGN_RIGHT ) ;
48+ this . setPreviousStatement ( true , null ) ;
49+ this . setNextStatement ( true , null ) ;
50+ this . setColour ( 65 ) ;
51+ this . setTooltip ( '' ) ;
52+ this . setHelpUrl ( mainUrl + 'basic/index.html' + utmUrl ) ;
53+ }
54+ } ;
55+
56+ //https://blockly-demo.appspot.com/static/demos/blockfactory_old/index.html#t673pk
57+ Blockly . Blocks [ 'lora_recv_ack' ] = {
58+ init : function ( ) {
59+ this . appendStatementInput ( "recv_ok" )
60+ . setCheck ( null )
61+ . appendField ( new Blockly . FieldVariable ( "lora" ) , "lora" )
62+ . appendField ( Blockly . Msg . WEBDUINO_LORA_RECEIVE_CALLBACK ) ;
63+ this . setPreviousStatement ( true , null ) ;
64+ this . setNextStatement ( true , null ) ;
65+ this . setColour ( 65 ) ;
66+ this . setTooltip ( '' ) ;
67+ this . setHelpUrl ( mainUrl + 'basic/index.html' + utmUrl ) ;
68+ }
69+ } ;
70+
71+ //https://blockly-demo.appspot.com/static/demos/blockfactory_old/index.html#csh9m9
72+ Blockly . Blocks [ 'lora_recv_data' ] = {
73+ init : function ( ) {
74+ this . appendDummyInput ( )
75+ . appendField ( new Blockly . FieldVariable ( "lora" ) , "lora" )
76+ . appendField ( Blockly . Msg . WEBDUINO_LORA_RECEIVED_STRING ) ;
77+ this . setOutput ( true , null ) ;
78+ this . setColour ( 35 ) ;
79+ this . setTooltip ( '' ) ;
80+ this . setHelpUrl ( mainUrl + 'basic/index.html' + utmUrl ) ;
81+ }
82+ } ;
0 commit comments