Skip to content

Berry tasmota.micros() to get time in microseconds#24192

Merged
s-hadinger merged 9 commits into
arendst:developmentfrom
s-hadinger:berry_tasmota_micros
Dec 6, 2025
Merged

Berry tasmota.micros() to get time in microseconds#24192
s-hadinger merged 9 commits into
arendst:developmentfrom
s-hadinger:berry_tasmota_micros

Conversation

@s-hadinger
Copy link
Copy Markdown
Collaborator

Description:

New function to get current time in microseconds to get finer measurement than tasmota.millis(). Be careful that the counter changes sign every hour.

Also changed tasmota.millis() to a static method.

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.8
  • The code change is tested and works with Tasmota core ESP32 V.3.1.6
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@s-hadinger s-hadinger merged commit 7d0f351 into arendst:development Dec 6, 2025
64 checks passed
@Jason2866
Copy link
Copy Markdown
Collaborator

@s-hadinger This changes are breaking the haspmota Watch 480x480 Demo TAPP.
Probably not just this demo.

Jason2866 added a commit to Jason2866/Tasmota that referenced this pull request Dec 8, 2025
if (top == 1 || (top == 2 && be_isint(vm, 2))) { // only 1 argument of type string accepted
if (top == 0 || (top == 1 && be_isint(vm, 1))) { // only 1 argument of type string accepted
uint32_t delay = 0;
if (top == 2) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this needs be if (top == 1) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally no, because it is now a static method, so it does not have the default self first argument.

Let's revert this PR so we can identify the breaking change. I suppose that there is some code that expects 'tasmota.millis()' to being not static

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a miscommunication coming.

The change from line 122 is in your failing PR. My suggestion is in line 124 which will never execute when line 122 is changed that way.

In the meantime @Jason2866 tested my change with success so....

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

micros is really short. Makes this sense in general in Berry?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does. I’m doing profiling for leds animation on a very slow esp32s2 so it magnifies performance issues. In such cases, milliseconds is too coarse

arendst added a commit that referenced this pull request Dec 9, 2025
@s-hadinger s-hadinger mentioned this pull request Dec 9, 2025
6 tasks
echo-bravo-yahoo pushed a commit to echo-bravo-yahoo/Tasmota that referenced this pull request Jan 9, 2026
* Remove tab from json

* Berry `tasmota.micros()` to get time in microseconds
echo-bravo-yahoo pushed a commit to echo-bravo-yahoo/Tasmota that referenced this pull request Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants