@johnnycubides/micropython-esp32-plugin-catalejo-editor 0.1.1 → 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 (35) hide show
  1. package/README.md +3 -0
  2. package/micropython-esp32/README.md +3 -0
  3. package/micropython-esp32/commands.d.ts +3 -4
  4. package/micropython-esp32/consts.d.ts +0 -1
  5. package/micropython-esp32/esp32-libs/esp32-c3-mini/boot.py +14 -0
  6. package/micropython-esp32/esp32-libs/esp32-c3-mini/webrepl_cfg.py +1 -0
  7. package/micropython-esp32/esp32-libs/esp32-c3-mini/wifi.py +135 -0
  8. package/micropython-esp32/esp32-libs/esp32-c3-mini/wifi_config.py +11 -0
  9. package/micropython-esp32/esp32-libs/esp32-c3-oled-mini/boot.py +14 -0
  10. package/micropython-esp32/esp32-libs/esp32-c3-oled-mini/display.py +67 -0
  11. package/micropython-esp32/esp32-libs/esp32-c3-oled-mini/ssd1306.py +164 -0
  12. package/micropython-esp32/esp32-libs/esp32-c3-oled-mini/webrepl_cfg.py +1 -0
  13. package/micropython-esp32/esp32-libs/esp32-c3-oled-mini/wifi.py +135 -0
  14. package/micropython-esp32/esp32-libs/esp32-c3-oled-mini/wifi_config.py +11 -0
  15. package/micropython-esp32/esp32-libs/esp32-s3-zero/boot.py +14 -0
  16. package/micropython-esp32/esp32-libs/esp32-s3-zero/webrepl_cfg.py +1 -0
  17. package/micropython-esp32/esp32-libs/esp32-s3-zero/wifi.py +135 -0
  18. package/micropython-esp32/esp32-libs/esp32-s3-zero/wifi_config.py +11 -0
  19. package/micropython-esp32/esp32-libs/esp32-wroom-devkit/boot.py +14 -0
  20. package/micropython-esp32/esp32-libs/esp32-wroom-devkit/webrepl_cfg.py +1 -0
  21. package/micropython-esp32/esp32-libs/esp32-wroom-devkit/wifi.py +135 -0
  22. package/micropython-esp32/esp32-libs/esp32-wroom-devkit/wifi_config.py +11 -0
  23. package/micropython-esp32/http-request.d.ts +4 -1
  24. package/micropython-esp32/lang.d.ts +60 -2
  25. package/micropython-esp32/main.d.ts +0 -1
  26. package/micropython-esp32/micropython.es.d.ts +1 -0
  27. package/micropython-esp32/micropython.es.js +338 -196
  28. package/micropython-esp32/micropython.umd.js +14 -14
  29. package/micropython-esp32/plugin.json +6 -0
  30. package/micropython-esp32/types.d.ts +0 -1
  31. package/micropython-esp32/upy-websockect.d.ts +30 -3
  32. package/package.json +1 -1
  33. package/micropython-esp32/esp32-libs/boot.py +0 -13
  34. package/micropython-esp32/esp32-libs/wifi.py +0 -77
  35. 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 h = "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(h, 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(h, 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(h, 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(h, 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(h, 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 S(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 S(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 S(e, t) {
171
174
  return [o, t.ORDER_NONE];
172
175
  };
173
176
  }
174
- function L(e, t) {
175
- V(e, t), I(e, t), M(e, t), P(e, t), S(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,81 +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 s = /* @__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))(s || {}), 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 || {}), D = /* @__PURE__ */ ((e) => (e[e.WEBSOCKET = 0] = "WEBSOCKET", e[e.TCP_IP = 1] = "TCP_IP", e[e.SERIAL = 2] = "SERIAL", e))(D || {});
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 _ = /* @__PURE__ */ ((e) => (e.WIFI = "wifi", e.SERIAL = "serial", e))(_ || {});
520
- const G = "http://" + location.hostname, z = "8080", q = "cors", Y = "nodemcu/";
521
- async function Z(e, t) {
522
+ var w = /* @__PURE__ */ ((e) => (e.WIFI = "wifi", e.SERIAL = "serial", e))(w || {});
523
+ async function te(e, t, i) {
524
+ const n = window.catalejo;
525
+ if (!n)
526
+ throw { message: "El editor no ofrece la conexión con el backend (window.catalejo)" };
527
+ return await n.call(e, t, i);
528
+ }
529
+ async function ie() {
522
530
  try {
523
- const n = await (await fetch(e, t)).json();
524
- return n.status == s.OK, n;
525
- } catch (i) {
526
- return console.error(i), { status: s.FAILED };
531
+ const e = await te("serial.list", {});
532
+ return { status: l.OK, data: e.ports };
533
+ } catch (e) {
534
+ return console.error("serial.list", e), { status: l.FAILED, data: (e == null ? void 0 : e.message) || String(e) };
527
535
  }
528
536
  }
529
- async function Q() {
530
- const e = Y + "getserialportlist", t = G + ":" + z + "/" + e, n = {
531
- method: "PUT",
532
- mode: q,
533
- headers: {
534
- "Content-Type": "application/json"
535
- },
536
- body: JSON.stringify({})
537
- };
538
- return await Z(t, n);
539
- }
540
- function m(e) {
537
+ const R = 64, ne = 5e3, O = 5e3;
538
+ function x(e) {
541
539
  return new Promise((t) => setTimeout(t, e));
542
540
  }
543
- async function J(e, t, i) {
544
- typeof t == "string" ? t = new TextEncoder().encode(t) : t instanceof Uint8Array || (t = new Uint8Array(t));
545
- const n = new WebSocket("ws://" + i.ipPy + ":" + i.portPy + "/");
546
- return n.binaryType = "arraybuffer", new Promise((a) => {
547
- n.onmessage = (o) => {
548
- console.log(o.data);
549
- }, n.onopen = async function() {
550
- console.log("WebSocket connection opened."), await m(100), console.log("This password: " + i.passwordPy), n.send(i.passwordPy + "\r"), await m(100);
551
- const o = t.length, d = e;
552
- let l = new Uint8Array(82);
553
- l[0] = 87, l[1] = 65, l[2] = 1, l[3] = 0, l[4] = 0, l[5] = 0, l[6] = 0, l[7] = 0, l[8] = 0, l[9] = 0, l[10] = 0, l[11] = 0, l[12] = o & 255, l[13] = o >> 8 & 255, l[14] = o >> 16 & 255, l[15] = o >> 24 & 255, l[16] = d.length & 255, l[17] = d.length >> 8 & 255;
554
- for (var u = 0; u < 64; ++u)
555
- u < d.length ? l[18 + u] = d.charCodeAt(u) : l[18 + u] = 0;
556
- console.log("Send file to micropython: " + e), n.send(l), n.onmessage = async function() {
557
- for (let f = 0; f < t.length; f += i.chuckSizePy) {
558
- const F = t.slice(f, f + i.chuckSizePy);
559
- console.log(F), n.send(F), await m(i.sleepTimePy);
560
- }
561
- n.send(""), m(100), n.close(), a({ status: s.OK, data: "File uploaded" });
562
- };
563
- }, n.onerror = function(o) {
564
- a({ status: s.FAILED, data: "WebSocket error" + o });
565
- }, n.onclose = function() {
566
- console.log("WebSocket connection closed.");
567
- };
568
- });
569
- }
570
- async function $(e, t) {
571
- const i = new WebSocket("ws://" + t.ipPy + ":" + t.portPy + "/");
572
- return new Promise((n) => {
573
- i.onopen = async function() {
574
- await m(100), i.send(t.passwordPy + "\r"), await m(100), i.send(e), await m(100), i.close(), n({ status: s.OK, data: "File uploaded" });
575
- }, i.onerror = function(a) {
576
- n({ status: s.FAILED, data: "WebSocket error" + a });
577
- }, i.onclose = function() {
578
- console.log("WebSocket connection closed.");
579
- }, i.onmessage = (a) => {
580
- 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();
581
558
  };
582
- });
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) } };
661
+ }
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
+ }
583
672
  }
584
- const c = {
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 = {
585
684
  micropythonSend: {
586
685
  en: "Send",
587
686
  es: "Enviar"
@@ -610,22 +709,54 @@ const c = {
610
709
  en: "Run terminal",
611
710
  es: "Conectersa a micropython"
612
711
  }
613
- }, j = {
712
+ }, se = {
614
713
  docs: {
615
714
  title: {
616
715
  en: "Micropython documentation",
617
716
  es: "Documentación para Micropython"
618
- },
619
- description: {
620
- en: "Open the next link to get information about Micropython",
621
- es: " Abre el siguiente enlace para obtener información sobre Micropython"
622
717
  }
623
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
+ }
624
755
  };
625
756
  function p(e, t) {
626
- return t == k.EN ? e.en : t == k.ES ? e.es : "noname";
757
+ return t == F.EN ? e.en : t == F.ES ? e.es : "noname";
627
758
  }
628
- function O(e) {
759
+ function P(e) {
629
760
  return {
630
761
  ipPy: e.ip_mpy != null && e.ip_mpy != "" ? e.ip_mpy : "",
631
762
  portPy: e.port_mpy != null && e.port_mpy != "" ? e.port_mpy : "8266",
@@ -634,36 +765,55 @@ function O(e) {
634
765
  chuckSizePy: e.chuckSize_mpy != null && e.chuckSize_mpy != "" ? parseInt(e.chuckSize_mpy) : 1024
635
766
  };
636
767
  }
637
- function ee(e, t) {
638
- return e.extension == C ? { status: s.OK, data: e.content } : e.extension == v && e.config.platform == E ? { status: s.OK, data: t() } : { status: s.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 };
639
770
  }
640
- function te(e) {
641
- return e.extension == C ? e.config.filename != "" && e.config.filename != null ? { status: s.OK, data: e.config.filename } : { status: s.OK, data: e.filename } : e.extension == v && e.config.platform == E ? e.config.filename != "" && e.config.filename != null ? { status: s.OK, data: e.config.filename } : { status: s.OK, data: W } : { status: s.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 };
642
773
  }
643
- async function ie(e, t) {
644
- const i = O(e.config);
774
+ async function de(e, t) {
775
+ const i = P(e.config);
645
776
  if (i.ipPy == "")
646
- return { status: s.FAILED };
777
+ return { status: l.FAILED, data: { code: "noIp" } };
647
778
  let n;
648
- if (n = te(e), n.status == s.FAILED)
649
- return n;
779
+ if (n = re(e), n.status == l.FAILED)
780
+ return { status: l.FAILED, data: { code: "noContent" } };
650
781
  const a = n.data;
651
- if (n = ee(e, t), n.status == s.FAILED)
652
- return n;
782
+ if (n = le(e, t), n.status == l.FAILED)
783
+ return { status: l.FAILED, data: { code: "noContent" } };
653
784
  const o = n.data;
654
- return n = await J(a, o, i), n;
785
+ return await ae(a, o, i);
655
786
  }
656
- async function ne(e, t) {
657
- return e.config.send == _.WIFI && (await ie(e, t)).status == s.OK ? {
658
- 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,
659
802
  data: {
660
- severity: "success",
661
- summary: "Code save Ok",
662
- detail: "",
663
- life: 3e3
803
+ severity: "warn",
804
+ summary: p(g[n], t),
805
+ detail: o,
806
+ life: 8e3
664
807
  }
665
- } : {
666
- 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,
667
817
  data: {
668
818
  severity: "warn",
669
819
  summary: "TODO from send on micropython",
@@ -672,57 +822,49 @@ async function ne(e, t) {
672
822
  }
673
823
  };
674
824
  }
675
- async function R(e, t) {
676
- const i = O(e.config);
677
- return i.ipPy == "" ? { status: s.FAILED } : await $(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);
678
828
  }
679
- async function ae(e) {
680
- return e.config.send == _.WIFI && (await R(e, "from machine import reset\rreset()\r")).status == s.OK ? {
681
- typeResult: r.TOAST,
682
- data: {
683
- severity: "success",
684
- summary: "Reset command send",
685
- detail: "",
686
- life: 3e3
687
- }
688
- } : {
689
- 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,
690
836
  data: {
691
837
  severity: "warn",
692
838
  summary: "Failed soft reset micropython",
693
839
  detail: "",
694
- life: 1e3
840
+ life: 3e3
695
841
  }
696
842
  };
697
843
  }
698
- async function oe(e) {
699
- return e.config.send == _.WIFI && (await R(e, "")).status == s.OK ? {
700
- typeResult: r.TOAST,
701
- data: {
702
- severity: "success",
703
- summary: "Run main command send",
704
- detail: "",
705
- life: 3e3
706
- }
707
- } : {
708
- 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,
709
851
  data: {
710
852
  severity: "warn",
711
853
  summary: "Failed run main micropython",
712
854
  detail: "",
713
- life: 1e3
855
+ life: 3e3
714
856
  }
715
857
  };
716
858
  }
717
- async function se(e) {
859
+ async function ue(e) {
718
860
  const t = e.config.send, i = e.config;
719
- if (t == _.WIFI) {
861
+ if (t == w.WIFI) {
720
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";
721
863
  if (n != "")
722
864
  return {
723
- typeResult: r.TERM,
865
+ typeResult: d.TERM,
724
866
  data: {
725
- typeConnection: D.WEBSOCKET,
867
+ typeConnection: M.WEBSOCKET,
726
868
  data: {
727
869
  ip: n,
728
870
  port: a,
@@ -734,7 +876,7 @@ async function se(e) {
734
876
  };
735
877
  }
736
878
  return {
737
- typeResult: r.TOAST,
879
+ typeResult: d.TOAST,
738
880
  data: {
739
881
  severity: "warn",
740
882
  summary: "Failed open terminal micropython",
@@ -743,15 +885,15 @@ async function se(e) {
743
885
  }
744
886
  };
745
887
  }
746
- async function le(e, t) {
747
- return e.extension == v ? {
748
- typeResult: r.TEXT_PRINT,
888
+ async function he(e, t) {
889
+ return e.extension == C ? {
890
+ typeResult: d.TEXT_PRINT,
749
891
  data: {
750
892
  title: "Python",
751
893
  content: t()
752
894
  }
753
895
  } : {
754
- typeResult: r.TOAST,
896
+ typeResult: d.TOAST,
755
897
  data: {
756
898
  severity: "warn",
757
899
  summary: "Opción disponible solo con archivos blockly (json)",
@@ -760,15 +902,15 @@ async function le(e, t) {
760
902
  }
761
903
  };
762
904
  }
763
- async function re() {
764
- const e = await Q();
765
- if (e.status == s.OK) {
905
+ async function _e() {
906
+ const e = await ie();
907
+ if (e.status == l.OK) {
766
908
  let t = "";
767
909
  for (let i = 0; i < e.data.length; i++)
768
910
  t += e.data[i] + `
769
911
  `;
770
912
  return {
771
- typeResult: r.TEXT_PRINT,
913
+ typeResult: d.TEXT_PRINT,
772
914
  data: {
773
915
  title: "SerialPortList",
774
916
  content: t
@@ -776,7 +918,7 @@ async function re() {
776
918
  };
777
919
  } else
778
920
  return {
779
- typeResult: r.TOAST,
921
+ typeResult: d.TOAST,
780
922
  data: {
781
923
  severity: "warn",
782
924
  summary: "No se pudo obtener información sobre los puertos seriales",
@@ -785,35 +927,35 @@ async function re() {
785
927
  }
786
928
  };
787
929
  }
788
- async function de(e) {
930
+ async function fe(e) {
789
931
  const a = "http://" + location.hostname + ":" + 8080 + "/plugins/nodemcu/docs/index.html";
790
932
  return {
791
- typeResult: r.URL_PRINT,
933
+ typeResult: d.URL_PRINT,
792
934
  data: {
793
- title: p(j.docs.title, e),
935
+ title: p(se.docs.title, e),
794
936
  content: a,
795
937
  description: "Abre el siguiente enlace para obtener infomación sobre la documentación de nodemcu"
796
938
  }
797
939
  };
798
940
  }
799
- let g, x, A;
800
- const pe = E, ce = U, me = K, ue = X;
801
- function he(e, t, i) {
802
- A = e, g = t, x = i, L(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);
803
945
  }
804
- function T() {
805
- return H(g, x);
946
+ function I() {
947
+ return Q(T, S);
806
948
  }
807
- const _e = B;
808
- function fe(e) {
949
+ const Ee = Z;
950
+ function Fe(e) {
809
951
  return [
810
952
  {
811
- label: p(c.magic, e),
953
+ label: p(u.magic, e),
812
954
  icon: "pi pi-sparkles",
813
955
  command: "micropython-magic"
814
956
  },
815
957
  {
816
- label: p(c.micropythonSend, e),
958
+ label: p(u.micropythonSend, e),
817
959
  icon: "pi pi-send",
818
960
  command: "micropython-send"
819
961
  },
@@ -822,27 +964,27 @@ function fe(e) {
822
964
  icon: "pi pi-microchip",
823
965
  items: [
824
966
  {
825
- label: p(c.getSerialportList, e),
967
+ label: p(u.getSerialportList, e),
826
968
  icon: "pi pi-search",
827
969
  command: "nodemcu-getserialportlist"
828
970
  },
829
971
  {
830
- label: p(c.docs, e),
972
+ label: p(u.docs, e),
831
973
  icon: "pi pi-book",
832
974
  command: "micropython-docs"
833
975
  },
834
976
  {
835
- label: p(c.reset, e),
977
+ label: p(u.reset, e),
836
978
  icon: "pi pi-refresh",
837
979
  command: "micropython-reset"
838
980
  },
839
981
  {
840
- label: p(c.play, e),
982
+ label: p(u.play, e),
841
983
  icon: "pi pi-play",
842
984
  command: "micropython-play"
843
985
  },
844
986
  {
845
- label: p(c.term, e),
987
+ label: p(u.term, e),
846
988
  icon: "pi pi-sync",
847
989
  command: "micropython-term"
848
990
  }
@@ -850,9 +992,9 @@ function fe(e) {
850
992
  }
851
993
  ];
852
994
  }
853
- async function ye(e, t, i) {
854
- return t == "micropython-send" ? await ne(e, T) : t == "micropython-magic" ? await le(e, T) : t == "nodemcu-getserialportlist" ? await re() : t == "micropython-docs" ? await de(i) : t == "micropython-reset" ? await ae(e) : t == "micropython-play" ? await oe(e) : t == "micropython-term" ? await se(e) : {
855
- 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,
856
998
  data: {
857
999
  severity: "error",
858
1000
  summary: "Función no localizada en el plugin",
@@ -862,13 +1004,13 @@ async function ye(e, t, i) {
862
1004
  };
863
1005
  }
864
1006
  export {
865
- me as blockly_template,
866
- ye as commandEmit,
867
- T as generateCode,
868
- fe as getItemsToolBarOfPlugin,
869
- he as initBlockly,
870
- ue as lang_template,
871
- pe as platform,
872
- ce as platformLang,
873
- _e 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
874
1016
  };