diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cb06525462dbd19c6a06908becee7c2c23c161e..f83632ac4302a9d6d131c2ecbac8e211d2711a37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,3 +92,8 @@ add_executable(nokia-groundstation-entry ) target_include_directories(nokia-groundstation-entry PRIVATE ${OBSW_INCLUDE_DIRS}) sbs_target(nokia-groundstation-entry stm32f429zi_nokia) + + +add_executable(gs-entry src/entrypoints/Gs/gs-entry.cpp ${GS_COMPUTER}) +target_include_directories(gs-entry PRIVATE ${OBSW_INCLUDE_DIRS}) +sbs_target(gs-entry stm32f767zi_gemini_gs) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 3df9705e18d942811aa4596eb2fe8ea6b372e698..94e87cbbc5a59e48ce8b63e9cece67a186dd1d04 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -117,3 +117,9 @@ set(GROUNDSTATION_COMMON src/boards/Groundstation/Common/Radio/RadioBase.cpp src/boards/Groundstation/Common/HubBase.cpp ) + +set(GS_COMPUTER + src/boards/Gs/Ports/Serial.cpp + src/boards/Gs/Radio/Radio.cpp + src/boards/Gs/Radio/RadioStatus.cpp +) \ No newline at end of file diff --git a/src/boards/Gs/Config/RadioConfig.h b/src/boards/Gs/Config/RadioConfig.h index 6b7466347d27e9ee74e5474d17dc4ce3ce7f04fe..b935b89a8de30e8f68bf29473f7e6a84ad635ac6 100644 --- a/src/boards/Gs/Config/RadioConfig.h +++ b/src/boards/Gs/Config/RadioConfig.h @@ -22,7 +22,8 @@ #pragma once -#include <ctype.h> +#include <cstdint> +#include <cstddef> // Uncomment the following line to enable backup RF for main // #define SKYWARD_GS_MAIN_USE_BACKUP_RF diff --git a/src/boards/Gs/Config/SerialConfig.h b/src/boards/Gs/Config/SerialConfig.h new file mode 100644 index 0000000000000000000000000000000000000000..b28c8ea9b691c9a592a9b7fb6f0bb41b5d0d2547 --- /dev/null +++ b/src/boards/Gs/Config/SerialConfig.h @@ -0,0 +1,30 @@ +/* Copyright (c) 2023 Skyward Experimental Rocketry + * Author: Davide Mor + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +namespace Gs +{ + +constexpr int SERIAL_BAUD_RATE = 115200; + +} \ No newline at end of file diff --git a/src/boards/Gs/Ports/Serial.cpp b/src/boards/Gs/Ports/Serial.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4179a6f54313dfc7be7bf749d83e854fda48459f --- /dev/null +++ b/src/boards/Gs/Ports/Serial.cpp @@ -0,0 +1,86 @@ +/* Copyright (c) 2023 Skyward Experimental Rocketry + * Author: Davide Mor + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "Serial.h" + +#include <Gs/Radio/RadioStatus.h> +#include <Gs/Radio/Radio.h> + +using namespace miosix; +using namespace Gs; +using namespace Boardcore; + +bool Serial::start() +{ + ActiveObject::start(); + + return true; +} + +void Serial::sendMsg(const mavlink_message_t& msg) +{ + Lock<FastMutex> l(mutex); + uint8_t msg_buf[MAVLINK_NUM_NON_PAYLOAD_BYTES + + MAVLINK_MAX_DIALECT_PAYLOAD_SIZE]; + int msg_len = mavlink_msg_to_send_buffer(msg_buf, &msg); + + usart.write(msg_buf, msg_len); +} + +void Serial::handleMsg(const mavlink_message_t& msg) +{ + // TODO: + RadioStatus *status = ModuleManager::getInstance().get<RadioStatus>(); + + if(status->isMainRadioPresent()) { + RadioMain *radio = ModuleManager::getInstance().get<RadioMain>(); + radio->sendMsg(msg); + } + + if(status->isPayloadRadioPresent()) { + RadioPayload *radio = ModuleManager::getInstance().get<RadioPayload>(); + radio->sendMsg(msg); + } +} + +void Serial::run() +{ + mavlink_message_t msg; + uint8_t msg_buf[256]; + + while (!shouldStop()) + { + int rcv_len = usart.readBlocking(msg_buf, sizeof(msg_buf)); + + for (int i = 0; i < rcv_len; i++) + { + mavlink_status_t status; + uint8_t parse_result = + mavlink_parse_char(MAVLINK_COMM_0, msg_buf[i], &msg, &status); + + if (parse_result == 1) + { + handleMsg(msg); + } + } + } +} \ No newline at end of file diff --git a/src/boards/Gs/Ports/Serial.h b/src/boards/Gs/Ports/Serial.h new file mode 100644 index 0000000000000000000000000000000000000000..3fbf2bc4ac0604f3da50be6fc8ca357dd455ee6d --- /dev/null +++ b/src/boards/Gs/Ports/Serial.h @@ -0,0 +1,62 @@ +/* Copyright (c) 2023 Skyward Experimental Rocketry + * Author: Davide Mor + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include <Gs/Config/SerialConfig.h> +#include <common/Mavlink.h> +#include <drivers/usart/USART.h> +#include <utils/ModuleManager/ModuleManager.hpp> +#include <ActiveObject.h> + +namespace Gs +{ + +class Serial : public Boardcore::Module, private Boardcore::ActiveObject { +public: + Serial() : usart(USART1, SERIAL_BAUD_RATE) {} + + [[nodiscard]] bool start(); + + /** + * @brief Send a mavlink message through this port. + */ + void sendMsg(const mavlink_message_t& msg); + +protected: + /** + * @brief Internal run method + */ + void run() override; + +private: + /** + * @brief Called internally when a message is received. + */ + void handleMsg(const mavlink_message_t& msg); + + miosix::FastMutex mutex; + + Boardcore::USART usart; +}; + +} \ No newline at end of file diff --git a/src/boards/Gs/Radio/Radio.cpp b/src/boards/Gs/Radio/Radio.cpp index f6ccbc4aeb3bb4693619ca50ecc470bf87a9a209..438645725113e6ded770cb4f6fd2521b5d94150a 100644 --- a/src/boards/Gs/Radio/Radio.cpp +++ b/src/boards/Gs/Radio/Radio.cpp @@ -24,60 +24,41 @@ #include <Gs/Buses.h> #include <radio/SX1278/SX1278Frontends.h> +#include <Gs/Ports/Serial.h> +#include <Gs/Radio/RadioStatus.h> using namespace miosix; using namespace Gs; using namespace Boardcore; -SX1278Fsk* radio1_ptr = nullptr; -SX1278Fsk* radio2_ptr = nullptr; - void __attribute__((used)) MIOSIX_RADIO1_DIO0_IRQ() { - if (radio1_ptr != nullptr) - { - radio1_ptr->handleDioIRQ(); - } + ModuleManager::getInstance().get<RadioMain>()->handleDioIRQ(); } void __attribute__((used)) MIOSIX_RADIO1_DIO1_IRQ() { - if (radio1_ptr != nullptr) - { - radio1_ptr->handleDioIRQ(); - } + ModuleManager::getInstance().get<RadioMain>()->handleDioIRQ(); } void __attribute__((used)) MIOSIX_RADIO1_DIO3_IRQ() { - if (radio1_ptr != nullptr) - { - radio1_ptr->handleDioIRQ(); - } + ModuleManager::getInstance().get<RadioMain>()->handleDioIRQ(); } void __attribute__((used)) MIOSIX_RADIO2_DIO0_IRQ() { - if (radio2_ptr != nullptr) - { - radio2_ptr->handleDioIRQ(); - } + ModuleManager::getInstance().get<RadioPayload>()->handleDioIRQ(); } void __attribute__((used)) MIOSIX_RADIO2_DIO1_IRQ() { - if (radio2_ptr != nullptr) - { - radio2_ptr->handleDioIRQ(); - } + ModuleManager::getInstance().get<RadioPayload>()->handleDioIRQ(); } void __attribute__((used)) MIOSIX_RADIO2_DIO3_IRQ() { - if (radio2_ptr != nullptr) - { - radio2_ptr->handleDioIRQ(); - } + ModuleManager::getInstance().get<RadioPayload>()->handleDioIRQ(); } void RadioBase::sendMsg(const mavlink_message_t& msg) @@ -86,14 +67,23 @@ void RadioBase::sendMsg(const mavlink_message_t& msg) pending_msgs.put(msg); } +void RadioBase::handleDioIRQ() +{ + if (sx1278) + { + sx1278->handleDioIRQ(); + } +} + bool RadioBase::start(std::unique_ptr<SX1278Fsk> sx1278, const SX1278Fsk::Config& config) { this->sx1278 = std::move(sx1278); // Configure the radio - if (this->sx1278->configure(config) != SX1278Fsk::Error::NONE) + if (this->sx1278->configure(config) != SX1278Fsk::Error::NONE) { return false; + } auto mav_handler = [this](MavDriver* channel, const mavlink_message_t& msg) { handleMsg(msg); }; @@ -103,7 +93,9 @@ bool RadioBase::start(std::unique_ptr<SX1278Fsk> sx1278, Gs::MAV_OUT_BUFFER_MAX_AGE); if (!mav_driver->start()) + { return false; + } return true; } @@ -126,10 +118,19 @@ bool RadioMain::start() radio1::dio1::getPin(), radio1::dio3::getPin(), SPI::ClockDivider::DIV_64, std::move(frontend)); - // This is valid, as the module will never be deleted - radio1_ptr = sx1278.get(); + // First check if the device is even connected + RadioStatus *status = ModuleManager::getInstance().get<RadioStatus>(); + // Set if the device is present + status->setMainRadioPresent(sx1278->checkVersion()); + + if(status->isMainRadioPresent()) { + // Initialize if only if present + if(!RadioBase::start(std::move(sx1278), Common::MAIN_RADIO_CONFIG)) { + return false; + } + } - return RadioBase::start(std::move(sx1278), Common::MAIN_RADIO_CONFIG); + return true; } bool RadioPayload::start() @@ -150,33 +151,46 @@ bool RadioPayload::start() radio2::dio1::getPin(), radio2::dio3::getPin(), SPI::ClockDivider::DIV_64, std::move(frontend)); - // This is valid, as the module will never be deleted - radio2_ptr = sx1278.get(); + // First check if the device is even connected + RadioStatus *status = ModuleManager::getInstance().get<RadioStatus>(); + // Set if the device is present + status->setPayloadRadioPresent(sx1278->checkVersion()); - return RadioBase::start(std::move(sx1278), Common::PAYLOAD_RADIO_CONFIG); + if(status->isPayloadRadioPresent()) { + // Initialize if only if present + if(!RadioBase::start(std::move(sx1278), Common::PAYLOAD_RADIO_CONFIG)) { + return false; + } + } + + return true; } void RadioBase::handleMsg(const mavlink_message_t& msg) { - // TODO + printf("Bruh\n"); + + // TODO: + Serial *serial = ModuleManager::getInstance().get<Serial>(); + serial->sendMsg(msg); - /* - if(msg.msgid == ) { + if (isEndOfTransmissionPacket(msg)) + { flush(); } - */ } void RadioBase::flush() { - // Why is this here? - // - // Basically even SyncPacketQueue is not 100% thread safe (due to a bug). So - // we will use the good old "put a massive fucking mutex over everything" - // trick to fix this until we find a better solution. Lock<FastMutex> l(mutex); while (!pending_msgs.isEmpty()) { mav_driver->enqueueMsg(pending_msgs.pop()); } +} + +bool RadioBase::isEndOfTransmissionPacket(const mavlink_message_t& msg) +{ + return msg.msgid == MAVLINK_MSG_ID_ROCKET_FLIGHT_TM || + msg.msgid == MAVLINK_MSG_ID_PAYLOAD_FLIGHT_TM; } \ No newline at end of file diff --git a/src/boards/Gs/Radio/Radio.h b/src/boards/Gs/Radio/Radio.h index 454d0600845805157fb2e43102e64ba1794bc025..4afd134d970fbff6bfbd63d6d07df375e97ffab9 100644 --- a/src/boards/Gs/Radio/Radio.h +++ b/src/boards/Gs/Radio/Radio.h @@ -27,7 +27,7 @@ #include <common/Radio.h> #include <radio/MavlinkDriver/MavlinkDriver.h> #include <radio/SX1278/SX1278Fsk.h> -#include <utils/collections/SyncCircularBuffer.h> +#include <utils/collections/CircularBuffer.h> #include <memory> #include <utils/ModuleManager/ModuleManager.hpp> @@ -53,6 +53,11 @@ public: */ void sendMsg(const mavlink_message_t& msg); + /** + * @brief Handle generic DIO irq. + */ + void handleDioIRQ(); + protected: /** * @brief Initialize this radio module. @@ -74,6 +79,11 @@ private: */ void flush(); + /** + * @brief Check if a message signals an end of trasmissiont + */ + bool isEndOfTransmissionPacket(const mavlink_message_t& msg); + miosix::FastMutex mutex; Boardcore::CircularBuffer<mavlink_message_t, Gs::MAV_PENDING_OUT_QUEUE_SIZE> @@ -87,11 +97,13 @@ private: class RadioMain : public RadioBase, public Boardcore::Module { +public: [[nodiscard]] bool start(); }; class RadioPayload : public RadioBase, public Boardcore::Module { +public: [[nodiscard]] bool start(); }; diff --git a/src/boards/Gs/Radio/RadioStatus.cpp b/src/boards/Gs/Radio/RadioStatus.cpp new file mode 100644 index 0000000000000000000000000000000000000000..de8a5bf0c62207dd6f30efef60c6c83bc6df2ca0 --- /dev/null +++ b/src/boards/Gs/Radio/RadioStatus.cpp @@ -0,0 +1,39 @@ +/* Copyright (c) 2023 Skyward Experimental Rocketry + * Author: Davide Mor + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "RadioStatus.h" + +using namespace Boardcore; +using namespace Gs; + +bool Gs::RadioStatus::isMainRadioPresent() { return main_radio_present; } +bool Gs::RadioStatus::isPayloadRadioPresent() { return payload_radio_present; } + +void Gs::RadioStatus::setMainRadioPresent(bool present) +{ + main_radio_present = present; +} + +void Gs::RadioStatus::setPayloadRadioPresent(bool present) +{ + payload_radio_present = present; +} \ No newline at end of file diff --git a/src/boards/Gs/Radio/RadioStatus.h b/src/boards/Gs/Radio/RadioStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..0d893b700d00673ba48baceac5fb9e841c25114c --- /dev/null +++ b/src/boards/Gs/Radio/RadioStatus.h @@ -0,0 +1,46 @@ +/* Copyright (c) 2023 Skyward Experimental Rocketry + * Author: Davide Mor + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include <utils/ModuleManager/ModuleManager.hpp> + +namespace Gs +{ + +class RadioStatus : public Boardcore::Module +{ +public: + RadioStatus() {} + + bool isMainRadioPresent(); + bool isPayloadRadioPresent(); + + void setMainRadioPresent(bool present); + void setPayloadRadioPresent(bool present); + +private: + bool main_radio_present = false; + bool payload_radio_present = false; +}; + +} \ No newline at end of file diff --git a/src/boards/common/Radio.h b/src/boards/common/Radio.h index edb2cd479c67cdf21e44d4572897b91e8f910946..f463fe060da4f8ae094a00240c2d8cc9b17a3e28 100644 --- a/src/boards/common/Radio.h +++ b/src/boards/common/Radio.h @@ -38,7 +38,7 @@ static constexpr Boardcore::SX1278Fsk::Config MAIN_RADIO_CONFIG = { .power = 13, .shaping = Boardcore::SX1278Fsk::Config::Shaping::GAUSSIAN_BT_1_0, .dc_free = Boardcore::SX1278Fsk::Config::DcFree::WHITENING, - .enable_crc = false}; + .enable_crc = true}; static constexpr Boardcore::SX1278Fsk::Config PAYLOAD_RADIO_CONFIG = { .freq_rf = 868000000, diff --git a/src/entrypoints/Gs/gs-entry.cpp b/src/entrypoints/Gs/gs-entry.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fabc4533fe78229761113a83da764c1f1e5c5a01 --- /dev/null +++ b/src/entrypoints/Gs/gs-entry.cpp @@ -0,0 +1,69 @@ +/* Copyright (c) 2023 Skyward Experimental Rocketry + * Author: Davide Mor + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include <Gs/Buses.h> +#include <Gs/Ports/Serial.h> +#include <Gs/Radio/Radio.h> +#include <Gs/Radio/RadioStatus.h> + +using namespace Gs; +using namespace Boardcore; + +int main() { + + Buses *buses = new Buses(); + Serial *serial = new Serial(); + RadioMain *radio_main = new RadioMain(); + RadioPayload *radio_payload = new RadioPayload(); + RadioStatus *radio_status = new RadioStatus(); + + ModuleManager &modules = ModuleManager::getInstance(); + + bool ok = true; + + ok &= modules.insert(buses); + ok &= modules.insert(serial); + ok &= modules.insert(radio_main); + ok &= modules.insert(radio_payload); + ok &= modules.insert(radio_status); + + // Ok now start them + + ok &= serial->start(); + ok &= radio_main->start(); + ok &= radio_payload->start(); + + /*if(!ok) { + printf("[GS] Init failed!\n"); + } else { + printf("[GS] Init succesfull!\n"); + printf("[GS] radio main: %d\n", radio_status->isMainRadioPresent()); + printf("[GS] radio payload: %d\n", radio_status->isPayloadRadioPresent()); + }*/ + + + while(1) { + miosix::Thread::sleep(1000); + } + + return 0; +} \ No newline at end of file