AP_Scripting: clear alocated i2c devices on scripting stop

This commit is contained in:
Iampete1 2022-09-10 17:22:08 +01:00 committed by Andrew Tridgell
parent cb34895cfa
commit 7b0f74cc7e
1 changed files with 7 additions and 0 deletions

View File

@ -236,6 +236,13 @@ void AP_Scripting::thread(void) {
}
delete lua;
// clear allocated i2c devices
for (uint8_t i=0; i<SCRIPTING_MAX_NUM_I2C_DEVICE; i++) {
delete _i2c_dev[i];
_i2c_dev[i] = nullptr;
}
num_i2c_devices = 0;
bool cleared = false;
while(true) {
// 1hz check if we should restart