Riot: Serial.print (float) de Arduino no funciona

Creado en 27 oct. 2020  ·  5Comentarios  ·  Fuente: RIOT-OS/RIOT

Descripción

Serial.print(float) Arduino no imprime nada.

Pasos para reproducir el problema

Por ejemplo, modifiqué tests/sys_arduino/arduino-test.sketch para probar flotadores también, esta es la diferencia:

iff --git tests/sys_arduino/arduino-test.sketch tests/sys_arduino/arduino-test.sketch
index 1aa30a9cb..59c2da2c9 100644
--- tests/sys_arduino/arduino-test.sketch
+++ tests/sys_arduino/arduino-test.sketch
@@ -105,6 +105,10 @@ static void print_test(void)
         Serial.print("): ");
         Serial.println(ul, f);
     }
+
+    Serial.print("print(float): ");
+    Serial.print((float)3.14);
+    Serial.println();
 }

 void loop(void)

Resultados previstos

2020-10-27 12:03:55,271 # Hello Arduino!
print
2020-10-27 12:03:57,307 # print(int, BIN): 1111101011000111
[...]
2020-10-27 12:03:58,441 # println(unsigned long, HEX): 499602d2
2020-10-27 12:03:58,458 # print(float): 3.14

Resultados actuales

Este es el resultado que obtengo, probado con Arduino Uno:

2020-10-27 12:03:55,271 # Hello Arduino!
print
2020-10-27 12:03:57,307 # print(int, BIN): 1111101011000111
[...]
2020-10-27 12:03:58,441 # println(unsigned long, HEX): 499602d2
2020-10-27 12:03:58,458 # print(float): 

Versiones

Operating System Environment
----------------------------
         Operating System: Gentoo 
                   Kernel: Linux 5.4.66-gentoo x86_64 Intel(R) Core(TM) i3-5010U CPU @ 2.10GHz
             System shell: GNU bash, version 5.0.18(1)-release (x86_64-pc-linux-gnu)
             make's shell: GNU bash, version 5.0.18(1)-release (x86_64-pc-linux-gnu)

Installed compiler toolchains
-----------------------------
               native gcc: gcc (Gentoo 9.3.0-r1 p3) 9.3.0
        arm-none-eabi-gcc: arm-none-eabi-gcc (GNU Arm Embedded Toolchain 9-2020-q2-update) 9.3.1 20200408 (release)
                  avr-gcc: avr-gcc (Gentoo 9.3.0-r1 p3) 9.3.0
         mips-mti-elf-gcc: missing
           msp430-elf-gcc: missing
       riscv-none-elf-gcc: missing
  riscv64-unknown-elf-gcc: missing
     riscv-none-embed-gcc: missing
     xtensa-esp32-elf-gcc: missing
   xtensa-esp8266-elf-gcc: missing
                    clang: clang version 10.0.1 

Installed compiler libs
-----------------------
     arm-none-eabi-newlib: "3.3.0"
      mips-mti-elf-newlib: missing
        msp430-elf-newlib: missing
    riscv-none-elf-newlib: missing
riscv64-unknown-elf-newlib: missing
  riscv-none-embed-newlib: missing
  xtensa-esp32-elf-newlib: missing
xtensa-esp8266-elf-newlib: missing
                 avr-libc: "2.0.0" ("20150208")

Installed development tools
---------------------------
                   ccache: missing
                    cmake: cmake version 3.17.4
                 cppcheck: Cppcheck 1.88
                  doxygen: 1.8.17
                      git: git version 2.26.2
                     make: GNU Make 4.2.1
                  openocd: missing
                   python: Python 3.7.9
                  python2: Python 2.7.18
                  python3: Python 3.7.9
                   flake8: 3.8.1 (mccabe: 0.6.1, pycodestyle: 2.6.0, pyflakes: 2.2.0) CPython 3.7.9 on
               coccinelle: missing
arduino API bug

Todos 5 comentarios

15314 está solucionando este problema, ¿puedes confirmar @jdavid ?

@aabadie La prueba ya no cabe en la memoria (Arduino Uno), así que tuve que comentar las líneas de arriba. ¡Pero sí, funciona!

La prueba ya no cabe en la memoria (Arduino Uno)

Extraño, encaja cuando construyo en Docker (como se informa en el n. ° 15314). ¿Cuál es la versión de su cadena de herramientas AVR?

$ avr-g++ --version
avr-g++ (Gentoo 9.3.0-r1 p3) 9.3.0
$ eix-installed -a | grep avr
cross-avr/avr-libc-2.0.0
cross-avr/binutils-2.34-r2
cross-avr/gcc-9.3.0-r1
dev-embedded/avrdude-6.3

Ok, entonces tu versión es mucho más reciente que la predeterminada de RIOT:

$ docker run --rm -ti riot/riotbuild avr-g++ --version
avr-g++ (GCC) 5.4.0
[...]

Creo que esto explica la diferencia en el tamaño del código.

¿Fue útil esta página
0 / 5 - 0 calificaciones