mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-11-09 16:41:21 +08:00
AP_Scripting: cleanup debug option handling
This commit is contained in:
1 parent
79b596d229
commit
66752996e4
4 files changed
+33
-23
No files matched your search
@@ -380,7 +380,7 @@ void AP_Scripting::thread(void) {
|
||||
GCS_SEND_TEXT(MAV_SEVERITY_CRITICAL, "Scripting: %s", "restarted");
|
||||
break;
|
||||
}
|
||||
if ((_debug_options.get() & uint8_t(lua_scripts::DebugLevel::NO_SCRIPTS_TO_RUN)) != 0) {
|
||||
if (option_is_set(DebugOption::NO_SCRIPTS_TO_RUN)) {
|
||||
GCS_SEND_TEXT(MAV_SEVERITY_DEBUG, "Scripting: %s", "stopped");
|
||||
}
|
||||
}
|
||||
@@ -420,7 +420,7 @@ void AP_Scripting::handle_mission_command(const AP_Mission::Mission_Command& cmd
|
||||
|
||||
bool AP_Scripting::arming_checks(size_t buflen, char *buffer) const
|
||||
{
|
||||
if (!enabled() || ((_debug_options.get() & uint8_t(lua_scripts::DebugLevel::DISABLE_PRE_ARM)) != 0)) {
|
||||
if (!enabled() || option_is_set(DebugOption::DISABLE_PRE_ARM)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -518,9 +518,7 @@ void AP_Scripting::update() {
|
||||
// Check if DEBUG_OPTS bit has been set to save current checksum values to params
|
||||
void AP_Scripting::save_checksum() {
|
||||
|
||||
const uint8_t opts = _debug_options.get();
|
||||
const uint8_t save_bit = uint8_t(lua_scripts::DebugLevel::SAVE_CHECKSUM);
|
||||
if ((opts & save_bit) == 0) {
|
||||
if (!option_is_set(DebugOption::SAVE_CHECKSUM)) {
|
||||
// Bit not set, nothing to do
|
||||
return;
|
||||
}
|
||||
@@ -530,7 +528,7 @@ void AP_Scripting::save_checksum() {
|
||||
_required_running_checksum.set_and_save(lua_scripts::get_running_checksum() & checksum_param_mask);
|
||||
|
||||
// Un-set debug option bit
|
||||
_debug_options.set_and_save(opts & ~save_bit);
|
||||
option_clear(DebugOption::SAVE_CHECKSUM);
|
||||
|
||||
GCS_SEND_TEXT(MAV_SEVERITY_ERROR, "Scripting: %s", "saved checksums");
|
||||
|
||||
|
||||
Reference in new issue
Block a user