chao 10 tháng trước cách đây
mục cha
commit
9faa7d7500
4 tập tin đã thay đổi với 14 bổ sung64 xóa
  1. 6 6
      blockly/blocks/python/extension_module.js
  2. 0 9
      index.html
  3. 1 42
      index.js
  4. 7 7
      src/python/扩展/呼吸灯.xml

+ 6 - 6
blockly/blocks/python/extension_module.js

@@ -1945,8 +1945,8 @@ STRIP${value_io}.setBrightness(${value_brightness})`, true);
 
     for i in range(num1-1,num2+1):
         STRIP${value_io}.setRgbSerialColor(i-1 ,LEDCOLOR[0],LEDCOLOR[1],LEDCOLOR[2])
-        STRIP${value_io}.rgbSerialShow()
-        time.sleep(0.01)
+    STRIP${value_io}.rgbSerialShow()
+    time.sleep(0.01)
 `,true)
     var code = `LEDSTRIPSHOW(${value_color},${location},${location1},${value_brightness})\n`
 
@@ -2001,8 +2001,8 @@ STRIP${value_io}.setBrightness(${value_brightness})`, true);
     
     for i in range(num1-1,num2+1):
         STRIP${value_io}.setRgbSerialColor(i-1 ,LEDCOLOR[0],LEDCOLOR[1],LEDCOLOR[2])
-        STRIP${value_io}.rgbSerialShow()
-        time.sleep(0.01)
+    STRIP${value_io}.rgbSerialShow()
+    time.sleep(0.01)
 `,true)
     var code = `LEDSTRIPSHOW(${value_color},1,10,${value_brightness})\n`
 
@@ -2040,8 +2040,8 @@ STRIPOFF${value_io}.setBrightness(0)`, true);
     for i in range(10):
         
         STRIPOFF${value_io}.setRgbSerialColor(i ,LEDCOLOR[0],LEDCOLOR[1],LEDCOLOR[2])
-        STRIPOFF${value_io}.rgbSerialShow()
-        time.sleep(0.01)
+    STRIPOFF${value_io}.rgbSerialShow()
+    time.sleep(0.01)    
 `,true)
     var code = `LEDSTRIPSHOWOFF((0,0,0))\n`;
     return code;

+ 0 - 9
index.html

@@ -957,15 +957,6 @@
                                                 class="material-icons sketch_name_icon hidden">wifi</i>
                                         </a>
 
-                                        <div class="editDiv" id="SwitchConnect" style="display: inline-block;">
-                                            <input type="checkbox" id="toggle-button-Connect">
-                                            <!--label中的for跟input的id绑定。作用是在点击label时选中input或者取消选中input-->
-                                            <label for="toggle-button-Connect" class="button-label">
-                                                <span class="circle circle_text"></span>
-                                                <span class="text on"></span>
-                                                <span class="text off"></span>
-                                            </label>
-                                        </div>
                                         <a href="javascript:;" id="updatePython" class="modal-trigger header-link"
                                             style="display: none;">
                                             <img src="./icons/加载.png">

+ 1 - 42
index.js

@@ -323,22 +323,6 @@ window.onload = async function () {
       // $('.translatable_close_editing')[0].style.display = "none"
     }
   })
-  // toggle-button-Connect
-
-  $('#toggle-button-Connect').click(() => {
-    console.log($('#toggle-button-Connect')[0].checked)
-    if ($('#toggle-button-Connect')[0].checked) {
-      // $("#toggle-button-Connect")[0].checked = true
-      localStorage.setItem("SwitchConnect", true)
-      switch_connect = true
-      $('.circle_text')[0].innerText = _lang == "zh-hans" ? "自动" : _lang == "zh-hant" ? "自動" : "AT"
-    } else {
-      // $("#toggle-button-Connect")[0].checked = false
-      localStorage.setItem("SwitchConnect", false)
-      switch_connect = false
-      $('.circle_text')[0].innerText = _lang == "zh-hans" ? "手动" : _lang == "zh-hant" ? "手動" : "MT"
-    }
-  })
   $('#toggle-button1').click(() => {
     if ($('#toggle-button1')[0].checked) {
       $('#image_transmission_canvas')[0].style.display = 'none';
@@ -482,16 +466,7 @@ window.onload = async function () {
 
   // 点击复制分享链接
   copyShare()
-  // 监听本地存储中是否自动连接
-  if (localStorage.getItem("SwitchConnect") == "true" || localStorage.getItem("SwitchConnect") == null) {
-    $("#toggle-button-Connect")[0].checked = true
-    switch_connect = true
-    $('.circle_text')[0].innerText = _lang == "zh-hans" ? "自动" : _lang == "zh-hant" ? "自動" : "AT"
-  } else {
-    $("#toggle-button-Connect")[0].checked = false
-    switch_connect = false
-    $('.circle_text')[0].innerText = _lang == "zh-hans" ? "手动" : _lang == "zh-hant" ? "手動" : "MT"
-  }
+
   window.file_manger_modal = true
   document.getElementById("webadb_iframe").onload = function () {
     setInterval(function () {
@@ -971,7 +946,6 @@ function selectOnload() {
     if (a == 0) {
       $('#Serial_Interaction').css("display", 'inline-block')
       $('#IP').css('display', 'none')
-      $("#SwitchConnect").css('display', 'inline-block')
     } else if (a == 2) {
       // console.log("蓝牙")webadb_add
       // deviceType = 2
@@ -982,7 +956,6 @@ function selectOnload() {
       // deviceType = 1
       $('#Serial_Interaction').css("display", 'none')
       $('#IP').css('display', 'block')
-      $("#SwitchConnect").css('display', 'none')
       // 进行socket 连接
 
     }
@@ -2658,20 +2631,6 @@ function bluetoothRun() {
   })
 }
 
-var switch_connect = false
-// 切换是否自动连接
-function SwitchConnect() {
-  console.log($("#SwitchConnectInput")[0].checked)
-  if ($("#SwitchConnectInput")[0].checked) {
-    $("#SwitchConnectInput")[0].checked = true
-    localStorage.setItem("SwitchConnect", true)
-    switch_connect = true
-  } else {
-    $("#SwitchConnectInput")[0].checked = false
-    localStorage.setItem("SwitchConnect", false)
-    switch_connect = false
-  }
-}
 var getBlocksByTypeName = function (typeName) {
   var blocks = blockpy.components.editor.getBlocksFromXml().getElementsByTagName("block"); // 获取工作区中的所有块
   var filteredBlocks = [];

+ 7 - 7
src/python/扩展/呼吸灯.xml

@@ -39,6 +39,9 @@
                       <shadow type="math_number" id="tk|,4K:JHwO?|EcuV{J6">
                         <field name="NUM">255</field>
                       </shadow>
+                      <block type="variables_get" id="$R)0[Ip78i]`om)K:mt_">
+                        <field name="VAR">j</field>
+                      </block>
                     </value>
                     <value name="rgb_value_b">
                       <shadow type="math_number" id="hB{DT^16i|EXJg4TlX*D">
@@ -48,12 +51,9 @@
                   </block>
                 </value>
                 <value name="brightness">
-                  <shadow type="math_number" id="H*3ZDEv[pjIq5;brl{Z*">
+                  <shadow type="math_number" id="v^n:adFc-sdhGHL4HV#[">
                     <field name="NUM">50</field>
                   </shadow>
-                  <block type="variables_get" id="$R)0[Ip78i]`om)K:mt_">
-                    <field name="VAR">j</field>
-                  </block>
                 </value>
               </block>
             </next>
@@ -105,6 +105,9 @@
                               <shadow type="math_number" id="JFxCD-J0yK;*XYU`7AdS">
                                 <field name="NUM">255</field>
                               </shadow>
+                              <block type="variables_get" id="@~ng^nsx_Z96tM6:`U$t">
+                                <field name="VAR">k</field>
+                              </block>
                             </value>
                             <value name="rgb_value_b">
                               <shadow type="math_number" id="_?dCEiKog5zx=R`zTA1^">
@@ -117,9 +120,6 @@
                           <shadow type="math_number" id="H*3ZDEv[pjIq5;brl{Z*">
                             <field name="NUM">50</field>
                           </shadow>
-                          <block type="variables_get" id="@~ng^nsx_Z96tM6:`U$t">
-                            <field name="VAR">k</field>
-                          </block>
                         </value>
                       </block>
                     </next>