SITL: use GCS_SEND_TEXT rather than gcs().send_text

Co-authored-by: muramura <ma2maru@gmail.com>
This commit is contained in:
Peter Barker 2024-08-07 13:17:22 +10:00 committed by Andrew Tridgell
parent 4dac24796d
commit e23e58fc17
4 changed files with 7 additions and 7 deletions

View File

@ -102,19 +102,19 @@ void Buzzer::update(const struct sitl_input &input)
const uint32_t now = AP_HAL::millis(); const uint32_t now = AP_HAL::millis();
if (on) { if (on) {
if (!was_on) { if (!was_on) {
gcs().send_text(MAV_SEVERITY_WARNING, "%u: Buzzer on", now); GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "%u: Buzzer on", now);
on_time = now; on_time = now;
was_on = true; was_on = true;
xdemoSound.play(); xdemoSound.play();
} }
if (now - on_time > duration_ms/2) { if (now - on_time > duration_ms/2) {
gcs().send_text(MAV_SEVERITY_WARNING, "%u: Buzzer on again", now); GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "%u: Buzzer on again", now);
on_time = now; on_time = now;
xdemoSound.play(); xdemoSound.play();
} }
} else { } else {
if (was_on) { if (was_on) {
gcs().send_text(MAV_SEVERITY_WARNING, "%u: Buzzer off", now); GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "%u: Buzzer off", now);
xdemoSound.stop(); xdemoSound.stop();
was_on = false; was_on = false;
} }

View File

@ -42,7 +42,7 @@ void SIM_GeneratorEngine::update()
temperature = MIN(temperature, 150); temperature = MIN(temperature, 150);
// now lose some heat to the environment // now lose some heat to the environment
const float heat_loss = ((temperature * heat_environment_loss_factor * (time_delta_ms * (1/1000.0f)))); // lose some % of heat per second const float heat_loss = ((temperature * heat_environment_loss_factor * (time_delta_ms * (1/1000.0f)))); // lose some % of heat per second
// gcs().send_text(MAV_SEVERITY_INFO, "heat=%f loss=%f", temperature, heat_loss); // GCS_SEND_TEXT(MAV_SEVERITY_INFO, "heat=%f loss=%f", temperature, heat_loss);
temperature -= heat_loss; temperature -= heat_loss;
} }

View File

@ -57,7 +57,7 @@ void RF_Wasp::check_configuration()
offs += 1; // for '>' offs += 1; // for '>'
offs += 1; // for space offs += 1; // for space
strncpy(string_configs[i].value, &_buffer[offs], MIN(ARRAY_SIZE(config.format), unsigned(cr - _buffer - offs - 1))); // -1 for the lf, -1 for the cr strncpy(string_configs[i].value, &_buffer[offs], MIN(ARRAY_SIZE(config.format), unsigned(cr - _buffer - offs - 1))); // -1 for the lf, -1 for the cr
// gcs().send_text(MAV_SEVERITY_INFO, "Wasp: config (%s) (%s)", string_configs[i].name, string_configs[i].value); // GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Wasp: config (%s) (%s)", string_configs[i].name, string_configs[i].value);
char response[128]; char response[128];
const size_t x = snprintf(response, const size_t x = snprintf(response,
ARRAY_SIZE(response), ARRAY_SIZE(response),
@ -80,7 +80,7 @@ void RF_Wasp::check_configuration()
char tmp[32]{}; char tmp[32]{};
strncpy(tmp, &_buffer[offs], MIN(ARRAY_SIZE(config.format), unsigned(cr - _buffer - offs - 1))); // -1 for the lf, -1 for the cr strncpy(tmp, &_buffer[offs], MIN(ARRAY_SIZE(config.format), unsigned(cr - _buffer - offs - 1))); // -1 for the lf, -1 for the cr
*(integer_configs[i].value) = atoi(tmp); *(integer_configs[i].value) = atoi(tmp);
// gcs().send_text(MAV_SEVERITY_INFO, "Wasp: config (%s) (%d)", integer_configs[i].name, *(integer_configs[i].value)); // GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Wasp: config (%s) (%d)", integer_configs[i].name, *(integer_configs[i].value));
char response[128]; char response[128];
const size_t x = snprintf(response, const size_t x = snprintf(response,
ARRAY_SIZE(response), ARRAY_SIZE(response),

View File

@ -17,7 +17,7 @@ void SITL::ToshibaLED::update(const class Aircraft &aircraft)
last_print_pwm1 = get_register(ToshibaLEDDevReg::PWM1); last_print_pwm1 = get_register(ToshibaLEDDevReg::PWM1);
last_print_pwm2 = get_register(ToshibaLEDDevReg::PWM2); last_print_pwm2 = get_register(ToshibaLEDDevReg::PWM2);
last_print_enable = get_register(ToshibaLEDDevReg::ENABLE); last_print_enable = get_register(ToshibaLEDDevReg::ENABLE);
// gcs().send_text(MAV_SEVERITY_INFO, "SIM_ToshibaLED: PWM0=%u PWM1=%u PWM2=%u ENABLE=%u", last_print_pwm0, last_print_pwm1, last_print_pwm2, last_print_enable); // GCS_SEND_TEXT(MAV_SEVERITY_INFO, "SIM_ToshibaLED: PWM0=%u PWM1=%u PWM2=%u ENABLE=%u", last_print_pwm0, last_print_pwm1, last_print_pwm2, last_print_enable);
if (get_register(ToshibaLEDDevReg::ENABLE)) { if (get_register(ToshibaLEDDevReg::ENABLE)) {
// here we convert from 0-15 BGR (the PWM values from the i2c bus) // here we convert from 0-15 BGR (the PWM values from the i2c bus)