From cb08e9634bc126f3c346915276543e8bf2af37b6 Mon Sep 17 00:00:00 2001 From: Kevin Patino Date: Fri, 1 Jun 2018 20:40:51 +0000 Subject: [PATCH] Manage everloop size --- src/driver_everloop.cpp | 7 +++++++ src/malos.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/driver_everloop.cpp b/src/driver_everloop.cpp index 00c41ee..ac098a8 100644 --- a/src/driver_everloop.cpp +++ b/src/driver_everloop.cpp @@ -28,6 +28,13 @@ namespace matrix_malos { bool EverloopDriver::ProcessConfig(const pb::driver::DriverConfig& config) { pb::io::EverloopImage image(config.image()); + if (MatrixLeds() != image.led_size()) { + std::string error_msg("WARNING: Invalid number of Leds it must be ="); + error_msg += std::to_string(MatrixLeds()); + zmq_push_error_->Send(error_msg); + return false; + } + matrix_hal::EverloopImage image_for_hal(MatrixLeds()); int idx = 0; for (const pb::io::LedValue& value : image.led()) { diff --git a/src/malos.cpp b/src/malos.cpp index d560474..28c6ddb 100644 --- a/src/malos.cpp +++ b/src/malos.cpp @@ -47,7 +47,7 @@ int RunServer() { std::cerr << std::endl; matrix_hal::MatrixIOBus* bus = new matrix_hal::MatrixIOBus(); - + if (!bus->Init()) return false; DriverManager driver_manager(kBasePort, kUnsecureBindScope);