[input_common] Move variable declaration closer to usage

MSVC supplied with VS2022 generates "warning C4189: 'CALIBRATION_THRESHOLD':
local variable is initialized but not referenced" which is treated as an
error.

Circumvent it by moving constexpr variable directly into body of lambda function.
This commit is contained in:
vperus 2021-12-17 20:51:47 +02:00
parent 660c6bec22
commit 11f4bf8a9a

View file

@ -536,8 +536,6 @@ CalibrationConfigurationJob::CalibrationConfigurationJob(
std::function<void(u16, u16, u16, u16)> data_callback) { std::function<void(u16, u16, u16, u16)> data_callback) {
std::thread([=, this] { std::thread([=, this] {
constexpr u16 CALIBRATION_THRESHOLD = 100;
u16 min_x{UINT16_MAX}; u16 min_x{UINT16_MAX};
u16 min_y{UINT16_MAX}; u16 min_y{UINT16_MAX};
u16 max_x{}; u16 max_x{};
@ -546,6 +544,8 @@ CalibrationConfigurationJob::CalibrationConfigurationJob(
Status current_status{Status::Initialized}; Status current_status{Status::Initialized};
SocketCallback callback{[](Response::Version) {}, [](Response::PortInfo) {}, SocketCallback callback{[](Response::Version) {}, [](Response::PortInfo) {},
[&](Response::PadData data) { [&](Response::PadData data) {
constexpr u16 CALIBRATION_THRESHOLD = 100;
if (current_status == Status::Initialized) { if (current_status == Status::Initialized) {
// Receiving data means the communication is ready now // Receiving data means the communication is ready now
current_status = Status::Ready; current_status = Status::Ready;