mirror of https://github.com/ArduPilot/ardupilot
AP_Scripting: allow AP_SCRIPTING_ENABLED to come from hwdef files
This commit is contained in:
parent
3aaeb0f29c
commit
d519ab604e
|
@ -13,6 +13,10 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "AP_Scripting_config.h"
|
||||||
|
|
||||||
|
#if AP_SCRIPTING_ENABLED
|
||||||
|
|
||||||
#include <AP_Scripting/AP_Scripting.h>
|
#include <AP_Scripting/AP_Scripting.h>
|
||||||
#include <AP_HAL/AP_HAL.h>
|
#include <AP_HAL/AP_HAL.h>
|
||||||
#include <GCS_MAVLink/GCS.h>
|
#include <GCS_MAVLink/GCS.h>
|
||||||
|
@ -364,3 +368,5 @@ namespace AP {
|
||||||
return AP_Scripting::get_singleton();
|
return AP_Scripting::get_singleton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // AP_SCRIPTING_ENABLED
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <AP_HAL/AP_HAL_Boards.h>
|
||||||
|
|
||||||
|
#ifndef AP_SCRIPTING_ENABLED
|
||||||
|
#define AP_SCRIPTING_ENABLED BOARD_FLASH_SIZE > 1024
|
||||||
|
#endif
|
|
@ -1,3 +1,7 @@
|
||||||
|
#include "AP_Scripting_config.h"
|
||||||
|
|
||||||
|
#if AP_SCRIPTING_ENABLED
|
||||||
|
|
||||||
#include "AP_Scripting_helpers.h"
|
#include "AP_Scripting_helpers.h"
|
||||||
#include <AP_Scripting/lua_generated_bindings.h>
|
#include <AP_Scripting/lua_generated_bindings.h>
|
||||||
|
|
||||||
|
@ -192,3 +196,5 @@ bool Parameter::set_default(float value)
|
||||||
// not a supported type
|
// not a supported type
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // AP_SCRIPTING_ENABLED
|
||||||
|
|
|
@ -2810,7 +2810,11 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(source, "// auto generated bindings, don't manually edit. See README.md for details.\n");
|
fprintf(source, "// auto generated bindings, don't manually edit. See README.md for details.\n");
|
||||||
|
|
||||||
|
fprintf(source, "#include <AP_Scripting/AP_Scripting_config.h>\n\n");
|
||||||
|
|
||||||
|
fprintf(source, "#if AP_SCRIPTING_ENABLED\n\n");
|
||||||
|
|
||||||
trace(TRACE_GENERAL, "Sanity checking parsed input");
|
trace(TRACE_GENERAL, "Sanity checking parsed input");
|
||||||
|
|
||||||
sanity_check_userdata();
|
sanity_check_userdata();
|
||||||
|
@ -2864,6 +2868,8 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
emit_sandbox();
|
emit_sandbox();
|
||||||
|
|
||||||
|
fprintf(source, "#endif // AP_SCRIPTING_ENABLED\n");
|
||||||
|
|
||||||
fclose(source);
|
fclose(source);
|
||||||
source = NULL;
|
source = NULL;
|
||||||
|
|
||||||
|
@ -2875,6 +2881,8 @@ int main(int argc, char **argv) {
|
||||||
free(file_name);
|
free(file_name);
|
||||||
fprintf(header, "#pragma once\n");
|
fprintf(header, "#pragma once\n");
|
||||||
fprintf(header, "// auto generated bindings, don't manually edit. See README.md for details.\n");
|
fprintf(header, "// auto generated bindings, don't manually edit. See README.md for details.\n");
|
||||||
|
fprintf(header, "#include <AP_Scripting/AP_Scripting_config.h>\n\n");
|
||||||
|
fprintf(header, "#if AP_SCRIPTING_ENABLED\n\n");
|
||||||
fprintf(header, "#include <AP_Vehicle/AP_Vehicle_Type.h> // needed for APM_BUILD_TYPE #if\n");
|
fprintf(header, "#include <AP_Vehicle/AP_Vehicle_Type.h> // needed for APM_BUILD_TYPE #if\n");
|
||||||
emit_headers(header);
|
emit_headers(header);
|
||||||
fprintf(header, "#include <AP_Scripting/lua/src/lua.hpp>\n");
|
fprintf(header, "#include <AP_Scripting/lua/src/lua.hpp>\n");
|
||||||
|
@ -2905,6 +2913,8 @@ int main(int argc, char **argv) {
|
||||||
node = node->next;
|
node = node->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(header, "#endif // AP_SCRIPTING_ENABLED\n");
|
||||||
|
|
||||||
fclose(header);
|
fclose(header);
|
||||||
header = NULL;
|
header = NULL;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
#include "AP_Scripting_config.h"
|
||||||
|
|
||||||
|
#if AP_SCRIPTING_ENABLED
|
||||||
|
|
||||||
#include <AP_Common/AP_Common.h>
|
#include <AP_Common/AP_Common.h>
|
||||||
#include <AP_HAL/HAL.h>
|
#include <AP_HAL/HAL.h>
|
||||||
#include <AP_Logger/AP_Logger.h>
|
#include <AP_Logger/AP_Logger.h>
|
||||||
|
@ -700,3 +704,5 @@ int lua_get_current_ref()
|
||||||
auto *scripting = AP::scripting();
|
auto *scripting = AP::scripting();
|
||||||
return scripting->get_current_ref();
|
return scripting->get_current_ref();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // AP_SCRIPTING_ENABLED
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
#include "AP_Scripting_config.h"
|
||||||
|
|
||||||
|
#if AP_SCRIPTING_ENABLED
|
||||||
|
|
||||||
#include <AP_HAL/AP_HAL.h>
|
#include <AP_HAL/AP_HAL.h>
|
||||||
#include "lua_boxed_numerics.h"
|
#include "lua_boxed_numerics.h"
|
||||||
#include <AP_Scripting/lua_generated_bindings.h>
|
#include <AP_Scripting/lua_generated_bindings.h>
|
||||||
|
@ -132,3 +136,5 @@ int uint32_t___tostring(lua_State *L) {
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // AP_SCRIPTING_ENABLED
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
// lua/src/lua.c. It overall modified the functions to the minimum amount
|
// lua/src/lua.c. It overall modified the functions to the minimum amount
|
||||||
// required, with the exception of fixing whitespace/indentation on if's
|
// required, with the exception of fixing whitespace/indentation on if's
|
||||||
|
|
||||||
|
#include "AP_Scripting_config.h"
|
||||||
|
|
||||||
|
#if AP_SCRIPTING_ENABLED
|
||||||
|
|
||||||
#include "lua_scripts.h"
|
#include "lua_scripts.h"
|
||||||
#include <AP_Scripting/lua_generated_bindings.h>
|
#include <AP_Scripting/lua_generated_bindings.h>
|
||||||
|
@ -257,3 +260,5 @@ void lua_scripts::doREPL(lua_State *L) {
|
||||||
repl_cleanup();
|
repl_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // AP_SCRIPTING_ENABLED
|
||||||
|
|
|
@ -13,6 +13,10 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "AP_Scripting_config.h"
|
||||||
|
|
||||||
|
#if AP_SCRIPTING_ENABLED
|
||||||
|
|
||||||
#include "lua_scripts.h"
|
#include "lua_scripts.h"
|
||||||
#include <AP_HAL/AP_HAL.h>
|
#include <AP_HAL/AP_HAL.h>
|
||||||
#include "AP_Scripting.h"
|
#include "AP_Scripting.h"
|
||||||
|
@ -599,3 +603,5 @@ void lua_scripts::run(void) {
|
||||||
}
|
}
|
||||||
error_msg_buf_sem.give();
|
error_msg_buf_sem.give();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // AP_SCRIPTING_ENABLED
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "AP_Scripting_config.h"
|
||||||
|
|
||||||
|
#if AP_SCRIPTING_ENABLED
|
||||||
|
|
||||||
#include <AP_Common/AP_Common.h>
|
#include <AP_Common/AP_Common.h>
|
||||||
#include <AP_Param/AP_Param.h>
|
#include <AP_Param/AP_Param.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
@ -132,3 +136,5 @@ public:
|
||||||
static AP_HAL::Semaphore* get_last_error_semaphore() { return &error_msg_buf_sem; }
|
static AP_HAL::Semaphore* get_last_error_semaphore() { return &error_msg_buf_sem; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // AP_SCRIPTING_ENABLED
|
||||||
|
|
Loading…
Reference in New Issue