Replies: 3 comments 4 replies
-
Works fine on a ESP32, preview 1.24.0-110, fails at an earlier version of the firmware, like v1.23.0. Same for RPI Pico. |
Beta Was this translation helpful? Give feedback.
-
I don't remember the full context or exactly when but I think there was a recent change to the way these kind of "maximum integers" are handled to deal with an inconsistency like this. |
Beta Was this translation helpful? Give feedback.
-
There is no bug here. You cannot pass arbitrary arguments to the The only values that should be passed to Only the result of (Under the hood, there's a difference between small and big integers, and the ticks functions consider all their arguments as small ints without checking. So if you pass a big int in then you get undefined behaviour, because you're operating on a pointer value rather than a small int value.) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
while testing some Micro Python (v1.20 & v1.23) code on an ESP32-D0WD-V3 (revision v3.1) integers with the same value led to different function results/behavior:
Code:
Output:
Perhaps a,b,c are represented differently in the C-Code below? Something seems to happen at value 2**30.
Don't know if this behavior is specific to the esp32 or more generally about MicroPython.
Please test the code below on other ports too - perhaps with an other power of 2 there.
For testing I set
MAX = (2**30)-1
and ran into trouble withtime.ticks_diff(MAX,0)]
.time.ticks_us()
may returnMAX
in a representation that doesn't fail andMAX = time.ticks_add(0,-1)
generates the same value like
MAX = (2**30)-1
without failure withtime.ticks_diff(MAX,0)
.But I think the result of a function shouldn't depend on the way an equal input value was created.
Since it also effects the format string, I fear to run into other problems (in worst case without noticing).
Therefore I think it's a bug.
Have a great week!
c-max
Beta Was this translation helpful? Give feedback.
All reactions