@johnnycubides/micropython-esp32-plugin-catalejo-editor 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +3 -0
  2. package/micropython-esp32/README.md +3 -0
  3. package/micropython-esp32/commands.d.ts +3 -3
  4. package/micropython-esp32/esp32-libs/esp32-c3-mini/boot.py +14 -0
  5. package/micropython-esp32/esp32-libs/esp32-c3-mini/webrepl_cfg.py +1 -0
  6. package/micropython-esp32/esp32-libs/esp32-c3-mini/wifi.py +135 -0
  7. package/micropython-esp32/esp32-libs/esp32-c3-mini/wifi_config.py +11 -0
  8. package/micropython-esp32/esp32-libs/esp32-c3-oled-mini/boot.py +14 -0
  9. package/micropython-esp32/esp32-libs/esp32-c3-oled-mini/display.py +67 -0
  10. package/micropython-esp32/esp32-libs/esp32-c3-oled-mini/ssd1306.py +164 -0
  11. package/micropython-esp32/esp32-libs/esp32-c3-oled-mini/webrepl_cfg.py +1 -0
  12. package/micropython-esp32/esp32-libs/esp32-c3-oled-mini/wifi.py +135 -0
  13. package/micropython-esp32/esp32-libs/esp32-c3-oled-mini/wifi_config.py +11 -0
  14. package/micropython-esp32/esp32-libs/esp32-s3-zero/boot.py +14 -0
  15. package/micropython-esp32/esp32-libs/esp32-s3-zero/webrepl_cfg.py +1 -0
  16. package/micropython-esp32/esp32-libs/esp32-s3-zero/wifi.py +135 -0
  17. package/micropython-esp32/esp32-libs/esp32-s3-zero/wifi_config.py +11 -0
  18. package/micropython-esp32/esp32-libs/esp32-wroom-devkit/boot.py +14 -0
  19. package/micropython-esp32/esp32-libs/esp32-wroom-devkit/webrepl_cfg.py +1 -0
  20. package/micropython-esp32/esp32-libs/esp32-wroom-devkit/wifi.py +135 -0
  21. package/micropython-esp32/esp32-libs/esp32-wroom-devkit/wifi_config.py +11 -0
  22. package/micropython-esp32/lang.d.ts +60 -1
  23. package/micropython-esp32/micropython.es.js +330 -178
  24. package/micropython-esp32/micropython.umd.js +14 -14
  25. package/micropython-esp32/plugin.json +1 -1
  26. package/micropython-esp32/upy-websockect.d.ts +30 -2
  27. package/package.json +1 -1
  28. package/micropython-esp32/esp32-libs/boot.py +0 -13
  29. package/micropython-esp32/esp32-libs/wifi.py +0 -77
  30. package/micropython-esp32/esp32-libs/wifi_config_esp32c3mini.py +0 -14
@@ -1,8 +1,11 @@
1
- const N = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20fill='%23000000'%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20id='Layer_1'%20data-name='Layer%201'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M24,12A12,12,0,0,1,0,12a1,1,0,0,1,2,0A10,10,0,1,0,12,2a1,1,0,0,1,0-2A12.013,12.013,0,0,1,24,12ZM10.277,11H8a1,1,0,0,0,0,2h2.277A1.994,1.994,0,1,0,13,10.277V7a1,1,0,0,0-2,0v3.277A2,2,0,0,0,10.277,11ZM1.827,8.784a1,1,0,1,0-1-1A1,1,0,0,0,1.827,8.784ZM4.221,5.207a1,1,0,1,0-1-1A1,1,0,0,0,4.221,5.207ZM7.779,2.841a1,1,0,1,0-1-1A1,1,0,0,0,7.779,2.841Z'/%3e%3c/svg%3e";
2
- function I(e, t) {
1
+ var H = Object.defineProperty;
2
+ var U = (e, t, i) => t in e ? H(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
3
+ var _ = (e, t, i) => U(e, typeof t != "symbol" ? t + "" : t, i);
4
+ const W = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20fill='%23000000'%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20id='Layer_1'%20data-name='Layer%201'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M24,12A12,12,0,0,1,0,12a1,1,0,0,1,2,0A10,10,0,1,0,12,2a1,1,0,0,1,0-2A12.013,12.013,0,0,1,24,12ZM10.277,11H8a1,1,0,0,0,0,2h2.277A1.994,1.994,0,1,0,13,10.277V7a1,1,0,0,0-2,0v3.277A2,2,0,0,0,10.277,11ZM1.827,8.784a1,1,0,1,0-1-1A1,1,0,0,0,1.827,8.784ZM4.221,5.207a1,1,0,1,0-1-1A1,1,0,0,0,4.221,5.207ZM7.779,2.841a1,1,0,1,0-1-1A1,1,0,0,0,7.779,2.841Z'/%3e%3c/svg%3e";
5
+ function X(e, t) {
3
6
  e.Blocks.mpy_sleep_s = {
4
7
  init: function() {
5
- this.appendValueInput("time").setCheck("Number").appendField(new e.FieldImage(N, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Esperar").appendField(new e.FieldDropdown([["segundos", "sec"], ["milisegundos", "ms"], ["microsegundos", "us"]]), "scale"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(65), this.setTooltip("Se indica el tiempo que la CPU tendrá que esperar antes de hacer la siguiente instrucción."), this.setHelpUrl("");
8
+ this.appendValueInput("time").setCheck("Number").appendField(new e.FieldImage(W, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Esperar").appendField(new e.FieldDropdown([["segundos", "sec"], ["milisegundos", "ms"], ["microsegundos", "us"]]), "scale"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(65), this.setTooltip("Se indica el tiempo que la CPU tendrá que esperar antes de hacer la siguiente instrucción."), this.setHelpUrl("");
6
9
  }
7
10
  }, t.mpy_sleep_s = function(i) {
8
11
  var n = t.valueToCode(i, "time", t.ORDER_ATOMIC), a = i.getFieldValue("scale");
@@ -15,21 +18,21 @@ function I(e, t) {
15
18
  `), o;
16
19
  };
17
20
  }
18
- const y = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20fill='%23000000'%20height='800px'%20width='800px'%20version='1.1'%20id='Capa_1'%20viewBox='0%200%20287.542%20287.542'%20xml:space='preserve'%20sodipodi:docname='plug-svgrepo-com.svg'%20inkscape:version='1.2.2%20(b0a8486541,%202022-12-01)'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3cdefs%20id='defs7'%20/%3e%3csodipodi:namedview%20id='namedview5'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20showgrid='false'%20inkscape:zoom='0.295'%20inkscape:cx='400'%20inkscape:cy='401.69492'%20inkscape:window-width='1918'%20inkscape:window-height='1150'%20inkscape:window-x='1440'%20inkscape:window-y='24'%20inkscape:window-maximized='1'%20inkscape:current-layer='Capa_1'%20/%3e%3cpath%20d='M258.47,8v14.399c0,1.989-0.602,3.896-2.008,5.304l-70.586,70.691l3.675,3.633c2.813,2.813,4.414,6.628,4.414,10.606%20s-1.57,7.794-4.383,10.606l-54.715,54.72c-2.929,2.929-6.766,4.394-10.604,4.394c-2.708,0-5.408-0.744-7.797-2.202l-34.963,34.964%20c-2.929,2.929-6.767,4.394-10.606,4.394s-7.678-1.465-10.606-4.394l-1.707-1.708l-5.378,5.378%20c-5.89,5.889-9.133,13.718-9.133,22.046s3.243,16.158,9.133,22.047l0.553,0.553c12.155,12.157,31.935,12.157,44.094,0l71.408-71.41%20c18.007-18.004,47.303-18.004,65.308,0l19.861,19.861c2.929,2.93,2.929,7.678,0,10.607c-2.93,2.928-7.678,2.928-10.607,0%20l-19.861-19.861c-12.156-12.157-31.936-12.157-44.094,0l-71.408,71.41c-9.002,9.001-20.83,13.502-32.654,13.503%20c-11.827,0.001-23.649-4.5-32.653-13.503l-0.553-0.553c-8.722-8.723-13.525-20.319-13.525-32.654s4.804-23.932,13.526-32.653%20l5.378-5.378l-4.574-4.574c-5.858-5.857-5.858-15.356,0-21.214l34.964-34.965c-3.524-5.774-2.804-13.412,2.192-18.407l54.72-54.726%20c2.813-2.813,6.628-4.404,10.606-4.404s7.794,1.558,10.606,4.372l4.309,4.265L231.49,2.369C232.897,0.963,234.805,0,236.794,0%20h14.399c1.997,0,3.9,0.97,5.308,2.386l-0.024,0.327C257.874,4.118,258.47,6.019,258.47,8z'%20id='path2'%20style='fill:%23ffffff;stroke:%23000000'%20/%3e%3c/svg%3e";
19
- function V(e, t) {
21
+ const b = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20fill='%23000000'%20height='800px'%20width='800px'%20version='1.1'%20id='Capa_1'%20viewBox='0%200%20287.542%20287.542'%20xml:space='preserve'%20sodipodi:docname='plug-svgrepo-com.svg'%20inkscape:version='1.2.2%20(b0a8486541,%202022-12-01)'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3cdefs%20id='defs7'%20/%3e%3csodipodi:namedview%20id='namedview5'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20showgrid='false'%20inkscape:zoom='0.295'%20inkscape:cx='400'%20inkscape:cy='401.69492'%20inkscape:window-width='1918'%20inkscape:window-height='1150'%20inkscape:window-x='1440'%20inkscape:window-y='24'%20inkscape:window-maximized='1'%20inkscape:current-layer='Capa_1'%20/%3e%3cpath%20d='M258.47,8v14.399c0,1.989-0.602,3.896-2.008,5.304l-70.586,70.691l3.675,3.633c2.813,2.813,4.414,6.628,4.414,10.606%20s-1.57,7.794-4.383,10.606l-54.715,54.72c-2.929,2.929-6.766,4.394-10.604,4.394c-2.708,0-5.408-0.744-7.797-2.202l-34.963,34.964%20c-2.929,2.929-6.767,4.394-10.606,4.394s-7.678-1.465-10.606-4.394l-1.707-1.708l-5.378,5.378%20c-5.89,5.889-9.133,13.718-9.133,22.046s3.243,16.158,9.133,22.047l0.553,0.553c12.155,12.157,31.935,12.157,44.094,0l71.408-71.41%20c18.007-18.004,47.303-18.004,65.308,0l19.861,19.861c2.929,2.93,2.929,7.678,0,10.607c-2.93,2.928-7.678,2.928-10.607,0%20l-19.861-19.861c-12.156-12.157-31.936-12.157-44.094,0l-71.408,71.41c-9.002,9.001-20.83,13.502-32.654,13.503%20c-11.827,0.001-23.649-4.5-32.653-13.503l-0.553-0.553c-8.722-8.723-13.525-20.319-13.525-32.654s4.804-23.932,13.526-32.653%20l5.378-5.378l-4.574-4.574c-5.858-5.857-5.858-15.356,0-21.214l34.964-34.965c-3.524-5.774-2.804-13.412,2.192-18.407l54.72-54.726%20c2.813-2.813,6.628-4.404,10.606-4.404s7.794,1.558,10.606,4.372l4.309,4.265L231.49,2.369C232.897,0.963,234.805,0,236.794,0%20h14.399c1.997,0,3.9,0.97,5.308,2.386l-0.024,0.327C257.874,4.118,258.47,6.019,258.47,8z'%20id='path2'%20style='fill:%23ffffff;stroke:%23000000'%20/%3e%3c/svg%3e";
22
+ function G(e, t) {
20
23
  e.Blocks.mpy_esp32_pin_mode_explicit = {
21
24
  init: function() {
22
- this.appendValueInput("pin_number").setCheck("Number").setAlign(e.ALIGN_CENTRE).appendField(new e.FieldImage(y, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Crear GPIO").appendField(new e.FieldVariable("item"), "name").appendField(", Modo:").appendField(new e.FieldDropdown([["Entrada", "Pin.IN"], ["Salida", "Pin.OUT"], ["Análogo", "Pin.ANALOG"]]), "pin_mode").appendField("Pin:"), this.setInputsInline(!1), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(210), this.setTooltip('Crear un GPIO, remplazar "item" por el nombre que le dese poner, ejemplo LED, botón, etc. Selecciona el modo del pin. Si selecciona Entrada, el pin se comportará como una entra digital, Salida, salida Digital, Analog, como pin Analógico'), this.setHelpUrl("");
25
+ this.appendValueInput("pin_number").setCheck("Number").setAlign(e.ALIGN_CENTRE).appendField(new e.FieldImage(b, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Crear GPIO").appendField(new e.FieldVariable("item"), "name").appendField(", Modo:").appendField(new e.FieldDropdown([["Entrada", "Pin.IN"], ["Salida", "Pin.OUT"], ["Análogo", "Pin.ANALOG"]]), "pin_mode").appendField("Pin:"), this.setInputsInline(!1), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(210), this.setTooltip('Crear un GPIO, remplazar "item" por el nombre que le dese poner, ejemplo LED, botón, etc. Selecciona el modo del pin. Si selecciona Entrada, el pin se comportará como una entra digital, Salida, salida Digital, Analog, como pin Analógico'), this.setHelpUrl("");
23
26
  }
24
27
  }, t.mpy_esp32_pin_mode_explicit = function(i) {
25
28
  var n = t.nameDB_.getName(i.getFieldValue("name"), e.Variables.CATEGORY_NAME), a = i.getFieldValue("pin_mode"), o = t.valueToCode(i, "pin_number", t.ORDER_ATOMIC);
26
29
  t.definitions_.machine_import_pin || (t.definitions_.machine_import_pin = "from machine import Pin");
27
- var d = n + " = Pin(" + o + ", " + a + `)
30
+ var s = n + " = Pin(" + o + ", " + a + `)
28
31
  `;
29
- return d;
32
+ return s;
30
33
  }, e.Blocks.mpy_esp32_pin_mode = {
31
34
  init: function() {
32
- this.appendValueInput("pin_number").setCheck("Number").setAlign(e.ALIGN_CENTRE).appendField(new e.FieldImage(y, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Modo:").appendField(new e.FieldDropdown([["Entrada", "Pin.IN"], ["Salida", "Pin.OUT"], ["Análogo", "Pin.ANALOG"]]), "pin_mode").appendField("Pin:"), this.setInputsInline(!1), this.setOutput(!0, null), this.setColour(210), this.setTooltip("Selecciona el modo del pin. Si selecciona Entrada, el pin se comportará como una entra digital, Salida, salida Digital, Analog, como pin Analógico"), this.setHelpUrl("");
35
+ this.appendValueInput("pin_number").setCheck("Number").setAlign(e.ALIGN_CENTRE).appendField(new e.FieldImage(b, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Modo:").appendField(new e.FieldDropdown([["Entrada", "Pin.IN"], ["Salida", "Pin.OUT"], ["Análogo", "Pin.ANALOG"]]), "pin_mode").appendField("Pin:"), this.setInputsInline(!1), this.setOutput(!0, null), this.setColour(210), this.setTooltip("Selecciona el modo del pin. Si selecciona Entrada, el pin se comportará como una entra digital, Salida, salida Digital, Analog, como pin Analógico"), this.setHelpUrl("");
33
36
  }
34
37
  }, t.mpy_esp32_pin_mode = function(i) {
35
38
  var n = i.getFieldValue("pin_mode"), a = t.valueToCode(i, "pin_number", t.ORDER_ATOMIC);
@@ -38,7 +41,7 @@ function V(e, t) {
38
41
  return [o, t.ORDER_NONE];
39
42
  }, e.Blocks.mpy_esp32_pin_read = {
40
43
  init: function() {
41
- this.appendDummyInput().setAlign(e.ALIGN_CENTRE).appendField(new e.FieldImage(y, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Leer 0/1").appendField(new e.FieldVariable("item"), "pin_var"), this.setInputsInline(!0), this.setOutput(!0, null), this.setColour(210), this.setTooltip("Lee el valor del pin digital, lo cual devuelve como resultado un 1 o 0 lógico"), this.setHelpUrl("");
44
+ this.appendDummyInput().setAlign(e.ALIGN_CENTRE).appendField(new e.FieldImage(b, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Leer 0/1").appendField(new e.FieldVariable("item"), "pin_var"), this.setInputsInline(!0), this.setOutput(!0, null), this.setColour(210), this.setTooltip("Lee el valor del pin digital, lo cual devuelve como resultado un 1 o 0 lógico"), this.setHelpUrl("");
42
45
  }
43
46
  }, t.mpy_esp32_pin_read = function(i) {
44
47
  var n = t.nameDB_.getName(i.getFieldValue("pin_var"), e.Variables.CATEGORY_NAME);
@@ -47,7 +50,7 @@ function V(e, t) {
47
50
  return [a, t.ORDER_NONE];
48
51
  }, e.Blocks.mpy_esp32_pin_write = {
49
52
  init: function() {
50
- this.appendValueInput("pin_value").setCheck("Number").appendField(new e.FieldImage(y, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Escribir").appendField(new e.FieldVariable("item"), "pin_var").appendField("a 0/1"), this.setInputsInline(!1), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(210), this.setTooltip("Escribir el valor de salida de un pin, los valores posibles son 1 o 0 lógico"), this.setHelpUrl("");
53
+ this.appendValueInput("pin_value").setCheck("Number").appendField(new e.FieldImage(b, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Escribir").appendField(new e.FieldVariable("item"), "pin_var").appendField("a 0/1"), this.setInputsInline(!1), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(210), this.setTooltip("Escribir el valor de salida de un pin, los valores posibles son 1 o 0 lógico"), this.setHelpUrl("");
51
54
  }
52
55
  }, t.mpy_esp32_pin_write = function(i) {
53
56
  var n = t.nameDB_.getName(i.getFieldValue("pin_var"), e.Variables.CATEGORY_NAME), a = t.valueToCode(i, "pin_value", t.ORDER_ATOMIC);
@@ -57,11 +60,11 @@ function V(e, t) {
57
60
  return o;
58
61
  };
59
62
  }
60
- const _ = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!--%20Created%20with%20Inkscape%20(http://www.inkscape.org/)%20--%3e%3csvg%20width='80mm'%20height='80mm'%20viewBox='0%200%2080%2080'%20version='1.1'%20id='svg5'%20sodipodi:docname='adc.svg'%20inkscape:version='1.2.2%20(b0a8486541,%202022-12-01)'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3csodipodi:namedview%20id='namedview7'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20inkscape:document-units='mm'%20showgrid='true'%20inkscape:zoom='2.8284272'%20inkscape:cx='118.97071'%20inkscape:cy='143.01234'%20inkscape:window-width='1918'%20inkscape:window-height='1150'%20inkscape:window-x='1440'%20inkscape:window-y='24'%20inkscape:window-maximized='1'%20inkscape:current-layer='layer1'%3e%3cinkscape:grid%20type='xygrid'%20id='grid483'%20/%3e%3c/sodipodi:namedview%3e%3cdefs%20id='defs2'%20/%3e%3cg%20inkscape:label='Layer%201'%20inkscape:groupmode='layer'%20id='layer1'%3e%3cpath%20style='fill:none;stroke:%23000000;stroke-width:10;stroke-dasharray:none'%20d='M%207.9185622,40.195018%20C%2017.631127,10.282868%2027.506005,-14.748985%2041.621293,39.908944%2061.152028,102.40339%2066.055646,62.159434%2073.289058,40.202455'%20id='path113'%20sodipodi:nodetypes='ccc'%20/%3e%3cpath%20style='fill:none;stroke:%23000000;stroke-width:5;stroke-dasharray:20,5;stroke-dashoffset:0'%20d='M%201.2772021,39.941328%2079.018925,39.898992'%20id='path1020'%20/%3e%3cpath%20style='fill:none;stroke:%23000000;stroke-width:5;stroke-dasharray:20,5;stroke-dashoffset:0'%20d='M%203.8172185,1.6052225%203.8928693,78.585751'%20id='path1057'%20/%3e%3c/g%3e%3c/svg%3e";
61
- function M(e, t) {
63
+ const f = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!--%20Created%20with%20Inkscape%20(http://www.inkscape.org/)%20--%3e%3csvg%20width='80mm'%20height='80mm'%20viewBox='0%200%2080%2080'%20version='1.1'%20id='svg5'%20sodipodi:docname='adc.svg'%20inkscape:version='1.2.2%20(b0a8486541,%202022-12-01)'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3csodipodi:namedview%20id='namedview7'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20inkscape:document-units='mm'%20showgrid='true'%20inkscape:zoom='2.8284272'%20inkscape:cx='118.97071'%20inkscape:cy='143.01234'%20inkscape:window-width='1918'%20inkscape:window-height='1150'%20inkscape:window-x='1440'%20inkscape:window-y='24'%20inkscape:window-maximized='1'%20inkscape:current-layer='layer1'%3e%3cinkscape:grid%20type='xygrid'%20id='grid483'%20/%3e%3c/sodipodi:namedview%3e%3cdefs%20id='defs2'%20/%3e%3cg%20inkscape:label='Layer%201'%20inkscape:groupmode='layer'%20id='layer1'%3e%3cpath%20style='fill:none;stroke:%23000000;stroke-width:10;stroke-dasharray:none'%20d='M%207.9185622,40.195018%20C%2017.631127,10.282868%2027.506005,-14.748985%2041.621293,39.908944%2061.152028,102.40339%2066.055646,62.159434%2073.289058,40.202455'%20id='path113'%20sodipodi:nodetypes='ccc'%20/%3e%3cpath%20style='fill:none;stroke:%23000000;stroke-width:5;stroke-dasharray:20,5;stroke-dashoffset:0'%20d='M%201.2772021,39.941328%2079.018925,39.898992'%20id='path1020'%20/%3e%3cpath%20style='fill:none;stroke:%23000000;stroke-width:5;stroke-dasharray:20,5;stroke-dashoffset:0'%20d='M%203.8172185,1.6052225%203.8928693,78.585751'%20id='path1057'%20/%3e%3c/g%3e%3c/svg%3e";
64
+ function K(e, t) {
62
65
  e.Blocks.adc_minimal_class = {
63
66
  init: function() {
64
- this.appendValueInput("id_pin").setCheck("Number").appendField(new e.FieldImage(_, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Crear ADC, Pin:"), this.setOutput(!0, null), this.setColour(120), this.setTooltip("Crear canal del conversor ADC, se debe seleccionar un id pin con esta caracteristica del driver ADC. Los valores de entrada de voltaje están en el rango de 0 voltios a 3 voltios"), this.setHelpUrl("");
67
+ this.appendValueInput("id_pin").setCheck("Number").appendField(new e.FieldImage(f, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Crear ADC, Pin:"), this.setOutput(!0, null), this.setColour(120), this.setTooltip("Crear canal del conversor ADC, se debe seleccionar un id pin con esta caracteristica del driver ADC. Los valores de entrada de voltaje están en el rango de 0 voltios a 3 voltios"), this.setHelpUrl("");
65
68
  }
66
69
  }, t.adc_minimal_class = function(i) {
67
70
  var n = t.valueToCode(i, "id_pin", t.ORDER_ATOMIC);
@@ -70,7 +73,7 @@ function M(e, t) {
70
73
  return [a, t.ORDER_NONE];
71
74
  }, e.Blocks.adc_minimal_class_explicit = {
72
75
  init: function() {
73
- this.appendValueInput("id_pin").setCheck("Number").appendField(new e.FieldImage(_, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Crear ADC:").appendField(new e.FieldVariable("item"), "name").appendField(", Pin:"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(120), this.setTooltip("Crear canal del conversor ADC, se debe seleccionar un id pin con esta caracteristica del driver ADC. Los valores de entrada de voltaje están en el rango de 0 voltios a 3 voltios"), this.setHelpUrl("");
76
+ this.appendValueInput("id_pin").setCheck("Number").appendField(new e.FieldImage(f, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Crear ADC:").appendField(new e.FieldVariable("item"), "name").appendField(", Pin:"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(120), this.setTooltip("Crear canal del conversor ADC, se debe seleccionar un id pin con esta caracteristica del driver ADC. Los valores de entrada de voltaje están en el rango de 0 voltios a 3 voltios"), this.setHelpUrl("");
74
77
  }
75
78
  }, t.adc_minimal_class_explicit = function(i) {
76
79
  var n = t.nameDB_.getName(i.getFieldValue("name"), e.Variables.CATEGORY_NAME), a = t.valueToCode(i, "id_pin", t.ORDER_ATOMIC);
@@ -80,7 +83,7 @@ function M(e, t) {
80
83
  return o;
81
84
  }, e.Blocks.adc_minimal_read = {
82
85
  init: function() {
83
- this.appendDummyInput().appendField(new e.FieldImage(_, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Leer ADC, en:").appendField(new e.FieldVariable("item"), "adc_obj"), this.setInputsInline(!1), this.setOutput(!0, "Number"), this.setColour(120), this.setTooltip("Convierte un valor de voltaje entre [0, 3] a [0, 4095] unidades enteras (12bits), debe seleccionar la variable que representa el pin del canal ADC."), this.setHelpUrl("");
86
+ this.appendDummyInput().appendField(new e.FieldImage(f, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Leer ADC, en:").appendField(new e.FieldVariable("item"), "adc_obj"), this.setInputsInline(!1), this.setOutput(!0, "Number"), this.setColour(120), this.setTooltip("Convierte un valor de voltaje entre [0, 3] a [0, 4095] unidades enteras (12bits), debe seleccionar la variable que representa el pin del canal ADC."), this.setHelpUrl("");
84
87
  }
85
88
  }, t.adc_minimal_read = function(i) {
86
89
  var n = t.nameDB_.getName(i.getFieldValue("adc_obj"), e.Variables.CATEGORY_NAME);
@@ -89,7 +92,7 @@ function M(e, t) {
89
92
  return [a, t.ORDER_NONE];
90
93
  }, e.Blocks.adc_atten_class = {
91
94
  init: function() {
92
- this.appendValueInput("id_pin").setCheck("Number").appendField(new e.FieldImage(_, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Crear ADC, atenuación:").appendField(new e.FieldDropdown([["0dB", "ADC.ATTN_0DB"], ["2.5dB", "ADC.ATTN_2_5DB"], ["6dB", "ADC.ATTN_6DB"], ["11dB", "ADC.ATTN_11DB"]]), "atten").appendField(", Pin:"), this.setOutput(!0, "Number"), this.setColour(120), this.setTooltip("Crear canal del conversor ADC, se debe seleccionar un id pin con esta caracteristica del driver ADC, se puede seleccionar diferentes atenuaciones; 0dB -> (100mV - 950mV), 2.5dB -> (100mV - 1250 mV), 6dB -> (150mV - 1750 mV), 11dB -> (150mV - 2450mV)."), this.setHelpUrl("");
95
+ this.appendValueInput("id_pin").setCheck("Number").appendField(new e.FieldImage(f, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Crear ADC, atenuación:").appendField(new e.FieldDropdown([["0dB", "ADC.ATTN_0DB"], ["2.5dB", "ADC.ATTN_2_5DB"], ["6dB", "ADC.ATTN_6DB"], ["11dB", "ADC.ATTN_11DB"]]), "atten").appendField(", Pin:"), this.setOutput(!0, "Number"), this.setColour(120), this.setTooltip("Crear canal del conversor ADC, se debe seleccionar un id pin con esta caracteristica del driver ADC, se puede seleccionar diferentes atenuaciones; 0dB -> (100mV - 950mV), 2.5dB -> (100mV - 1250 mV), 6dB -> (150mV - 1750 mV), 11dB -> (150mV - 2450mV)."), this.setHelpUrl("");
93
96
  }
94
97
  }, t.adc_atten_class = function(i) {
95
98
  var n = i.getFieldValue("atten"), a = t.valueToCode(i, "id_pin", t.ORDER_ATOMIC);
@@ -98,7 +101,7 @@ function M(e, t) {
98
101
  return [o, t.ORDER_NONE];
99
102
  }, e.Blocks.adc_resolution_select_read = {
100
103
  init: function() {
101
- this.appendDummyInput().appendField(new e.FieldImage(_, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Leer ADC en").appendField(new e.FieldVariable("item"), "adc_obj").appendField(", resolución").appendField(new e.FieldDropdown([["12bits", "read()"], ["16bits", "read_u16()"], ["microvoltios", "read_uv()"]]), "resolution"), this.setInputsInline(!1), this.setOutput(!0, "Number"), this.setColour(120), this.setTooltip("Convierte un valor de voltaje a unidades (ADC). Se debe seleccionar la resolución: 12bits -> (0, 4095), 16 bits -> (0, 65535), microvoltios. debe seleccionar la variable que representa el pin del canal de ADC."), this.setHelpUrl("");
104
+ this.appendDummyInput().appendField(new e.FieldImage(f, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Leer ADC en").appendField(new e.FieldVariable("item"), "adc_obj").appendField(", resolución").appendField(new e.FieldDropdown([["12bits", "read()"], ["16bits", "read_u16()"], ["microvoltios", "read_uv()"]]), "resolution"), this.setInputsInline(!1), this.setOutput(!0, "Number"), this.setColour(120), this.setTooltip("Convierte un valor de voltaje a unidades (ADC). Se debe seleccionar la resolución: 12bits -> (0, 4095), 16 bits -> (0, 65535), microvoltios. debe seleccionar la variable que representa el pin del canal de ADC."), this.setHelpUrl("");
102
105
  }
103
106
  }, t.adc_resolution_select_read = function(i) {
104
107
  var n = t.nameDB_.getName(i.getFieldValue("adc_obj"), e.Variables.CATEGORY_NAME), a = i.getFieldValue("resolution");
@@ -107,11 +110,11 @@ function M(e, t) {
107
110
  return [o, t.ORDER_NONE];
108
111
  };
109
112
  }
110
- const w = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!--%20Created%20with%20Inkscape%20(http://www.inkscape.org/)%20--%3e%3csvg%20width='80mm'%20height='80mm'%20viewBox='0%200%2080%2080'%20version='1.1'%20id='svg5'%20inkscape:version='1.2.2%20(b0a8486541,%202022-12-01)'%20sodipodi:docname='pwm.svg'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3csodipodi:namedview%20id='namedview7'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20inkscape:document-units='mm'%20showgrid='true'%20inkscape:zoom='3.8397656'%20inkscape:cx='148.57678'%20inkscape:cy='153.26456'%20inkscape:window-width='2256'%20inkscape:window-height='1427'%20inkscape:window-x='0'%20inkscape:window-y='0'%20inkscape:window-maximized='1'%20inkscape:current-layer='layer1'%3e%3cinkscape:grid%20type='xygrid'%20id='grid1775'%20/%3e%3c/sodipodi:namedview%3e%3cdefs%20id='defs2'%20/%3e%3cg%20inkscape:label='Layer%201'%20inkscape:groupmode='layer'%20id='layer1'%3e%3cpath%20style='fill:none;stroke:%23ffffff;stroke-width:8;stroke-dasharray:none'%20d='M%201.4053079,71.498438%20H%2010.778154%20V%206.763835%20l%2025.032301,0%200.05922,64.481587%2042.339307,0'%20id='path5532'%20sodipodi:nodetypes='cccccc'%20/%3e%3c/g%3e%3c/svg%3e";
111
- function P(e, t) {
113
+ const v = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!--%20Created%20with%20Inkscape%20(http://www.inkscape.org/)%20--%3e%3csvg%20width='80mm'%20height='80mm'%20viewBox='0%200%2080%2080'%20version='1.1'%20id='svg5'%20inkscape:version='1.2.2%20(b0a8486541,%202022-12-01)'%20sodipodi:docname='pwm.svg'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3csodipodi:namedview%20id='namedview7'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20inkscape:document-units='mm'%20showgrid='true'%20inkscape:zoom='3.8397656'%20inkscape:cx='148.57678'%20inkscape:cy='153.26456'%20inkscape:window-width='2256'%20inkscape:window-height='1427'%20inkscape:window-x='0'%20inkscape:window-y='0'%20inkscape:window-maximized='1'%20inkscape:current-layer='layer1'%3e%3cinkscape:grid%20type='xygrid'%20id='grid1775'%20/%3e%3c/sodipodi:namedview%3e%3cdefs%20id='defs2'%20/%3e%3cg%20inkscape:label='Layer%201'%20inkscape:groupmode='layer'%20id='layer1'%3e%3cpath%20style='fill:none;stroke:%23ffffff;stroke-width:8;stroke-dasharray:none'%20d='M%201.4053079,71.498438%20H%2010.778154%20V%206.763835%20l%2025.032301,0%200.05922,64.481587%2042.339307,0'%20id='path5532'%20sodipodi:nodetypes='cccccc'%20/%3e%3c/g%3e%3c/svg%3e";
114
+ function z(e, t) {
112
115
  e.Blocks.pwm_minimal_class = {
113
116
  init: function() {
114
- this.appendValueInput("pin_id").setCheck(null).appendField(new e.FieldImage(w, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Crear PWM:").appendField(new e.FieldVariable("item"), "name").appendField(", Pin:"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(290), this.setTooltip("Crear un modulador de ancho de pulso (PWM), con frequecia=1000Hz, Ciclo útil Duty=512 (50%)."), this.setHelpUrl("");
117
+ this.appendValueInput("pin_id").setCheck(null).appendField(new e.FieldImage(v, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Crear PWM:").appendField(new e.FieldVariable("item"), "name").appendField(", Pin:"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(290), this.setTooltip("Crear un modulador de ancho de pulso (PWM), con frequecia=1000Hz, Ciclo útil Duty=512 (50%)."), this.setHelpUrl("");
115
118
  }
116
119
  }, t.pwm_minimal_class = function(i) {
117
120
  var n = t.nameDB_.getName(i.getFieldValue("name"), e.Variables.CATEGORY_NAME), a = t.valueToCode(i, "pin_id", t.ORDER_ATOMIC), a = t.valueToCode(i, "pin_id", t.ORDER_ATOMIC);
@@ -121,7 +124,7 @@ function P(e, t) {
121
124
  return o;
122
125
  }, e.Blocks.pwm_init_deinit = {
123
126
  init: function() {
124
- this.appendDummyInput().appendField(new e.FieldImage(w, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("PWM").appendField(new e.FieldVariable("item"), "pwm").appendField(new e.FieldDropdown([["start", "init()"], ["stop", "deinit()"]]), "start_stop"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(290), this.setTooltip("Iniciar o detener un PWM"), this.setHelpUrl("");
127
+ this.appendDummyInput().appendField(new e.FieldImage(v, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("PWM").appendField(new e.FieldVariable("item"), "pwm").appendField(new e.FieldDropdown([["start", "init()"], ["stop", "deinit()"]]), "start_stop"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(290), this.setTooltip("Iniciar o detener un PWM"), this.setHelpUrl("");
125
128
  }
126
129
  }, t.pwm_init_deinit = function(i) {
127
130
  var n = t.nameDB_.getName(i.getFieldValue("pwm"), e.Variables.CATEGORY_NAME), a = i.getFieldValue("start_stop");
@@ -131,31 +134,31 @@ function P(e, t) {
131
134
  return o;
132
135
  }, e.Blocks.pwm_method_freq_duty = {
133
136
  init: function() {
134
- this.appendValueInput("argument_funtion").setCheck("Number").appendField(new e.FieldImage(w, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("PWM").appendField(new e.FieldVariable("item"), "pwm").appendField(new e.FieldDropdown([["frecuencia", "freq"], ["ciclo 10bits", "duty"], ["ciclo 16bits", "duty_u16"], ["ciclo ns", "duty_ns"]]), "freq_duty"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(290), this.setTooltip("Configurar PWM, frecuencia (1 Hz - 40MHz), ciclo útil 10bits (0 - 1023), ciclo útil de 16 bits (0 - 65535) y ciclo útil ns (nano segundos)."), this.setHelpUrl("");
137
+ this.appendValueInput("argument_funtion").setCheck("Number").appendField(new e.FieldImage(v, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("PWM").appendField(new e.FieldVariable("item"), "pwm").appendField(new e.FieldDropdown([["frecuencia", "freq"], ["ciclo 10bits", "duty"], ["ciclo 16bits", "duty_u16"], ["ciclo ns", "duty_ns"]]), "freq_duty"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(290), this.setTooltip("Configurar PWM, frecuencia (1 Hz - 40MHz), ciclo útil 10bits (0 - 1023), ciclo útil de 16 bits (0 - 65535) y ciclo útil ns (nano segundos)."), this.setHelpUrl("");
135
138
  }
136
139
  }, t.pwm_method_freq_duty = function(i) {
137
140
  var n = t.nameDB_.getName(i.getFieldValue("pwm"), e.Variables.CATEGORY_NAME), a = i.getFieldValue("freq_duty"), o = t.valueToCode(i, "argument_funtion", t.ORDER_ATOMIC);
138
141
  t.definitions_.machine_import_pin || (t.definitions_.machine_import_pin = "from machine import Pin"), t.definitions_.machine_import_pwm || (t.definitions_.machine_import_pwm = "from machine import PWM");
139
- var d = n + "." + a + "(" + o + `)
142
+ var s = n + "." + a + "(" + o + `)
140
143
  `;
141
- return d;
144
+ return s;
142
145
  };
143
146
  }
144
- const b = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20version='1.1'%20id='svg4'%20sodipodi:docname='temperature-low-svgrepo-com-light.svg'%20inkscape:version='1.2.2%20(b0a8486541,%202022-12-01)'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3cdefs%20id='defs8'%20/%3e%3csodipodi:namedview%20id='namedview6'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20showgrid='false'%20inkscape:zoom='0.295'%20inkscape:cx='150.84746'%20inkscape:cy='405.08475'%20inkscape:window-width='1918'%20inkscape:window-height='1150'%20inkscape:window-x='1440'%20inkscape:window-y='24'%20inkscape:window-maximized='1'%20inkscape:current-layer='svg4'%20/%3e%3cpath%20d='M8%2015.9998C7.44772%2015.9998%207%2016.4475%207%2016.9998C7%2017.5521%207.44772%2017.9998%208%2017.9998C8.55228%2017.9998%209%2017.5521%209%2016.9998C9%2016.4475%208.55228%2015.9998%208%2015.9998ZM8%2015.9998L8.00707%2012M8%2016.9998L8.00707%2017.0069M20%205C20%206.10457%2019.1046%207%2018%207C16.8954%207%2016%206.10457%2016%205C16%203.89543%2016.8954%203%2018%203C19.1046%203%2020%203.89543%2020%205ZM12%2016.9998C12%2019.209%2010.2091%2020.9998%208%2020.9998C5.79086%2020.9998%204%2019.209%204%2016.9998C4%2015.9854%204.37764%2015.0591%205%2014.354L5%206C5%204.34315%206.34315%203%208%203C9.65685%203%2011%204.34315%2011%206V14.354C11.6224%2015.0591%2012%2015.9854%2012%2016.9998Z'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20id='path2'%20style='fill:none;stroke:%23ffffff'%20/%3e%3c/svg%3e";
145
- function L(e, t) {
147
+ const E = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20version='1.1'%20id='svg4'%20sodipodi:docname='temperature-low-svgrepo-com-light.svg'%20inkscape:version='1.2.2%20(b0a8486541,%202022-12-01)'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3cdefs%20id='defs8'%20/%3e%3csodipodi:namedview%20id='namedview6'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20showgrid='false'%20inkscape:zoom='0.295'%20inkscape:cx='150.84746'%20inkscape:cy='405.08475'%20inkscape:window-width='1918'%20inkscape:window-height='1150'%20inkscape:window-x='1440'%20inkscape:window-y='24'%20inkscape:window-maximized='1'%20inkscape:current-layer='svg4'%20/%3e%3cpath%20d='M8%2015.9998C7.44772%2015.9998%207%2016.4475%207%2016.9998C7%2017.5521%207.44772%2017.9998%208%2017.9998C8.55228%2017.9998%209%2017.5521%209%2016.9998C9%2016.4475%208.55228%2015.9998%208%2015.9998ZM8%2015.9998L8.00707%2012M8%2016.9998L8.00707%2017.0069M20%205C20%206.10457%2019.1046%207%2018%207C16.8954%207%2016%206.10457%2016%205C16%203.89543%2016.8954%203%2018%203C19.1046%203%2020%203.89543%2020%205ZM12%2016.9998C12%2019.209%2010.2091%2020.9998%208%2020.9998C5.79086%2020.9998%204%2019.209%204%2016.9998C4%2015.9854%204.37764%2015.0591%205%2014.354L5%206C5%204.34315%206.34315%203%208%203C9.65685%203%2011%204.34315%2011%206V14.354C11.6224%2015.0591%2012%2015.9854%2012%2016.9998Z'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20id='path2'%20style='fill:none;stroke:%23ffffff'%20/%3e%3c/svg%3e";
148
+ function q(e, t) {
146
149
  e.Blocks.dht_init = {
147
150
  init: function() {
148
- this.appendValueInput("pin").setCheck("Number").appendField(new e.FieldImage(b, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Crear").appendField(new e.FieldDropdown([["DHT11", "DHT11"], ["DHT22", "DHT22"]]), "dht_option").appendField(new e.FieldVariable("variable"), "sensor").appendField("Pin:"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(195), this.setTooltip("Instanciar un sensor DHT (Sensor de humedad y temperatura digital), puede seleccionar un DHT11 o DHT22, ambos tienen diferentes características de precisión. Escoja el nombre de la variable que representará al sensor, finalmente, indique el Pin por el cual se leerá el sensor."), this.setHelpUrl("");
151
+ this.appendValueInput("pin").setCheck("Number").appendField(new e.FieldImage(E, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField("Crear").appendField(new e.FieldDropdown([["DHT11", "DHT11"], ["DHT22", "DHT22"]]), "dht_option").appendField(new e.FieldVariable("variable"), "sensor").appendField("Pin:"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(195), this.setTooltip("Instanciar un sensor DHT (Sensor de humedad y temperatura digital), puede seleccionar un DHT11 o DHT22, ambos tienen diferentes características de precisión. Escoja el nombre de la variable que representará al sensor, finalmente, indique el Pin por el cual se leerá el sensor."), this.setHelpUrl("");
149
152
  }
150
153
  }, t.dht_init = function(i) {
151
154
  var n = i.getFieldValue("dht_option"), a = t.nameDB_.getName(i.getFieldValue("sensor"), e.Variables.CATEGORY_NAME), o = t.valueToCode(i, "pin", t.ORDER_ATOMIC);
152
155
  t.definitions_.machine_import_pin || (t.definitions_.machine_import_pin = "from machine import Pin"), n == "DHT11" ? t.definitions_.machine_import_dht11 || (t.definitions_.machine_import_dht11 = "from dht import DHT11") : t.definitions_.machine_import_dht22 || (t.definitions_.machine_import_dht22 = "from dht import DHT22");
153
- var d = a + " = " + n + "(Pin(" + o + `))
156
+ var s = a + " = " + n + "(Pin(" + o + `))
154
157
  `;
155
- return d;
158
+ return s;
156
159
  }, e.Blocks.dht_measure = {
157
160
  init: function() {
158
- this.appendDummyInput().appendField(new e.FieldImage(b, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField(new e.FieldVariable("variable"), "sensor").appendField("Actualizar lectura"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(195), this.setTooltip("Actualizar la medición del sensor DHT"), this.setHelpUrl("");
161
+ this.appendDummyInput().appendField(new e.FieldImage(E, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField(new e.FieldVariable("variable"), "sensor").appendField("Actualizar lectura"), this.setPreviousStatement(!0, null), this.setNextStatement(!0, null), this.setColour(195), this.setTooltip("Actualizar la medición del sensor DHT"), this.setHelpUrl("");
159
162
  }
160
163
  }, t.dht_measure = function(i) {
161
164
  var n = t.nameDB_.getName(i.getFieldValue("sensor"), e.Variables.CATEGORY_NAME), a = n + `.measure()
@@ -163,7 +166,7 @@ function L(e, t) {
163
166
  return a;
164
167
  }, e.Blocks.dht_read = {
165
168
  init: function() {
166
- this.appendDummyInput().appendField(new e.FieldImage(b, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField(new e.FieldVariable("variable"), "sensor").appendField(new e.FieldDropdown([["leer temperatura", "temperature()"], ["leer humedad", "humidity()"]]), "read"), this.setOutput(!0, "Number"), this.setColour(195), this.setTooltip("Obtener la medición de humedad o temperatura del sensor DHT"), this.setHelpUrl("");
169
+ this.appendDummyInput().appendField(new e.FieldImage(E, 15, 15, { alt: "*", flipRtl: "FALSE" })).appendField(new e.FieldVariable("variable"), "sensor").appendField(new e.FieldDropdown([["leer temperatura", "temperature()"], ["leer humedad", "humidity()"]]), "read"), this.setOutput(!0, "Number"), this.setColour(195), this.setTooltip("Obtener la medición de humedad o temperatura del sensor DHT"), this.setHelpUrl("");
167
170
  }
168
171
  }, t.dht_read = function(i) {
169
172
  var n = t.nameDB_.getName(i.getFieldValue("sensor"), e.Variables.CATEGORY_NAME), a = i.getFieldValue("read"), o = n + "." + a + `
@@ -171,10 +174,10 @@ function L(e, t) {
171
174
  return [o, t.ORDER_NONE];
172
175
  };
173
176
  }
174
- function S(e, t) {
175
- V(e, t), I(e, t), M(e, t), P(e, t), L(e, t);
177
+ function Y(e, t) {
178
+ G(e, t), X(e, t), K(e, t), z(e, t), q(e, t);
176
179
  }
177
- const B = `
180
+ const Z = `
178
181
  <xml id="toolbox" style="display: none">
179
182
  <category name="Lógica" colour="%{BKY_LOGIC_HUE}">
180
183
  <block type="controls_if"></block>
@@ -507,75 +510,177 @@ const B = `
507
510
  <sep></sep>
508
511
  </xml>
509
512
  `;
510
- function H(e, t) {
513
+ function Q(e, t) {
511
514
  return e.INFINITE_LOOP_TRAP = null, e.workspaceToCode(t);
512
515
  }
513
- var l = /* @__PURE__ */ ((e) => (e[e.OK = 0] = "OK", e[e.FAILED = 1] = "FAILED", e[e.CHANGE = 2] = "CHANGE", e[e.WITHOUTCHANGE = 3] = "WITHOUTCHANGE", e[e.REQUEST = 4] = "REQUEST", e[e.REQUEST_SELECT_FILE_IN_TABVIEW = 5] = "REQUEST_SELECT_FILE_IN_TABVIEW", e[e.EXISTS = 6] = "EXISTS", e[e.NOEXIST = 7] = "NOEXIST", e[e.FOUND = 8] = "FOUND", e[e.NOTFOUND = 9] = "NOTFOUND", e[e.ADDED = 10] = "ADDED", e[e.SAVED = 11] = "SAVED", e[e.UNSAVED = 12] = "UNSAVED", e[e.SET_WS = 13] = "SET_WS", e[e.ENABLED = 14] = "ENABLED", e[e.DESABLED = 15] = "DESABLED", e))(l || {}), k = /* @__PURE__ */ ((e) => (e[e.EN = 0] = "EN", e[e.ES = 1] = "ES", e))(k || {}), r = /* @__PURE__ */ ((e) => (e[e.TOAST = 0] = "TOAST", e[e.TEXT_PRINT = 1] = "TEXT_PRINT", e[e.TEXT_AREA = 2] = "TEXT_AREA", e[e.URL_PRINT = 3] = "URL_PRINT", e[e.TERM = 4] = "TERM", e))(r || {}), T = /* @__PURE__ */ ((e) => (e[e.WEBSOCKET = 0] = "WEBSOCKET", e[e.TCP_IP = 1] = "TCP_IP", e[e.SERIAL = 2] = "SERIAL", e))(T || {});
514
- const U = { name: "Python", extension: "py" }, C = "py", v = "json", E = "micropython-esp32", W = "main.py", K = '{"config":{"platform":"micropython-esp32","send":"wifi","ip_mpy":"192.168.4.1","serialport":""},"blocklycode":"<xml xmlns=\\"https://developers.google.com/blockly/xml\\"></xml>"}', X = `# platform: micropython-esp32
516
+ var l = /* @__PURE__ */ ((e) => (e[e.OK = 0] = "OK", e[e.FAILED = 1] = "FAILED", e[e.CHANGE = 2] = "CHANGE", e[e.WITHOUTCHANGE = 3] = "WITHOUTCHANGE", e[e.REQUEST = 4] = "REQUEST", e[e.REQUEST_SELECT_FILE_IN_TABVIEW = 5] = "REQUEST_SELECT_FILE_IN_TABVIEW", e[e.EXISTS = 6] = "EXISTS", e[e.NOEXIST = 7] = "NOEXIST", e[e.FOUND = 8] = "FOUND", e[e.NOTFOUND = 9] = "NOTFOUND", e[e.ADDED = 10] = "ADDED", e[e.SAVED = 11] = "SAVED", e[e.UNSAVED = 12] = "UNSAVED", e[e.SET_WS = 13] = "SET_WS", e[e.ENABLED = 14] = "ENABLED", e[e.DESABLED = 15] = "DESABLED", e))(l || {}), F = /* @__PURE__ */ ((e) => (e[e.EN = 0] = "EN", e[e.ES = 1] = "ES", e))(F || {}), d = /* @__PURE__ */ ((e) => (e[e.TOAST = 0] = "TOAST", e[e.TEXT_PRINT = 1] = "TEXT_PRINT", e[e.TEXT_AREA = 2] = "TEXT_AREA", e[e.URL_PRINT = 3] = "URL_PRINT", e[e.TERM = 4] = "TERM", e))(d || {}), M = /* @__PURE__ */ ((e) => (e[e.WEBSOCKET = 0] = "WEBSOCKET", e[e.TCP_IP = 1] = "TCP_IP", e[e.SERIAL = 2] = "SERIAL", e))(M || {});
517
+ const $ = { name: "Python", extension: "py" }, V = "py", C = "json", A = "micropython-esp32", J = "main.py", j = '{"config":{"platform":"micropython-esp32","send":"wifi","ip_mpy":"192.168.4.1","serialport":""},"blocklycode":"<xml xmlns=\\"https://developers.google.com/blockly/xml\\"></xml>"}', ee = `# platform: micropython-esp32
515
518
  # send: wifi
516
519
  # ip_mpy: 192.168.4.1
517
520
  # serialport:
518
521
  `;
519
- var h = /* @__PURE__ */ ((e) => (e.WIFI = "wifi", e.SERIAL = "serial", e))(h || {});
520
- async function G(e, t, i) {
522
+ var w = /* @__PURE__ */ ((e) => (e.WIFI = "wifi", e.SERIAL = "serial", e))(w || {});
523
+ async function te(e, t, i) {
521
524
  const n = window.catalejo;
522
525
  if (!n)
523
526
  throw { message: "El editor no ofrece la conexión con el backend (window.catalejo)" };
524
527
  return await n.call(e, t, i);
525
528
  }
526
- async function z() {
529
+ async function ie() {
527
530
  try {
528
- const e = await G("serial.list", {});
531
+ const e = await te("serial.list", {});
529
532
  return { status: l.OK, data: e.ports };
530
533
  } catch (e) {
531
534
  return console.error("serial.list", e), { status: l.FAILED, data: (e == null ? void 0 : e.message) || String(e) };
532
535
  }
533
536
  }
534
- function m(e) {
537
+ const R = 64, ne = 5e3, O = 5e3;
538
+ function x(e) {
535
539
  return new Promise((t) => setTimeout(t, e));
536
540
  }
537
- async function q(e, t, i) {
538
- typeof t == "string" ? t = new TextEncoder().encode(t) : t instanceof Uint8Array || (t = new Uint8Array(t));
539
- const n = new WebSocket("ws://" + i.ipPy + ":" + i.portPy + "/");
540
- return n.binaryType = "arraybuffer", new Promise((a) => {
541
- n.onmessage = (o) => {
542
- console.log(o.data);
543
- }, n.onopen = async function() {
544
- console.log("WebSocket connection opened."), await m(100), console.log("This password: " + i.passwordPy), n.send(i.passwordPy + "\r"), await m(100);
545
- const o = t.length, d = e;
546
- let s = new Uint8Array(82);
547
- s[0] = 87, s[1] = 65, s[2] = 1, s[3] = 0, s[4] = 0, s[5] = 0, s[6] = 0, s[7] = 0, s[8] = 0, s[9] = 0, s[10] = 0, s[11] = 0, s[12] = o & 255, s[13] = o >> 8 & 255, s[14] = o >> 16 & 255, s[15] = o >> 24 & 255, s[16] = d.length & 255, s[17] = d.length >> 8 & 255;
548
- for (var u = 0; u < 64; ++u)
549
- u < d.length ? s[18 + u] = d.charCodeAt(u) : s[18 + u] = 0;
550
- console.log("Send file to micropython: " + e), n.send(s), n.onmessage = async function() {
551
- for (let f = 0; f < t.length; f += i.chuckSizePy) {
552
- const F = t.slice(f, f + i.chuckSizePy);
553
- console.log(F), n.send(F), await m(i.sleepTimePy);
554
- }
555
- n.send(""), m(100), n.close(), a({ status: l.OK, data: "File uploaded" });
556
- };
557
- }, n.onerror = function(o) {
558
- a({ status: l.FAILED, data: "WebSocket error" + o });
559
- }, n.onclose = function() {
560
- console.log("WebSocket connection closed.");
561
- };
562
- });
563
- }
564
- async function Y(e, t) {
565
- const i = new WebSocket("ws://" + t.ipPy + ":" + t.portPy + "/");
566
- return new Promise((n) => {
567
- i.onopen = async function() {
568
- await m(100), i.send(t.passwordPy + "\r"), await m(100), i.send(e), await m(100), i.close(), n({ status: l.OK, data: "File uploaded" });
569
- }, i.onerror = function(a) {
570
- n({ status: l.FAILED, data: "WebSocket error" + a });
571
- }, i.onclose = function() {
572
- console.log("WebSocket connection closed.");
573
- }, i.onmessage = (a) => {
574
- console.log(a.data);
541
+ class c extends Error {
542
+ constructor(t, i = "") {
543
+ super(t + (i ? ": " + i : "")), this.code = t, this.detail = i;
544
+ }
545
+ }
546
+ class k {
547
+ constructor(t) {
548
+ _(this, "text", "");
549
+ _(this, "binary", []);
550
+ _(this, "closed", !1);
551
+ _(this, "wake", null);
552
+ this.ws = t, t.onmessage = (i) => {
553
+ typeof i.data == "string" ? this.text += i.data : this.binary.push(new Uint8Array(i.data)), this.notify();
554
+ }, t.onclose = () => {
555
+ this.closed = !0, this.notify();
556
+ }, t.onerror = () => {
557
+ this.closed = !0, this.notify();
575
558
  };
576
- });
559
+ }
560
+ notify() {
561
+ const t = this.wake;
562
+ this.wake = null, t && t();
563
+ }
564
+ /** Abrir la conexión con la placa. */
565
+ static open(t) {
566
+ return new Promise((i, n) => {
567
+ let a;
568
+ try {
569
+ a = new WebSocket("ws://" + t.ipPy + ":" + t.portPy + "/"), a.binaryType = "arraybuffer";
570
+ } catch (r) {
571
+ n(new c("connect", String(r)));
572
+ return;
573
+ }
574
+ const o = [];
575
+ a.onmessage = (r) => o.push(r);
576
+ const s = setTimeout(() => {
577
+ a.close(), n(new c("connect", t.ipPy));
578
+ }, ne);
579
+ a.onopen = () => {
580
+ clearTimeout(s);
581
+ const r = new k(a);
582
+ o.forEach((m) => {
583
+ var h;
584
+ return (h = a.onmessage) == null ? void 0 : h.call(a, m);
585
+ }), i(r);
586
+ }, a.onerror = () => {
587
+ clearTimeout(s), n(new c("connect", t.ipPy));
588
+ };
589
+ });
590
+ }
591
+ /** Esperar hasta que `check` devuelva algo distinto de `undefined`. */
592
+ async waitFor(t, i, n = O) {
593
+ const a = Date.now() + n;
594
+ for (; ; ) {
595
+ const o = t();
596
+ if (o !== void 0) return o;
597
+ if (this.closed) throw new c("closed", i);
598
+ const s = a - Date.now();
599
+ if (s <= 0) throw new c("timeout", i);
600
+ await new Promise((r) => {
601
+ const m = setTimeout(r, s);
602
+ this.wake = () => {
603
+ clearTimeout(m), r();
604
+ };
605
+ });
606
+ }
607
+ }
608
+ /** Esperar un texto de la placa; devuelve el patrón que apareció primero. */
609
+ waitText(t, i) {
610
+ return this.waitFor(() => {
611
+ const n = t.find((a) => this.text.includes(a));
612
+ return n !== void 0 && (this.text = ""), n;
613
+ }, i);
614
+ }
615
+ /** Esperar una respuesta `WB` y devolver su código de estado. */
616
+ waitWB(t, i) {
617
+ return this.waitFor(() => {
618
+ const n = this.binary.shift();
619
+ if (n !== void 0)
620
+ return n.length >= 4 && n[0] === 87 && n[1] === 66 ? n[2] | n[3] << 8 : -1;
621
+ }, t, i);
622
+ }
623
+ /** Pasos 1 y 2: esperar "Password:", enviar la clave y confirmar el acceso. */
624
+ async login(t) {
625
+ if (await this.waitText(["Password:"], "password prompt"), this.ws.send(t + "\r"), await this.waitText(["WebREPL connected", "Access denied"], "login") === "Access denied")
626
+ throw new c(
627
+ "accessDenied"
628
+ /* ACCESS_DENIED */
629
+ );
630
+ }
631
+ /** Pasos 3 y 4: escribir un archivo en el sistema de archivos de la placa. */
632
+ async putFile(t, i, n, a) {
633
+ const o = new TextEncoder().encode(t);
634
+ if (o.length === 0 || o.length > R)
635
+ throw new c("filename", t);
636
+ const s = i.length, r = new Uint8Array(18 + R);
637
+ r[0] = 87, r[1] = 65, r[2] = 1, r[12] = s & 255, r[13] = s >> 8 & 255, r[14] = s >> 16 & 255, r[15] = s >> 24 & 255, r[16] = o.length & 255, r[17] = o.length >> 8 & 255, r.set(o, 18), this.binary = [], this.ws.send(r);
638
+ let m = await this.waitWB("put header");
639
+ if (m !== 0) throw new c("rejected", "header " + m);
640
+ const h = n > 0 ? n : 1024;
641
+ for (let y = 0; y < s; y += h) {
642
+ if (this.closed) throw new c("closed", "sending");
643
+ this.ws.send(i.slice(y, y + h)), a > 0 && await x(a);
644
+ }
645
+ if (m = await this.waitWB("put end", O + Math.ceil(s / 4096) * 1e3), m !== 0) throw new c("rejected", "end " + m);
646
+ }
647
+ /** Enviar texto a la REPL, como si se escribiera en la consola. */
648
+ async sendRepl(t) {
649
+ this.ws.send(t), await x(100);
650
+ }
651
+ close() {
652
+ this.closed = !0;
653
+ try {
654
+ this.ws.close();
655
+ } catch {
656
+ }
657
+ }
658
+ }
659
+ function L(e) {
660
+ return e instanceof c ? { status: l.FAILED, data: { code: e.code, detail: e.detail } } : { status: l.FAILED, data: { code: "connect", detail: String(e) } };
577
661
  }
578
- const p = {
662
+ async function ae(e, t, i, n = !0) {
663
+ const a = typeof t == "string" ? new TextEncoder().encode(t) : new Uint8Array(t);
664
+ let o;
665
+ try {
666
+ return o = await k.open(i), await o.login(i.passwordPy), await o.putFile(e, a, i.chuckSizePy, i.sleepTimePy), n && await o.sendRepl(""), { status: l.OK, data: "File uploaded" };
667
+ } catch (s) {
668
+ return L(s);
669
+ } finally {
670
+ o == null || o.close();
671
+ }
672
+ }
673
+ async function oe(e, t) {
674
+ let i;
675
+ try {
676
+ return i = await k.open(t), await i.login(t.passwordPy), await i.sendRepl(e), { status: l.OK, data: "Command sent" };
677
+ } catch (n) {
678
+ return L(n);
679
+ } finally {
680
+ i == null || i.close();
681
+ }
682
+ }
683
+ const u = {
579
684
  micropythonSend: {
580
685
  en: "Send",
581
686
  es: "Enviar"
@@ -604,18 +709,54 @@ const p = {
604
709
  en: "Run terminal",
605
710
  es: "Conectersa a micropython"
606
711
  }
607
- }, Z = {
712
+ }, se = {
608
713
  docs: {
609
714
  title: {
610
715
  en: "Micropython documentation",
611
716
  es: "Documentación para Micropython"
612
717
  }
613
718
  }
719
+ }, g = {
720
+ sendOk: { en: "Code sent to the board", es: "Código enviado a la placa" },
721
+ sendFailed: { en: "Could not send the code", es: "No se pudo enviar el código" },
722
+ resetOk: { en: "Reset command sent", es: "Se envió el reinicio" },
723
+ resetFailed: { en: "Could not reset the board", es: "No se pudo reiniciar la placa" },
724
+ runOk: { en: "Run command sent", es: "Se envió la orden de ejecutar" },
725
+ runFailed: { en: "Could not run the program", es: "No se pudo ejecutar el programa" },
726
+ noIp: {
727
+ en: "Missing the board address: add '# ip_mpy: 192.168.4.1' (or the board name ending in .local) to the configuration",
728
+ es: "Falta la dirección de la placa: agrega '# ip_mpy: 192.168.4.1' (o el nombre de la placa terminado en .local) a la configuración"
729
+ },
730
+ noContent: { en: "This file can't be sent to the board", es: "Este archivo no se puede enviar a la placa" },
731
+ connect: {
732
+ en: "Can't reach the board. Check that you are on the same WiFi network as the board and that ip_mpy is right",
733
+ es: "No se encontró la placa. Revisa que estés en la misma red WiFi que la placa y que ip_mpy sea correcta"
734
+ },
735
+ closed: {
736
+ en: "The board closed the connection. Is someone else connected to it (terminal or another computer)?",
737
+ es: "La placa cerró la conexión. ¿Hay alguien más conectado a ella (terminal u otro equipo)?"
738
+ },
739
+ timeout: {
740
+ en: "The board didn't answer in time. If a program is running, press Reset and try again",
741
+ es: "La placa no respondió a tiempo. Si hay un programa corriendo, presiona Reiniciar e intenta de nuevo"
742
+ },
743
+ accessDenied: {
744
+ en: "Wrong WebREPL password: check password_mpy (default 0000)",
745
+ es: "Clave de WebREPL incorrecta: revisa password_mpy (por defecto 0000)"
746
+ },
747
+ filename: {
748
+ en: "Invalid file name for the board (empty or longer than 64 bytes)",
749
+ es: "Nombre de archivo no válido para la placa (vacío o de más de 64 bytes)"
750
+ },
751
+ rejected: {
752
+ en: "The board couldn't save the file (no space or invalid name?)",
753
+ es: "La placa no pudo guardar el archivo (¿sin espacio o nombre no válido?)"
754
+ }
614
755
  };
615
- function c(e, t) {
616
- return t == k.EN ? e.en : t == k.ES ? e.es : "noname";
756
+ function p(e, t) {
757
+ return t == F.EN ? e.en : t == F.ES ? e.es : "noname";
617
758
  }
618
- function O(e) {
759
+ function P(e) {
619
760
  return {
620
761
  ipPy: e.ip_mpy != null && e.ip_mpy != "" ? e.ip_mpy : "",
621
762
  portPy: e.port_mpy != null && e.port_mpy != "" ? e.port_mpy : "8266",
@@ -624,36 +765,55 @@ function O(e) {
624
765
  chuckSizePy: e.chuckSize_mpy != null && e.chuckSize_mpy != "" ? parseInt(e.chuckSize_mpy) : 1024
625
766
  };
626
767
  }
627
- function Q(e, t) {
628
- return e.extension == C ? { status: l.OK, data: e.content } : e.extension == v && e.config.platform == E ? { status: l.OK, data: t() } : { status: l.FAILED };
768
+ function le(e, t) {
769
+ return e.extension == V ? { status: l.OK, data: e.content } : e.extension == C && e.config.platform == A ? { status: l.OK, data: t() } : { status: l.FAILED };
629
770
  }
630
- function $(e) {
631
- return e.extension == C ? e.config.filename != "" && e.config.filename != null ? { status: l.OK, data: e.config.filename } : { status: l.OK, data: e.filename } : e.extension == v && e.config.platform == E ? e.config.filename != "" && e.config.filename != null ? { status: l.OK, data: e.config.filename } : { status: l.OK, data: W } : { status: l.FAILED };
771
+ function re(e) {
772
+ return e.extension == V ? e.config.filename != "" && e.config.filename != null ? { status: l.OK, data: e.config.filename } : { status: l.OK, data: e.filename } : e.extension == C && e.config.platform == A ? e.config.filename != "" && e.config.filename != null ? { status: l.OK, data: e.config.filename } : { status: l.OK, data: J } : { status: l.FAILED };
632
773
  }
633
- async function J(e, t) {
634
- const i = O(e.config);
774
+ async function de(e, t) {
775
+ const i = P(e.config);
635
776
  if (i.ipPy == "")
636
- return { status: l.FAILED };
777
+ return { status: l.FAILED, data: { code: "noIp" } };
637
778
  let n;
638
- if (n = $(e), n.status == l.FAILED)
639
- return n;
779
+ if (n = re(e), n.status == l.FAILED)
780
+ return { status: l.FAILED, data: { code: "noContent" } };
640
781
  const a = n.data;
641
- if (n = Q(e, t), n.status == l.FAILED)
642
- return n;
782
+ if (n = le(e, t), n.status == l.FAILED)
783
+ return { status: l.FAILED, data: { code: "noContent" } };
643
784
  const o = n.data;
644
- return n = await q(a, o, i), n;
785
+ return await ae(a, o, i);
645
786
  }
646
- async function j(e, t) {
647
- return e.config.send == h.WIFI && (await J(e, t)).status == l.OK ? {
648
- typeResult: r.TOAST,
787
+ function D(e, t, i, n) {
788
+ var s;
789
+ if (e.status == l.OK)
790
+ return {
791
+ typeResult: d.TOAST,
792
+ data: {
793
+ severity: "success",
794
+ summary: p(g[i], t),
795
+ detail: "",
796
+ life: 3e3
797
+ }
798
+ };
799
+ const a = (s = e.data) == null ? void 0 : s.code, o = a != null && g[a] != null ? p(g[a], t) : "";
800
+ return {
801
+ typeResult: d.TOAST,
649
802
  data: {
650
- severity: "success",
651
- summary: "Code save Ok",
652
- detail: "",
653
- life: 3e3
803
+ severity: "warn",
804
+ summary: p(g[n], t),
805
+ detail: o,
806
+ life: 8e3
654
807
  }
655
- } : {
656
- typeResult: r.TOAST,
808
+ };
809
+ }
810
+ async function ce(e, t, i) {
811
+ if (e.config.send == w.WIFI) {
812
+ const a = await de(e, t);
813
+ return D(a, i, "sendOk", "sendFailed");
814
+ }
815
+ return {
816
+ typeResult: d.TOAST,
657
817
  data: {
658
818
  severity: "warn",
659
819
  summary: "TODO from send on micropython",
@@ -662,57 +822,49 @@ async function j(e, t) {
662
822
  }
663
823
  };
664
824
  }
665
- async function R(e, t) {
666
- const i = O(e.config);
667
- return i.ipPy == "" ? { status: l.FAILED } : await Y(t, i);
825
+ async function B(e, t) {
826
+ const i = P(e.config);
827
+ return i.ipPy == "" ? { status: l.FAILED, data: { code: "noIp" } } : await oe(t, i);
668
828
  }
669
- async function ee(e) {
670
- return e.config.send == h.WIFI && (await R(e, "from machine import reset\rreset()\r")).status == l.OK ? {
671
- typeResult: r.TOAST,
672
- data: {
673
- severity: "success",
674
- summary: "Reset command send",
675
- detail: "",
676
- life: 3e3
677
- }
678
- } : {
679
- typeResult: r.TOAST,
829
+ async function pe(e, t) {
830
+ if (e.config.send == w.WIFI) {
831
+ const n = await B(e, "from machine import reset\rreset()\r");
832
+ return D(n, t, "resetOk", "resetFailed");
833
+ }
834
+ return {
835
+ typeResult: d.TOAST,
680
836
  data: {
681
837
  severity: "warn",
682
838
  summary: "Failed soft reset micropython",
683
839
  detail: "",
684
- life: 1e3
840
+ life: 3e3
685
841
  }
686
842
  };
687
843
  }
688
- async function te(e) {
689
- return e.config.send == h.WIFI && (await R(e, "")).status == l.OK ? {
690
- typeResult: r.TOAST,
691
- data: {
692
- severity: "success",
693
- summary: "Run main command send",
694
- detail: "",
695
- life: 3e3
696
- }
697
- } : {
698
- typeResult: r.TOAST,
844
+ async function me(e, t) {
845
+ if (e.config.send == w.WIFI) {
846
+ const n = await B(e, "");
847
+ return D(n, t, "runOk", "runFailed");
848
+ }
849
+ return {
850
+ typeResult: d.TOAST,
699
851
  data: {
700
852
  severity: "warn",
701
853
  summary: "Failed run main micropython",
702
854
  detail: "",
703
- life: 1e3
855
+ life: 3e3
704
856
  }
705
857
  };
706
858
  }
707
- async function ie(e) {
859
+ async function ue(e) {
708
860
  const t = e.config.send, i = e.config;
709
- if (t == h.WIFI) {
861
+ if (t == w.WIFI) {
710
862
  const n = i.ip_mpy != null && i.ip_mpy != "" ? i.ip_mpy : "", a = i.port_mpy != null && i.port_mpy != "" ? i.port_mpy : "8266", o = i.password_mpy != null && i.password_mpy != "" ? i.password_mpy : "0000";
711
863
  if (n != "")
712
864
  return {
713
- typeResult: r.TERM,
865
+ typeResult: d.TERM,
714
866
  data: {
715
- typeConnection: T.WEBSOCKET,
867
+ typeConnection: M.WEBSOCKET,
716
868
  data: {
717
869
  ip: n,
718
870
  port: a,
@@ -724,7 +876,7 @@ async function ie(e) {
724
876
  };
725
877
  }
726
878
  return {
727
- typeResult: r.TOAST,
879
+ typeResult: d.TOAST,
728
880
  data: {
729
881
  severity: "warn",
730
882
  summary: "Failed open terminal micropython",
@@ -733,15 +885,15 @@ async function ie(e) {
733
885
  }
734
886
  };
735
887
  }
736
- async function ne(e, t) {
737
- return e.extension == v ? {
738
- typeResult: r.TEXT_PRINT,
888
+ async function he(e, t) {
889
+ return e.extension == C ? {
890
+ typeResult: d.TEXT_PRINT,
739
891
  data: {
740
892
  title: "Python",
741
893
  content: t()
742
894
  }
743
895
  } : {
744
- typeResult: r.TOAST,
896
+ typeResult: d.TOAST,
745
897
  data: {
746
898
  severity: "warn",
747
899
  summary: "Opción disponible solo con archivos blockly (json)",
@@ -750,15 +902,15 @@ async function ne(e, t) {
750
902
  }
751
903
  };
752
904
  }
753
- async function ae() {
754
- const e = await z();
905
+ async function _e() {
906
+ const e = await ie();
755
907
  if (e.status == l.OK) {
756
908
  let t = "";
757
909
  for (let i = 0; i < e.data.length; i++)
758
910
  t += e.data[i] + `
759
911
  `;
760
912
  return {
761
- typeResult: r.TEXT_PRINT,
913
+ typeResult: d.TEXT_PRINT,
762
914
  data: {
763
915
  title: "SerialPortList",
764
916
  content: t
@@ -766,7 +918,7 @@ async function ae() {
766
918
  };
767
919
  } else
768
920
  return {
769
- typeResult: r.TOAST,
921
+ typeResult: d.TOAST,
770
922
  data: {
771
923
  severity: "warn",
772
924
  summary: "No se pudo obtener información sobre los puertos seriales",
@@ -775,35 +927,35 @@ async function ae() {
775
927
  }
776
928
  };
777
929
  }
778
- async function oe(e) {
930
+ async function fe(e) {
779
931
  const a = "http://" + location.hostname + ":" + 8080 + "/plugins/nodemcu/docs/index.html";
780
932
  return {
781
- typeResult: r.URL_PRINT,
933
+ typeResult: d.URL_PRINT,
782
934
  data: {
783
- title: c(Z.docs.title, e),
935
+ title: p(se.docs.title, e),
784
936
  content: a,
785
937
  description: "Abre el siguiente enlace para obtener infomación sobre la documentación de nodemcu"
786
938
  }
787
939
  };
788
940
  }
789
- let g, x, A;
790
- const le = E, se = U, re = K, de = X;
791
- function ce(e, t, i) {
792
- A = e, g = t, x = i, S(A, g);
941
+ let T, S, N;
942
+ const ye = A, be = $, ge = j, ke = ee;
943
+ function ve(e, t, i) {
944
+ N = e, T = t, S = i, Y(N, T);
793
945
  }
794
- function D() {
795
- return H(g, x);
946
+ function I() {
947
+ return Q(T, S);
796
948
  }
797
- const pe = B;
798
- function me(e) {
949
+ const Ee = Z;
950
+ function Fe(e) {
799
951
  return [
800
952
  {
801
- label: c(p.magic, e),
953
+ label: p(u.magic, e),
802
954
  icon: "pi pi-sparkles",
803
955
  command: "micropython-magic"
804
956
  },
805
957
  {
806
- label: c(p.micropythonSend, e),
958
+ label: p(u.micropythonSend, e),
807
959
  icon: "pi pi-send",
808
960
  command: "micropython-send"
809
961
  },
@@ -812,27 +964,27 @@ function me(e) {
812
964
  icon: "pi pi-microchip",
813
965
  items: [
814
966
  {
815
- label: c(p.getSerialportList, e),
967
+ label: p(u.getSerialportList, e),
816
968
  icon: "pi pi-search",
817
969
  command: "nodemcu-getserialportlist"
818
970
  },
819
971
  {
820
- label: c(p.docs, e),
972
+ label: p(u.docs, e),
821
973
  icon: "pi pi-book",
822
974
  command: "micropython-docs"
823
975
  },
824
976
  {
825
- label: c(p.reset, e),
977
+ label: p(u.reset, e),
826
978
  icon: "pi pi-refresh",
827
979
  command: "micropython-reset"
828
980
  },
829
981
  {
830
- label: c(p.play, e),
982
+ label: p(u.play, e),
831
983
  icon: "pi pi-play",
832
984
  command: "micropython-play"
833
985
  },
834
986
  {
835
- label: c(p.term, e),
987
+ label: p(u.term, e),
836
988
  icon: "pi pi-sync",
837
989
  command: "micropython-term"
838
990
  }
@@ -840,9 +992,9 @@ function me(e) {
840
992
  }
841
993
  ];
842
994
  }
843
- async function ue(e, t, i) {
844
- return t == "micropython-send" ? await j(e, D) : t == "micropython-magic" ? await ne(e, D) : t == "nodemcu-getserialportlist" ? await ae() : t == "micropython-docs" ? await oe(i) : t == "micropython-reset" ? await ee(e) : t == "micropython-play" ? await te(e) : t == "micropython-term" ? await ie(e) : {
845
- typeResult: r.TOAST,
995
+ async function Te(e, t, i) {
996
+ return t == "micropython-send" ? await ce(e, I, i) : t == "micropython-magic" ? await he(e, I) : t == "nodemcu-getserialportlist" ? await _e() : t == "micropython-docs" ? await fe(i) : t == "micropython-reset" ? await pe(e, i) : t == "micropython-play" ? await me(e, i) : t == "micropython-term" ? await ue(e) : {
997
+ typeResult: d.TOAST,
846
998
  data: {
847
999
  severity: "error",
848
1000
  summary: "Función no localizada en el plugin",
@@ -852,13 +1004,13 @@ async function ue(e, t, i) {
852
1004
  };
853
1005
  }
854
1006
  export {
855
- re as blockly_template,
856
- ue as commandEmit,
857
- D as generateCode,
858
- me as getItemsToolBarOfPlugin,
859
- ce as initBlockly,
860
- de as lang_template,
861
- le as platform,
862
- se as platformLang,
863
- pe as toolbox
1007
+ ge as blockly_template,
1008
+ Te as commandEmit,
1009
+ I as generateCode,
1010
+ Fe as getItemsToolBarOfPlugin,
1011
+ ve as initBlockly,
1012
+ ke as lang_template,
1013
+ ye as platform,
1014
+ be as platformLang,
1015
+ Ee as toolbox
864
1016
  };