-
Notifications
You must be signed in to change notification settings - Fork 18k
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
Avoid use of AP_Logger.h in library headers #27965
Conversation
@@ -250,7 +250,23 @@ void AP_AutoTune::update(AP_PIDInfo &pinfo, float scaler, float angle_err_deg) | |||
#if HAL_LOGGING_ENABLED | |||
if (now - last_log_ms >= 40) { | |||
// log at 25Hz | |||
struct log_ATRP pkt = { | |||
const struct PACKED { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have expected this to be deleted from where ever it is now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I remember now. We can't move the definition of this into the .cpp file. log_ATRP is included into ArduPlane's log structure:
SCB-WAF: [1166/1206] Compiling ArduPlane/mode.cpp../../ArduPlane/Log.cpp:363:41: error: 'log_ATRP' is not a member of 'AP_AutoTune'
SCB-WAF: ../../ArduPlane/Log.cpp:363:41: error: 'log_ATRP' is not a member of 'AP_AutoTune' 363 | { LOG_ATRP_MSG, sizeof(AP_AutoTune::log_ATRP),
SCB-WAF: 363 | { LOG_ATRP_MSG, sizeof(AP_AutoTune::log_ATRP), | ^~~~~~~~
SCB-WAF: | ^~~~~~~~compilation terminated due to -Wfatal-errors.
... I discovered that but only half-undid the change :-(
I really think we should look at changing this to a WriteStreaming or similar...
@@ -1,6 +1,5 @@ | |||
#pragma once | |||
|
|||
#include <AP_Logger/AP_Logger.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove logstructure.h here too, if you remove log_ATRP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, can't do that as that message is included in ArduPlane's LogStructure!
Should probably be a WriteStreaming call instead, but for now I've put it back in the header, where we only need AP_Logger/LogStructure.h
, not AP_Logger.h
, which is the important change.
86b457d
to
86b7920
Compare
this pulls in many more headers, we should avoid using it whereever we can
this pulls in many more headers, we should avoid using it whereever we can
86b7920
to
6aa995a
Compare
Still no compiler output changes with this. |
this pulls in many more headers, we should avoid using it whereever we can