Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added send_text via scripting for onboard display #26066

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

haydendonald
Copy link
Contributor

Added the ability to override the default text on the onboard oled display using scripting.

One can use notify:send_text(text, row) to update a given row on the display, this will take priority over the default. You can replace the entire screen or any desired line, for example if i don't care about battery i can use scripting to replace it with other information.

This has been tested on a Cube Orange Plus with a SSH1106.

image
image

@IamPete1
Copy link
Member

We do have a previous PR for this, #15857. It looks like this is a "forever" override? Can you revert to AP control?

@haydendonald
Copy link
Contributor Author

We do have a previous PR for this, #15857. It looks like this is a "forever" override? Can you revert to AP control?

Curious, by the looks the other PR went quiet?

Yeah can do, just didn't add it as it wasn't required for our use. I can either add a timeout like in the other PR, or add a func to release a row, or both, what do you think is best? All that needs to be done is unsetting the bit.

@IamPete1
Copy link
Member

Curious, by the looks the other PR went quiet?

Yeah, It just got forgotten about.

Yeah can do, just didn't add it as it wasn't required for our use. I can either add a timeout like in the other PR, or add a func to release a row, or both, what do you think is best? All that needs to be done is unsetting the bit.

I think a reset method would be good, the timeout thing is unnecessarily fancy I think.

libraries/AP_Notify/AP_Notify.cpp Outdated Show resolved Hide resolved
@@ -248,6 +252,8 @@ class AP_Notify
uint32_t _send_text_updated_millis; // last time text changed
char _flight_mode_str[5];

uint8_t _send_text_src_override = 0; //Bitmask of what lines send_text_src should override
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be in the display backend.

Copy link
Member

Choose a reason for hiding this comment

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

Bump.

Copy link
Member

Choose a reason for hiding this comment

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

send_text and send_text_scripting currently treats all screens as duplicates, basically state information is common between backends, duplicating the variables in backend doesn't make sense with current structure. We are keeping standard send_text related variable here as well. So, again they all are sitting together as they should.

libraries/AP_Notify/Display.cpp Outdated Show resolved Hide resolved
libraries/AP_Notify/AP_Notify.h Outdated Show resolved Hide resolved
libraries/AP_Notify/Display.cpp Outdated Show resolved Hide resolved
libraries/AP_Notify/Display.cpp Outdated Show resolved Hide resolved
libraries/AP_Notify/Display.cpp Outdated Show resolved Hide resolved
libraries/AP_Notify/Display.cpp Outdated Show resolved Hide resolved
libraries/AP_Scripting/docs/docs.lua Outdated Show resolved Hide resolved
libraries/AP_Scripting/examples/hello_world_display.lua Outdated Show resolved Hide resolved
libraries/AP_Notify/Display.cpp Outdated Show resolved Hide resolved
libraries/AP_Scripting/examples/hello_world_display.lua Outdated Show resolved Hide resolved
libraries/AP_Notify/AP_Notify.h Outdated Show resolved Hide resolved
@@ -248,6 +252,8 @@ class AP_Notify
uint32_t _send_text_updated_millis; // last time text changed
char _flight_mode_str[5];

uint8_t _send_text_src_override = 0; //Bitmask of what lines send_text_src should override
Copy link
Member

Choose a reason for hiding this comment

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

Bump.

libraries/AP_Notify/AP_Notify.cpp Outdated Show resolved Hide resolved
@tridge tridge removed the DevCallEU label Jan 31, 2024
libraries/AP_Notify/Display.cpp Outdated Show resolved Hide resolved
@haydendonald haydendonald force-pushed the pr-add-notify-display-lua branch 6 times, most recently from 3f00ac9 to 6f61b79 Compare February 7, 2024 04:32
Added a send_test_src method to override the text on the display and display custom text on a given row
Added a notify:send_text and notify:release_text binding to override the text displayed on a display with custom text
@IamPete1 IamPete1 dismissed peterbarker’s stale review February 7, 2024 23:52

Battery changes done in #26106 and scripting defines added.

@IamPete1 IamPete1 merged commit baf8958 into ArduPilot:master Feb 7, 2024
93 checks passed
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.

5 participants