From 92528c73501cdff879da00008823388f6949e51e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 20 Aug 2021 10:01:37 +0200 Subject: [PATCH 001/102] added LICENSE and NOTICE file --- LICENSE | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NOTICE | 13 ++++ 2 files changed, 215 insertions(+) create mode 100644 LICENSE create mode 100644 NOTICE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/NOTICE b/NOTICE new file mode 100644 index 00000000..86a797ad --- /dev/null +++ b/NOTICE @@ -0,0 +1,13 @@ +Copyright 2021 Institute of Space Systems (IRS), University of Stuttgart + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file -- 2.43.0 From a45d4592c3ab7c4954499c1409e4404a15f60ac1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 20 Aug 2021 12:05:15 +0200 Subject: [PATCH 002/102] lwgps update --- CMakeLists.txt | 2 -- thirdparty/lwgps | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f1c6d05..dca4acf8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,8 +135,6 @@ set(FSFW_ADDITIONAL_INC_PATHS "${COMMON_PATH}/config" ${CMAKE_CURRENT_BINARY_DIR} ) -# Set for lwgps library -set(LWGPS_CONFIG_PATH "${COMMON_PATH}/config") ################################################################################ # Executable and Sources diff --git a/thirdparty/lwgps b/thirdparty/lwgps index 3dbfe390..52999ddf 160000 --- a/thirdparty/lwgps +++ b/thirdparty/lwgps @@ -1 +1 @@ -Subproject commit 3dbfe390a6784ebc723d3907062cf883c8cf85cd +Subproject commit 52999ddfe5177493b96b55871961a8a97131596d -- 2.43.0 From 23782dc2fadd37abe062ffb03c0ba33de4716a77 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 20 Aug 2021 14:08:11 +0200 Subject: [PATCH 003/102] Device update 1. Sun sensors added but can be disabled with preprocessor defines 2. GPS Handler --- bsp_q7s/boardconfig/busConf.h | 3 + bsp_q7s/core/ObjectFactory.cpp | 15 +- common/config/devConf.h | 1 + .../pollingSequenceFactory.cpp | 483 +++++++++--------- 4 files changed, 254 insertions(+), 248 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index b70060f5..b314316e 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -12,6 +12,9 @@ static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ttyUL3"; static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ttyUL4"; static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8"; +static constexpr char UART_GNSS_0_DEV[] = "/dev/ttyUL0"; +static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2"; + static constexpr char GPIO_ACS_BOARD_DEFAULT_CHIP[] = "gpiochip5"; static constexpr char GPIO_MGM2_LIS3_CHIP[] = "gpiochip6"; diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 0faa6562..3f05bc2b 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -456,13 +456,14 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI // spiCookie); // gyroL3gHandler->setStartUpImmediately(); - // TODO: Add GPS device handlers -// auto uartCookieGps0 = new UartCookie(objects::GPS0_HANDLER, deviceFile, uartMode, baudrate, -// maxReplyLen); -// auto uartCookieGps1 = new UartCookie(objects::GPS0_HANDLER, deviceFile, uartMode, baudrate, -// maxReplyLen); -// new GPSHyperionHandler(objects::GPS0_HANDLER, uartComIF); -// new GPSHyperionHandler(objects::GPS1_HANDLER, uartComIF); + auto uartCookieGps0 = new UartCookie(objects::GPS0_HANDLER, q7s::UART_GNSS_0_DEV, + UartModes::CANONICAL, 9600, uart::HYPERION_GPS_REPLY_MAX_BUFFER); + auto uartCookieGps1 = new UartCookie(objects::GPS0_HANDLER, q7s::UART_GNSS_1_DEV, + UartModes::CANONICAL, 9600, uart::HYPERION_GPS_REPLY_MAX_BUFFER); + uartCookieGps1->setToFlushInput(true); + uartCookieGps1->setReadCycles(6); + new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, uartCookieGps0); + new GPSHyperionHandler(objects::GPS1_HANDLER, objects::UART_COM_IF, uartCookieGps1); } void ObjectFactory::createHeaterComponents() { diff --git a/common/config/devConf.h b/common/config/devConf.h index ce21c8b3..dc04d5b4 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -35,6 +35,7 @@ static constexpr uint32_t RTD_SPEED = 2000000; namespace uart { +static constexpr size_t HYPERION_GPS_REPLY_MAX_BUFFER = 1024; static constexpr uint32_t PLOC_MPSOC_BAUD = 115200; static constexpr uint32_t PLOC_SUPERVISOR_BAUD = 115200; static constexpr uint32_t STAR_TRACKER_BAUD = 115200; diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 819f40a9..6d76e62b 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -143,6 +143,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ); +#if OBSW_ADD_SUN_SENSORS == 1 /** * The sun sensor will be shutdown as soon as the chip select is pulled high. Thus all * requests to a sun sensor must be performed consecutively. Another reason for calling multiple @@ -151,253 +152,253 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { * One sun sensor communication sequence also blocks the SPI bus. So other devices can not be * inserted between the device handler cycles of one SUS. */ + /* Write setup */ + thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_1, length * 0.9, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_READ); + /* Write setup */ + thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_1, length * 0.901, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_READ); + /* Write setup */ + thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_1, length * 0.902, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_READ); /* Write setup */ - // thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_1, length * 0.9, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_READ); - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_1, length * 0.901, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_1, length * 0.901, DeviceHandlerIF::GET_READ); - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_1, length * 0.902, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_1, length * 0.902, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_2, length * 0.903, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_READ); + /* Write setup */ + thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_2, length * 0.904, SusHandler::SEND_WRITE); + thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_READ); + /* Write setup */ + thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_2, length * 0.905, SusHandler::SEND_WRITE); + thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_READ); /* Write setup */ - // thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_2, length * 0.903, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_2, length * 0.903, DeviceHandlerIF::GET_READ); - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_2, length * 0.904, SusHandler::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_2, length * 0.904, DeviceHandlerIF::GET_READ); - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_2, length * 0.905, SusHandler::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_2, length * 0.905, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_3, length * 0.8, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_READ); + /* Write setup */ + thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_3, length * 0.91, SusHandler::SEND_WRITE); + thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_READ); + /* Write setup */ + thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_3, length * 0.93, SusHandler::SEND_WRITE); + thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_READ); /* Write setup */ - // thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_3, length * 0.8, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_3, length * 0.8, DeviceHandlerIF::GET_READ); - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_3, length * 0.91, SusHandler::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_3, length * 0.91, DeviceHandlerIF::GET_READ); - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_3, length * 0.93, SusHandler::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_3, length * 0.93, DeviceHandlerIF::GET_READ); - // - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_4, length * 0.909, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_READ); - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_4, length * 0.91, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_READ); - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_4, length * 0.911, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_READ); - // - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_5, length * 0.912, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_READ); - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_5, length * 0.913, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_READ); - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_5, length * 0.914, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::GET_READ); - // - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_6, length * 0.915, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_READ); - // /* Start ADC conversions */ - // thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_READ); - // /* Read ADC conversions from inernal FIFO */ - // thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::GET_READ); - // - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_7, length * 0.918, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_READ); - // /* Start ADC conversions */ - // thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_READ); - // /* Read ADC conversions from inernal FIFO */ - // thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::GET_READ); - // - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_READ); - // /* Start ADC conversions */ - // thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_READ); - // /* Read ADC conversions from inernal FIFO */ - // thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::GET_READ); - // - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_READ); - // /* Start ADC conversions */ - // thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_READ); - // /* Read ADC conversions */ - // thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::GET_READ); - // - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_10, length * 0.927, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_READ); - // /* Start ADC conversions */ - // thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::GET_READ); - // /* Read ADC conversions */ - // thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::GET_READ); - // - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_11, length * 0.93, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_READ); - // /* Start ADC conversions */ - // thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::GET_READ); - // /* Read ADC conversions */ - // thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::GET_READ); - // - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_12, length * 0.933, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_READ); - // /* Start ADC conversions */ - // thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_READ); - // /* Read ADC conversions */ - // thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_READ); - // - // /* Write setup */ - // thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_13, length * 0.936, SusHandler::FIRST_WRITE); - // thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_READ); - // /* Start ADC conversions */ - // thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_READ); - // /* Read ADC conversions */ - // thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_4, length * 0.909, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_4, length * 0.909, DeviceHandlerIF::GET_READ); + /* Write setup */ + thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_4, length * 0.91, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_4, length * 0.91, DeviceHandlerIF::GET_READ); + /* Write setup */ + thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_4, length * 0.911, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_4, length * 0.911, DeviceHandlerIF::GET_READ); + + /* Write setup */ + thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_5, length * 0.912, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_5, length * 0.912, DeviceHandlerIF::GET_READ); + /* Write setup */ + thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_5, length * 0.913, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_5, length * 0.913, DeviceHandlerIF::GET_READ); + /* Write setup */ + thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_5, length * 0.914, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_5, length * 0.914, DeviceHandlerIF::GET_READ); + + /* Write setup */ + thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_6, length * 0.915, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_6, length * 0.915, DeviceHandlerIF::GET_READ); + /* Start ADC conversions */ + thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_6, length * 0.916, DeviceHandlerIF::GET_READ); + /* Read ADC conversions from inernal FIFO */ + thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_6, length * 0.917, DeviceHandlerIF::GET_READ); + + /* Write setup */ + thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_7, length * 0.918, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_7, length * 0.918, DeviceHandlerIF::GET_READ); + /* Start ADC conversions */ + thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_7, length * 0.919, DeviceHandlerIF::GET_READ); + /* Read ADC conversions from inernal FIFO */ + thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_7, length * 0.92, DeviceHandlerIF::GET_READ); + + /* Write setup */ + thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_8, length * 0.921, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_8, length * 0.921, DeviceHandlerIF::GET_READ); + /* Start ADC conversions */ + thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_8, length * 0.922, DeviceHandlerIF::GET_READ); + /* Read ADC conversions from inernal FIFO */ + thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_8, length * 0.923, DeviceHandlerIF::GET_READ); + + /* Write setup */ + thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_9, length * 0.924, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_9, length * 0.924, DeviceHandlerIF::GET_READ); + /* Start ADC conversions */ + thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_9, length * 0.925, DeviceHandlerIF::GET_READ); + /* Read ADC conversions */ + thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_9, length * 0.926, DeviceHandlerIF::GET_READ); + + /* Write setup */ + thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_10, length * 0.927, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_10, length * 0.927, DeviceHandlerIF::GET_READ); + /* Start ADC conversions */ + thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_10, length * 0.928, DeviceHandlerIF::GET_READ); + /* Read ADC conversions */ + thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_10, length * 0.929, DeviceHandlerIF::GET_READ); + + /* Write setup */ + thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_11, length * 0.93, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_11, length * 0.93, DeviceHandlerIF::GET_READ); + /* Start ADC conversions */ + thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_11, length * 0.931, DeviceHandlerIF::GET_READ); + /* Read ADC conversions */ + thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_11, length * 0.932, DeviceHandlerIF::GET_READ); + + /* Write setup */ + thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_12, length * 0.933, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::GET_READ); + /* Start ADC conversions */ + thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_READ); + /* Read ADC conversions */ + thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::GET_READ); + + /* Write setup */ + thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_13, length * 0.936, SusHandler::FIRST_WRITE); + thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_13, length * 0.936, DeviceHandlerIF::GET_READ); + /* Start ADC conversions */ + thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_13, length * 0.937, DeviceHandlerIF::GET_READ); + /* Read ADC conversions */ + thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_READ); +#endif thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW1, length * 0.2, DeviceHandlerIF::SEND_WRITE); -- 2.43.0 From 6ecd4ec2f330208a611484d9a3c97cfbb7f05c2a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 20 Aug 2021 14:50:40 +0200 Subject: [PATCH 004/102] pin fixes for ACS board --- bsp_q7s/boardconfig/busConf.h | 9 +-- bsp_q7s/boardconfig/q7sConfig.h.in | 33 ++++++---- bsp_q7s/core/ObjectFactory.cpp | 63 +++++++++++-------- linux/fsfwconfig/OBSWConfig.h.in | 2 + .../pollingSequenceFactory.cpp | 62 ++++++++---------- 5 files changed, 91 insertions(+), 78 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index b314316e..a5cbcf19 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -15,14 +15,15 @@ static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8"; static constexpr char UART_GNSS_0_DEV[] = "/dev/ttyUL0"; static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2"; +static constexpr char GPIO_GYRO_ADIS_CHIP[] = "gpiochip4"; static constexpr char GPIO_ACS_BOARD_DEFAULT_CHIP[] = "gpiochip5"; static constexpr char GPIO_MGM2_LIS3_CHIP[] = "gpiochip6"; // TODO: Determine new pins, additional ADIS gyro device -static constexpr uint32_t GPIO_GYRO_0_ADIS_CS = 1; -static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 7; -static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 3; -static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 3; +static constexpr uint32_t GPIO_GYRO_0_ADIS_CS = 0; +static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 18; +static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 2; +static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 1; static constexpr uint32_t GPIO_MGM_0_LIS3_CS = 5; static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16; diff --git a/bsp_q7s/boardconfig/q7sConfig.h.in b/bsp_q7s/boardconfig/q7sConfig.h.in index 61e924d8..0eb4f759 100644 --- a/bsp_q7s/boardconfig/q7sConfig.h.in +++ b/bsp_q7s/boardconfig/q7sConfig.h.in @@ -5,30 +5,37 @@ #cmakedefine01 Q7S_SIMPLE_MODE -#define Q7S_SD_NONE 0 -#define Q7S_SD_COLD_REDUNDANT 1 -#define Q7S_SD_HOT_REDUNDANT 2 +/*******************************************************************/ +/** All of the following flags should be enabled for mission code */ +/*******************************************************************/ + +//! Timers can mess up the code when debugging +//! All of this should be enabled for mission code! + +/*******************************************************************/ +/** Other flags */ +/*******************************************************************/ + +#define Q7S_SD_NONE 0 +#define Q7S_SD_COLD_REDUNDANT 1 +#define Q7S_SD_HOT_REDUNDANT 2 // The OBSW will perform different actions to set up the SD cards depending on the flag set here // Set to Q7S_SD_NONE: Don't do anything // Set to Q7S_COLD_REDUNDANT: On startup, get the prefered SD card, turn it on and mount it, and // turn off the second SD card if it is on // Set to Q7S_HOT_REDUNDANT: On startup, turn on both SD cards and mount them -#define Q7S_SD_CARD_CONFIG Q7S_SD_COLD_REDUNDANT +#define Q7S_SD_CARD_CONFIG Q7S_SD_COLD_REDUNDANT // Probably better if this is disabled for mission code. Convenient for development -#define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1 -#define Q7S_ADD_RTD_DEVICES 0 +#define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1 +#define Q7S_ADD_RTD_DEVICES 0 -/* Only one of those 2 should be enabled! */ -/* Add code for ACS board */ -#define OBSW_ADD_ACS_BOARD 0 +// Only one of those 2 should be enabled! #if OBSW_ADD_ACS_BOARD == 0 -#define Q7S_ADD_SPI_TEST 0 +#define Q7S_ADD_SPI_TEST 0 #endif -#define Q7S_ADD_SYRLINKS_HANDLER 1 - -#define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0 +#define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0 namespace config { diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 3f05bc2b..ef94e9d5 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -1,3 +1,4 @@ +#include #include "ObjectFactory.h" #include "OBSWConfig.h" #include "devConf.h" @@ -386,13 +387,13 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI GpioCookie* gpioCookieAcsBoard = new GpioCookie(); GpiodRegular* gpio = nullptr; // TODO: Determine new Gyro GPIO pins - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_0_ADIS_CS, + gpio = new GpiodRegular(q7s::GPIO_GYRO_ADIS_CHIP, q7s::GPIO_GYRO_0_ADIS_CS, "CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_1_L3G_CS, "CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_2_ADIS_CS, + gpio = new GpiodRegular(q7s::GPIO_GYRO_ADIS_CHIP, q7s::GPIO_GYRO_2_ADIS_CS, "CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio); gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_3_L3G_CS, @@ -421,49 +422,61 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI objects::SPI_COM_IF, spiCookie); mgmLis3Handler->setStartUpImmediately(); - spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, - MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); - auto mgmLis3Handler2 = new MGMHandlerLIS3MDL(objects::MGM_2_LIS3_HANDLER, - objects::SPI_COM_IF, spiCookie); - mgmLis3Handler2->setStartUpImmediately(); - spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie); mgmRm3100Handler->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, + MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); + auto mgmLis3Handler2 = new MGMHandlerLIS3MDL(objects::MGM_2_LIS3_HANDLER, + objects::SPI_COM_IF, spiCookie); + mgmLis3Handler2->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie); mgmRm3100Handler->setStartUpImmediately(); - //TODO: Adis Gyro (Gyro 0 Side A) // Commented until ACS board V2 in in clean room again - /* Gyro 1 Side A */ -// spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, -// L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); -// auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, -// spiCookie); -// gyroL3gHandler->setStartUpImmediately(); -// -// /* Gyro 2 Side B */ -// spiCookie = new SpiCookie(addresses::GYRO_2_L3G, gpioIds::GYRO_2_L3G_CS, spiDev, -// L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); -// gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_2_L3G_HANDLER, objects::SPI_COM_IF, -// spiCookie); -// gyroL3gHandler->setStartUpImmediately(); + // Gyro 0 Side A + spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, + ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, + spi::DEFAULT_ADIS16507_SPEED); + auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, + objects::SPI_COM_IF, spiCookie); + adisHandler->setStartUpImmediately(); + // Gyro 1 Side A + spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, + objects::SPI_COM_IF, spiCookie); + gyroL3gHandler->setStartUpImmediately(); + // Gyro 2 Side B + spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, + ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, + spi::DEFAULT_ADIS16507_SPEED); + adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, + objects::SPI_COM_IF, spiCookie); + adisHandler->setStartUpImmediately(); + // Gyro 3 Side B + spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, + objects::SPI_COM_IF, spiCookie); + gyroL3gHandler->setStartUpImmediately(); auto uartCookieGps0 = new UartCookie(objects::GPS0_HANDLER, q7s::UART_GNSS_0_DEV, UartModes::CANONICAL, 9600, uart::HYPERION_GPS_REPLY_MAX_BUFFER); - auto uartCookieGps1 = new UartCookie(objects::GPS0_HANDLER, q7s::UART_GNSS_1_DEV, + auto uartCookieGps1 = new UartCookie(objects::GPS1_HANDLER, q7s::UART_GNSS_1_DEV, UartModes::CANONICAL, 9600, uart::HYPERION_GPS_REPLY_MAX_BUFFER); uartCookieGps1->setToFlushInput(true); uartCookieGps1->setReadCycles(6); - new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, uartCookieGps0); - new GPSHyperionHandler(objects::GPS1_HANDLER, objects::UART_COM_IF, uartCookieGps1); + new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, uartCookieGps0, true); + new GPSHyperionHandler(objects::GPS1_HANDLER, objects::UART_COM_IF, uartCookieGps1, true); } void ObjectFactory::createHeaterComponents() { diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 7d8334d2..ed04f664 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -36,6 +36,8 @@ debugging. */ #define OBSW_ADD_STAR_TRACKER 0 #define OBSW_ADD_PLOC_SUPERVISOR 0 #define OBSW_ADD_PLOC_MPSOC 0 +#define OBSW_ADD_SUN_SENSORS 0 +#define OBSW_ADD_ACS_BOARD 0 /*******************************************************************/ /** All of the following flags should be disabled for mission code */ diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 6d76e62b..fb1b6044 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -520,6 +520,7 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { // Length of a communication cycle uint32_t length = thisSequence->getPeriodMs(); + static_cast(length); #if OBSW_ADD_PLOC_MPSOC == 1 thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0, @@ -550,56 +551,45 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { #if Q7S_ADD_SYRLINKS_HANDLER == 1 thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); -#endif -#if OBSW_ADD_ACS_BOARD == 1 - thisSequence->addSlot(objects::GPS0_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GPS1_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); -#endif - thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); - -#if OBSW_ADD_ACS_BOARD == 1 - thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); -#endif - -#if Q7S_ADD_SYRLINKS_HANDLER == 1 thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE); -#endif -#if OBSW_ADD_ACS_BOARD == 1 - thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); -#endif - -#if Q7S_ADD_SYRLINKS_HANDLER == 1 thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ); -#endif -#if OBSW_ADD_ACS_BOARD == 1 - thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); -#endif - -#if Q7S_ADD_SYRLINKS_HANDLER == 1 thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); #endif + #if OBSW_ADD_ACS_BOARD == 1 + +#if OBSW_ADD_GPS_0 == 1 + thisSequence->addSlot(objects::GPS0_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); +#endif /* OBSW_ADD_GPS_0 == 1 */ + +#if OBSW_ADD_GPS_1 == 1 + thisSequence->addSlot(objects::GPS1_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); -#endif +#endif /* OBSW_ADD_GPS_1 == 1 */ + +#endif /* OBSW_ADD_ACS_BOARD == 1 */ #if OBSW_ADD_STAR_TRACKER == 1 thisSequence->addSlot(objects::START_TRACKER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); -- 2.43.0 From e9849bfedd55254d18182417af4966f9dc4a80b7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 20 Aug 2021 15:25:02 +0200 Subject: [PATCH 005/102] some fixes --- .../pollingSequenceFactory.cpp | 44 +++++++++++++------ tmtc | 2 +- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index fb1b6044..43e39b38 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -458,6 +458,27 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -481,19 +502,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); - - - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); -#endif +#endif /* OBSW_ADD_ACS_BOARD == 1 */ if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { sif::error << "SPI PST initialization failed" << std::endl; @@ -521,8 +530,10 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { // Length of a communication cycle uint32_t length = thisSequence->getPeriodMs(); static_cast(length); + bool uartPstEmpty = true; #if OBSW_ADD_PLOC_MPSOC == 1 + uartPstEmpty = false; thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.2, @@ -549,6 +560,7 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { #endif #if Q7S_ADD_SYRLINKS_HANDLER == 1 + uartPstEmpty = false; thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.2, @@ -564,6 +576,7 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { #if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_GPS_0 == 1 + uartPstEmpty = false; thisSequence->addSlot(objects::GPS0_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.2, @@ -577,6 +590,7 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { #endif /* OBSW_ADD_GPS_0 == 1 */ #if OBSW_ADD_GPS_1 == 1 + uartPstEmpty = false; thisSequence->addSlot(objects::GPS1_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.2, @@ -592,6 +606,7 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { #endif /* OBSW_ADD_ACS_BOARD == 1 */ #if OBSW_ADD_STAR_TRACKER == 1 + uartPstEmpty = false; thisSequence->addSlot(objects::START_TRACKER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::START_TRACKER, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::START_TRACKER, length * 0.4, DeviceHandlerIF::GET_WRITE); @@ -599,6 +614,9 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::START_TRACKER, length * 0.8, DeviceHandlerIF::GET_READ); #endif + if(uartPstEmpty) { + return HasReturnvaluesIF::RETURN_OK; + } if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { sif::error << "UART PST initialization failed" << std::endl; return HasReturnvaluesIF::RETURN_FAILED; diff --git a/tmtc b/tmtc index a7f1ed90..d2093dca 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit a7f1ed904c460005c6d22f17ab496694ae150046 +Subproject commit d2093dca5e87a9dd7ac39321ae0f19711a5eb4ed -- 2.43.0 From 5b9811a950928f46d367869715e2a90357905749 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 20 Aug 2021 15:46:51 +0200 Subject: [PATCH 006/102] disabled all devices except for ADIS device --- fsfw | 2 +- .../pollingSequenceFactory.cpp | 130 +++++++++--------- mission/devices/GyroADIS16507Handler.cpp | 1 + 3 files changed, 67 insertions(+), 66 deletions(-) diff --git a/fsfw b/fsfw index 882da68a..7d037784 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 882da68a2f0c1301d433d517c449c9c31f3cb35e +Subproject commit 7d0377845bd1bde75fcb81a8bf5fb4234718576a diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 43e39b38..d3593da6 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -425,49 +425,49 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); #if OBSW_ADD_ACS_BOARD == 1 - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); +// +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); +// +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); +// +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -480,28 +480,28 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); +// +// +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); #endif /* OBSW_ADD_ACS_BOARD == 1 */ if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { diff --git a/mission/devices/GyroADIS16507Handler.cpp b/mission/devices/GyroADIS16507Handler.cpp index 2034d6a2..c744ff51 100644 --- a/mission/devices/GyroADIS16507Handler.cpp +++ b/mission/devices/GyroADIS16507Handler.cpp @@ -73,6 +73,7 @@ ReturnValue_t GyroADIS16507Handler::buildTransitionDeviceCommand(DeviceCommandId break; } case(InternalState::STARTUP): { + return NOTHING_TO_SEND; break; } default: { -- 2.43.0 From bb58281fba4c58fe733fe480861e535ad761a48c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 20 Aug 2021 18:48:05 +0200 Subject: [PATCH 007/102] minor fix for gps --- bsp_q7s/core/ObjectFactory.cpp | 28 ++++++++------- .../pollingSequenceFactory.cpp | 34 ++++++++++++------- 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index ef94e9d5..a22f219e 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -274,43 +274,43 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, GpioCallback* susgpio = nullptr; susgpio = new GpioCallback("Chip select SUS 1", gpio::OUT, 1, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieSus->addGpio(gpioIds::CS_SUS_1, susgpio); susgpio = new GpioCallback("Chip select SUS 2", gpio::OUT, 1, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieSus->addGpio(gpioIds::CS_SUS_2, susgpio); susgpio = new GpioCallback("Chip select SUS 3", gpio::OUT, 1, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieSus->addGpio(gpioIds::CS_SUS_3, susgpio); susgpio = new GpioCallback("Chip select SUS 4", gpio::OUT, 1, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieSus->addGpio(gpioIds::CS_SUS_4, susgpio); susgpio = new GpioCallback("Chip select SUS 5", gpio::OUT, 1, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieSus->addGpio(gpioIds::CS_SUS_5, susgpio); susgpio = new GpioCallback("Chip select SUS 6", gpio::OUT, 1, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieSus->addGpio(gpioIds::CS_SUS_6, susgpio); susgpio = new GpioCallback("Chip select SUS 7", gpio::OUT, 1, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieSus->addGpio(gpioIds::CS_SUS_7, susgpio); susgpio = new GpioCallback("Chip select SUS 8", gpio::OUT, 1, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieSus->addGpio(gpioIds::CS_SUS_8, susgpio); susgpio = new GpioCallback("Chip select SUS 9", gpio::OUT, 1, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieSus->addGpio(gpioIds::CS_SUS_9, susgpio); susgpio = new GpioCallback("Chip select SUS 10", gpio::OUT, 1, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieSus->addGpio(gpioIds::CS_SUS_10, susgpio); susgpio = new GpioCallback("Chip select SUS 11", gpio::OUT, 1, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio); susgpio = new GpioCallback("Chip select SUS 12", gpio::OUT, 1, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieSus->addGpio(gpioIds::CS_SUS_12, susgpio); susgpio = new GpioCallback("Chip select SUS 13", gpio::OUT, 1, - &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieSus->addGpio(gpioIds::CS_SUS_13, susgpio); gpioComIF->addGpios(gpioCookieSus); @@ -471,6 +471,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI auto uartCookieGps0 = new UartCookie(objects::GPS0_HANDLER, q7s::UART_GNSS_0_DEV, UartModes::CANONICAL, 9600, uart::HYPERION_GPS_REPLY_MAX_BUFFER); + uartCookieGps0->setToFlushInput(true); + uartCookieGps0->setReadCycles(6); auto uartCookieGps1 = new UartCookie(objects::GPS1_HANDLER, q7s::UART_GNSS_1_DEV, UartModes::CANONICAL, 9600, uart::HYPERION_GPS_REPLY_MAX_BUFFER); uartCookieGps1->setToFlushInput(true); diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index d3593da6..045a7af3 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -469,16 +469,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -490,8 +490,18 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // DeviceHandlerIF::SEND_READ); // thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); -// -// + + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + // thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, -- 2.43.0 From dc0c8c704c61acb8ab18187b5fb1f3a29e6d8539 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 20 Aug 2021 20:18:56 +0200 Subject: [PATCH 008/102] debugging GPS: uart is blocking! --- bsp_q7s/core/ObjectFactory.cpp | 8 ++++++-- .../pollingSequenceFactory.cpp | 20 +++++++++---------- mission/devices/GPSHyperionHandler.cpp | 15 +++++++++++++- mission/devices/GPSHyperionHandler.h | 3 ++- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index a22f219e..a5a69a35 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -477,8 +477,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI UartModes::CANONICAL, 9600, uart::HYPERION_GPS_REPLY_MAX_BUFFER); uartCookieGps1->setToFlushInput(true); uartCookieGps1->setReadCycles(6); - new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, uartCookieGps0, true); - new GPSHyperionHandler(objects::GPS1_HANDLER, objects::UART_COM_IF, uartCookieGps1, true); + auto gpsHandler0 = new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, + uartCookieGps0, true); + gpsHandler0->setStartUpImmediately(); + auto gpsHandler1 = new GPSHyperionHandler(objects::GPS1_HANDLER, objects::UART_COM_IF, + uartCookieGps1, true); + gpsHandler1->setStartUpImmediately(); } void ObjectFactory::createHeaterComponents() { diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 045a7af3..60d69e13 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -491,16 +491,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 34fdd47d..0abf10c2 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -121,7 +121,7 @@ ReturnValue_t GPSHyperionHandler::interpretDeviceReply(DeviceCommandId_t id, } uint32_t GPSHyperionHandler::getTransitionDelayMs(Mode_t from, Mode_t to) { - return 5000; + return 20000; } ReturnValue_t GPSHyperionHandler::initializeLocalDataPool( @@ -150,3 +150,16 @@ void GPSHyperionHandler::fillCommandAndReplyMap() { void GPSHyperionHandler::modeChanged() { internalState = InternalStates::NONE; } + +void GPSHyperionHandler::debugInterface(uint8_t positionTracker, object_id_t objectId, + uint32_t parameter) { + if(positionTracker == 0) { + sif::debug << "state machine, mode " << parameter << std::endl; + } + else if(positionTracker == 1) { + sif::debug << "ALIVE" << std::endl; + } + if(positionTracker == 5) { + (void) positionTracker; + } +} diff --git a/mission/devices/GPSHyperionHandler.h b/mission/devices/GPSHyperionHandler.h index 49d8f416..ca7898ae 100644 --- a/mission/devices/GPSHyperionHandler.h +++ b/mission/devices/GPSHyperionHandler.h @@ -49,7 +49,8 @@ protected: uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) override; - + virtual void debugInterface(uint8_t positionTracker = 0, + object_id_t objectId = 0, uint32_t parameter = 0) override; private: lwgps_t gpsData = {}; GpsPrimaryDataset gpsSet; -- 2.43.0 From d1a25bfa65766b39e7e143605e43017ed2aa1525 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 22 Aug 2021 20:25:05 +0200 Subject: [PATCH 009/102] bugfixes hyperion handler --- fsfw | 2 +- linux/fsfwconfig/OBSWConfig.h.in | 3 ++- mission/devices/GPSHyperionHandler.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fsfw b/fsfw index 7d037784..afd375a7 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 7d0377845bd1bde75fcb81a8bf5fb4234718576a +Subproject commit afd375a7f86730dd865aebac257f40c58fc690df diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index ed04f664..79340e26 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -32,12 +32,13 @@ debugging. */ //! Timers can mess up the code when debugging //! All of this should be enabled for mission code! #define OBSW_ENABLE_TIMERS 1 -#define OBSW_ADD_GPS 0 #define OBSW_ADD_STAR_TRACKER 0 #define OBSW_ADD_PLOC_SUPERVISOR 0 #define OBSW_ADD_PLOC_MPSOC 0 #define OBSW_ADD_SUN_SENSORS 0 #define OBSW_ADD_ACS_BOARD 0 +#define OBSW_ADD_GPS_0 0 +#define OBSW_ADD_GPS_1 0 /*******************************************************************/ /** All of the following flags should be disabled for mission code */ diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 0abf10c2..22e1d948 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -37,11 +37,11 @@ void GPSHyperionHandler::doShutDown() { } ReturnValue_t GPSHyperionHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) { - return HasReturnvaluesIF::RETURN_OK; + return NOTHING_TO_SEND; } ReturnValue_t GPSHyperionHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) { - return HasReturnvaluesIF::RETURN_OK; + return NOTHING_TO_SEND; } ReturnValue_t GPSHyperionHandler::buildCommandFromCommand( -- 2.43.0 From acc1849fbbb3f6853fd09edc8c4c82e4f4f72615 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 23 Aug 2021 09:40:35 +0200 Subject: [PATCH 010/102] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index afd375a7..fd2916af 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit afd375a7f86730dd865aebac257f40c58fc690df +Subproject commit fd2916af1162aabbf5dc2b7914885b251700f907 -- 2.43.0 From 1716034926a1e4b6f7764b317efe97ee7ca2655c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 23 Aug 2021 08:49:06 -0400 Subject: [PATCH 011/102] updated submodule link --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index b0016647..1f3dc6ec 100644 --- a/.gitmodules +++ b/.gitmodules @@ -15,7 +15,7 @@ url = https://github.com/rmspacefish/lwgps.git [submodule "generators/fsfwgen"] path = generators/fsfwgen - url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-generators.git + url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-gen.git [submodule "thirdparty/arcsec_star_tracker"] path = thirdparty/arcsec_star_tracker url = https://egit.irs.uni-stuttgart.de/eive/arcsec_star_tracker.git -- 2.43.0 From 23894f97494442b094cd54e107259bf61673a911 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 23 Aug 2021 08:50:41 -0400 Subject: [PATCH 012/102] updated link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index def12cf0..cdf44008 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ prerequisites. as a [separate download](#arm-toolchain) 2. [Q7S sysroot](#q7s-sysroot) on local development machine 3. Recommended: Eclipse or [Vivado 2018.2 SDK](#vivado) for OBSW development -3. [TCF agent] running on Q7S +3. [TCF agent](https://wiki.eclipse.org/TCF) running on Q7S ## Hardware Design -- 2.43.0 From 922c33df57a621fab2d91f1404ab07b12c85a3a5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 23 Aug 2021 09:03:48 -0400 Subject: [PATCH 013/102] using Q7S_ROOTFS now --- cmake/Q7SCrossCompileConfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Q7SCrossCompileConfig.cmake b/cmake/Q7SCrossCompileConfig.cmake index 1d23b16d..57f59cbd 100644 --- a/cmake/Q7SCrossCompileConfig.cmake +++ b/cmake/Q7SCrossCompileConfig.cmake @@ -1,5 +1,5 @@ # CROSS_COMPILE also needs to be set accordingly or passed to the CMake command -if(NOT DEFINED ENV{Q7S_SYSROOT}) +if(NOT DEFINED ENV{Q7S_ROOTFS}) # Sysroot has not been cached yet and was not set in environment either if(NOT DEFINED SYSROOT_PATH) message(FATAL_ERROR -- 2.43.0 From e4e765300db890941193539fecf66dc9e5fc5160 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 23 Aug 2021 09:08:48 -0400 Subject: [PATCH 014/102] more bugfixes --- cmake/Q7SCrossCompileConfig.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/Q7SCrossCompileConfig.cmake b/cmake/Q7SCrossCompileConfig.cmake index 57f59cbd..d4d05f4e 100644 --- a/cmake/Q7SCrossCompileConfig.cmake +++ b/cmake/Q7SCrossCompileConfig.cmake @@ -1,3 +1,6 @@ +if(DEFINED ENV{Q7S_SYSROOT}) + set(ENV{Q7S_ROOTFS} $ENV{Q7S_SYSROOT}) +endif() # CROSS_COMPILE also needs to be set accordingly or passed to the CMake command if(NOT DEFINED ENV{Q7S_ROOTFS}) # Sysroot has not been cached yet and was not set in environment either @@ -7,7 +10,7 @@ if(NOT DEFINED ENV{Q7S_ROOTFS}) ) endif() else() - set(SYSROOT_PATH "$ENV{Q7S_SYSROOT}" CACHE PATH "Q7S root filesystem path") + set(SYSROOT_PATH "$ENV{Q7S_ROOTFS}" CACHE PATH "Q7S root filesystem path") endif() if(NOT DEFINED ENV{CROSS_COMPILE}) -- 2.43.0 From 90622eb25a45cd57f28ee9944b94f3dda9974e29 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 23 Aug 2021 20:38:18 +0200 Subject: [PATCH 015/102] important fixes --- CMakeLists.txt | 11 ++++++----- cmake/HardwareOsPreConfig.cmake | 4 ++-- linux/fsfwconfig/OBSWConfig.h.in | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dca4acf8..f366b744 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,7 @@ include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake) pre_source_hw_os_config() if(TGT_BSP) + message(STATUS ${TGT_BSP}) if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack" ) @@ -97,18 +98,18 @@ if(TGT_BSP) endif() endif() - if(${TGT_BSP} MATCHES "arm/raspberrypi") + if(TGT_BSP MATCHES "arm/raspberrypi") # Used by configure file set(RASPBERRY_PI ON) set(FSFW_HAL_ADD_RASPBERRY_PI ON) endif() - if(${TGT_BSP} MATCHES "arm/beagleboneblack") + if(TGT_BSP MATCHES "arm/beagleboneblack") # Used by configure file set(BEAGLEBONEBLACK ON) endif() - if(${TGT_BSP} MATCHES "arm/q7s") + if(TGT_BSP MATCHES "arm/q7s") # Used by configure file set(XIPHOS_Q7S ON) endif() @@ -122,9 +123,9 @@ if(NOT EIVE_BUILD_WATCHDOG) configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h) configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h) configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h) - if(${TGT_BSP} MATCHES "arm/q7s") + if(TGT_BSP MATCHES "arm/q7s") configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h) - elseif(${TGT_BSP} MATCHES "arm/raspberrypi") + elseif(TGT_BSP MATCHES "arm/raspberrypi") configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h) endif() endif() diff --git a/cmake/HardwareOsPreConfig.cmake b/cmake/HardwareOsPreConfig.cmake index 535f9b9e..3ff67565 100644 --- a/cmake/HardwareOsPreConfig.cmake +++ b/cmake/HardwareOsPreConfig.cmake @@ -53,9 +53,9 @@ endif() if(TGT_BSP) - if (${TGT_BSP} MATCHES "arm/raspberrypi" OR ${TGT_BSP} MATCHES "arm/beagleboneblack") + if (TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack") set(BSP_PATH "bsp_linux_board") - elseif(${TGT_BSP} MATCHES "arm/q7s") + elseif(TGT_BSP MATCHES "arm/q7s") set(BSP_PATH "bsp_q7s") else() message(WARNING "CMake not configured for this target!") diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 79340e26..04bdeff0 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -6,9 +6,9 @@ #ifndef FSFWCONFIG_OBSWCONFIG_H_ #define FSFWCONFIG_OBSWCONFIG_H_ -/* #undef RASPBERRY_PI */ -#define XIPHOS_Q7S -/* #undef BEAGLEBONEBLACK */ +#cmakedefine RASPBERRY_PI +#cmakedefine XIPHOS_Q7S +#cmakedefine BEAGLEBONEBLACK #ifdef RASPBERRY_PI #include "rpiConfig.h" -- 2.43.0 From 26afe1d94af93b3b5d624b31d1ec4191dfa58267 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 23 Aug 2021 20:43:27 +0200 Subject: [PATCH 016/102] fixes in C++ test code --- bsp_linux_board/ObjectFactory.cpp | 2 +- linux/boardtest/SpiTestClass.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 237a7ead..01471812 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -124,7 +124,7 @@ void ObjectFactory::produce(void* args){ "GYRO_0_ADIS", gpio::Direction::OUT, 1); gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, "GYRO_1_L3G", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_L3G_CS, gpio::GYRO_2_BCM_PIN, + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_2_BCM_PIN, "GYRO_2_L3G", gpio::Direction::OUT, 1); gpioIF->addGpios(gpioCookie); diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index f3ba3279..730a1743 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -321,7 +321,7 @@ void SpiTestClass::acsInit() { gpio = new GpiodRegular(rpiGpioName, gyro2L3gd20ChipSelect, "GYRO_2_L3G", gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::GYRO_2_L3G_CS, gpio); + gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); gpio = new GpiodRegular(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", gpio::Direction::OUT, 1); -- 2.43.0 From c1ca43113b81a5cb196edfd540e78c0493eaa3e1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 24 Aug 2021 10:40:23 +0200 Subject: [PATCH 017/102] update README --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index cdf44008..8c4d5da3 100644 --- a/README.md +++ b/README.md @@ -324,6 +324,13 @@ For Linux, you can also download a more recent version of the [Linaro 8.3.0 cross-compiler](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads) from [here](https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz?revision=e09a1c45-0ed3-4a8e-b06b-db3978fd8d56&la=en&hash=93ED4444B8B3A812B893373B490B90BBB28FD2E3) +### Using `docnav` on more recent Linux versions + +If you want to use `docnav` for navigating Xilinx documentation, it is recommended to install +it as a standalone version from [here](https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/documentation-nav.html). +This is because the `docnav` installed as part of version 2018.2 requires `libpng12`, which is not part of +more recent disitributions anymore. + ## Installing toolchain without Vivado You can download the toolchains for Windows and Linux -- 2.43.0 From d8e1e4561deb51697ef2a2492dcdcbaf8f7561ee Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 24 Aug 2021 16:41:10 +0200 Subject: [PATCH 018/102] troubleshooting for wayland issue --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 8c4d5da3..07f67088 100644 --- a/README.md +++ b/README.md @@ -324,6 +324,26 @@ For Linux, you can also download a more recent version of the [Linaro 8.3.0 cross-compiler](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads) from [here](https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz?revision=e09a1c45-0ed3-4a8e-b06b-db3978fd8d56&la=en&hash=93ED4444B8B3A812B893373B490B90BBB28FD2E3) +### Compatibility issues with wayland on more recent Linux distributions + +If Vivado crashes and you find following lines in the `hs_err_pid*` files: + +```sh +# +# An unexpected error has occurred (11) +# +Stack: +/opt/Xilinx/Vivado/2017.4/tps/lnx64/jre/lib/amd64/server/libjvm.so(+0x923da9) [0x7f666cf5eda9] +/opt/Xilinx/Vivado/2017.4/tps/lnx64/jre/lib/amd64/server/libjvm.so(JVM_handle_linux_signal+0xb6) [0x7f666cf653f6] +/opt/Xilinx/Vivado/2017.4/tps/lnx64/jre/lib/amd64/server/libjvm.so(+0x9209d3) [0x7f666cf5b9d3] +/lib/x86_64-linux-gnu/libc.so.6(+0x35fc0) [0x7f66a993efc0] +/opt/Xilinx/Vivado/2017.4/tps/lnx64/jre/lib/amd64/libawt_xawt.so(+0x42028) [0x7f664e24d028] +... +``` + +You can [solve this](https://forums.xilinx.com/t5/Design-Entry/Bug-Vivado-2017-4-crashing-on-rightclick-in-console-log/td-p/881811) +by logging in with `xorg` like specified [here](https://www.maketecheasier.com/switch-xorg-wayland-ubuntu1710/). + ### Using `docnav` on more recent Linux versions If you want to use `docnav` for navigating Xilinx documentation, it is recommended to install -- 2.43.0 From 74e4415d588354570b57e00136d35c79ce04f323 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 2 Sep 2021 20:04:41 +0200 Subject: [PATCH 019/102] updated busConf file --- bsp_linux_board/ObjectFactory.cpp | 1 + bsp_q7s/boardconfig/busConf.h | 64 +++++++++++++++++++++---------- bsp_q7s/core/ObjectFactory.cpp | 12 +++--- common/config/devConf.h | 2 + 4 files changed, 53 insertions(+), 26 deletions(-) diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 01471812..372fbf25 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -112,6 +112,7 @@ void ObjectFactory::produce(void* args){ if(gpioCookie == nullptr) { gpioCookie = new GpioCookie(); } + // TODO: Missing pin for Gyro 2 gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, "MGM_0_LIS3", gpio::Direction::OUT, 1); gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN, diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index a5cbcf19..7385fe59 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -10,36 +10,58 @@ static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-1"; static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ttyUL3"; static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ttyUL4"; +static constexpr char UART_SYRLINKS_DEV[] = "/dev/ttyUL5"; static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8"; static constexpr char UART_GNSS_0_DEV[] = "/dev/ttyUL0"; static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2"; -static constexpr char GPIO_GYRO_ADIS_CHIP[] = "gpiochip4"; -static constexpr char GPIO_ACS_BOARD_DEFAULT_CHIP[] = "gpiochip5"; -static constexpr char GPIO_MGM2_LIS3_CHIP[] = "gpiochip6"; +/**************************************************************/ +/** OBC1E */ +/**************************************************************/ +static constexpr char GPIO_MULTIPURPOSE_1V8_OBC1D = "gpiochip4"; +static const char* const GPIO_GYRO_ADIS_CHIP = GPIO_MULTIPURPOSE_1V8_OBC1D; +static constexpr uint32_t GPIO_GYRO_0_ADIS_CS = 0; // Package Pin: W20 +static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 2; // AA22 -// TODO: Determine new pins, additional ADIS gyro device -static constexpr uint32_t GPIO_GYRO_0_ADIS_CS = 0; -static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 18; -static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 2; -static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 1; +/**************************************************************/ +/** OBC1F B0 */ +/**************************************************************/ +static constexpr char GPIO_FLEX_OBC1F_B0[] = "gpiochip5"; +static const char* const GPIO_ACS_BOARD_DEFAULT_CHIP = GPIO_FLEX_OBC1F_B0; +static const char* const GPIO_RW_DEFAULT_CHIP = GPIO_FLEX_OBC1F_B0; +static const char* const GPIO_RAD_SENSOR_CHIP = GPIO_FLEX_OBC1F_B0; -static constexpr uint32_t GPIO_MGM_0_LIS3_CS = 5; -static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16; -static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0; -static constexpr uint32_t GPIO_MGM_3_RM3100_CS = 10; - -static constexpr char GPIO_RW_DEFAULT_CHIP[] = "gpiochip5"; -static constexpr uint32_t GPIO_RW_0_CS = 7; +static constexpr uint32_t GPIO_RW_0_CS = 7; // B20 static constexpr uint32_t GPIO_RW_1_CS = 3; static constexpr uint32_t GPIO_RW_2_CS = 11; static constexpr uint32_t GPIO_RW_3_CS = 6; -static constexpr char GPIO_RW_SPI_MUX_CHIP[] = "gpiochip11"; -static constexpr uint32_t GPIO_RW_SPI_MUX_CS = 57; +static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 18; +static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 1; +static constexpr uint32_t GPIO_MGM_0_LIS3_CS = 5; +static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16; -static constexpr char GPIO_HEATER_CHIP[] = "gpiochip7"; +static constexpr uint32_t GPIO_MGM_3_RM3100_CS = 10; +// Active low reset pin +static constexpr uint32_t GPIO_RESET_GNSS_0 = 8; // D22 +static constexpr uint32_t GPIO_RESET_GNSS_1 = 12; // B21 + +static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; // R18 + +/**************************************************************/ +/** OBC1F B1 */ +/**************************************************************/ +static constexpr char GPIO_FLEX_OBC1F_B1[] = "gpiochip6"; +static const char* const GPIO_MGM2_LIS3_CHIP = GPIO_FLEX_OBC1F_B1; +static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0; + +/**************************************************************/ +/** OBC1C */ +/**************************************************************/ +static constexpr char GPIO_3V3_OBC1C[] = "gpiochip7"; +static const char* const GPIO_HEATER_CHIP = GPIO_3V3_OBC1C; +static const char* const GPIO_SOLAR_ARR_DEPL_CHIP = GPIO_3V3_OBC1C; static constexpr uint32_t GPIO_HEATER_0_PIN = 6; static constexpr uint32_t GPIO_HEATER_1_PIN = 12; static constexpr uint32_t GPIO_HEATER_2_PIN = 7; @@ -49,12 +71,12 @@ static constexpr uint32_t GPIO_HEATER_5_PIN = 0; static constexpr uint32_t GPIO_HEATER_6_PIN = 1; static constexpr uint32_t GPIO_HEATER_7_PIN = 11; -static constexpr char GPIO_SOLAR_ARR_DEPL_CHIP[] = "gpiochip7"; static constexpr uint32_t GPIO_SOL_DEPL_SA_0_PIN = 4; static constexpr uint32_t GPIO_SOL_DEPL_SA_1_PIN = 2; -static constexpr char GPIO_RAD_SENSOR_CHIP[] = "gpiochip5"; -static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; +static constexpr char GPIO_RW_SPI_MUX_CHIP[] = "gpiochip11"; +static constexpr uint32_t GPIO_RW_SPI_MUX_CS = 57; + } #endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */ diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 5be7163a..1b122b93 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -1,4 +1,3 @@ -#include #include "ObjectFactory.h" #include "OBSWConfig.h" #include "devConf.h" @@ -32,6 +31,7 @@ #include "mission/devices/P60DockHandler.h" #include "mission/devices/Tmp1075Handler.h" #include "mission/devices/Max31865PT1000Handler.h" +#include "mission/devices/GyroADIS16507Handler.h" #include "mission/devices/IMTQHandler.h" #include "mission/devices/SyrlinksHkHandler.h" #include "mission/devices/MGMHandlerLIS3MDL.h" @@ -169,7 +169,8 @@ void ObjectFactory::produce(void* args){ sif::info << "Created UDP server for TMTC commanding with listener port " << udpBridge->getUdpPort() << std::endl; #else - new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); + auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); + tmtcBridge->setMaxNumberOfPacketsStored(50); auto tcpServer = new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); sif::info << "Created TCP server for TMTC commanding with listener port " << tcpServer->getTcpPort() << std::endl; @@ -474,11 +475,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI gyroL3gHandler->setStartUpImmediately(); auto uartCookieGps0 = new UartCookie(objects::GPS0_HANDLER, q7s::UART_GNSS_0_DEV, - UartModes::CANONICAL, 9600, uart::HYPERION_GPS_REPLY_MAX_BUFFER); + UartModes::CANONICAL, uart::GNSS_BAUD, uart::HYPERION_GPS_REPLY_MAX_BUFFER); uartCookieGps0->setToFlushInput(true); uartCookieGps0->setReadCycles(6); auto uartCookieGps1 = new UartCookie(objects::GPS1_HANDLER, q7s::UART_GNSS_1_DEV, - UartModes::CANONICAL, 9600, uart::HYPERION_GPS_REPLY_MAX_BUFFER); + UartModes::CANONICAL, uart::GNSS_BAUD, uart::HYPERION_GPS_REPLY_MAX_BUFFER); uartCookieGps1->setToFlushInput(true); uartCookieGps1->setReadCycles(6); auto gpsHandler0 = new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, @@ -550,7 +551,8 @@ void ObjectFactory::createSolarArrayDeploymentComponents() { void ObjectFactory::createSyrlinksComponents() { UartCookie* syrlinksUartCookie = new UartCookie(objects::SYRLINKS_HK_HANDLER, - std::string("/dev/ttyUL5"), UartModes::NON_CANONICAL, 38400, SYRLINKS::MAX_REPLY_SIZE); + q7s::UART_SYRLINKS_DEV, UartModes::NON_CANONICAL, uart::SYRLINKS_BAUD, + SYRLINKS::MAX_REPLY_SIZE); syrlinksUartCookie->setParityEven(); new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie); diff --git a/common/config/devConf.h b/common/config/devConf.h index dc04d5b4..7f3094fa 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -36,6 +36,8 @@ static constexpr uint32_t RTD_SPEED = 2000000; namespace uart { static constexpr size_t HYPERION_GPS_REPLY_MAX_BUFFER = 1024; +static constexpr uint32_t SYRLINKS_BAUD = 38400; +static constexpr uint32_t GNSS_BAUD = 9600; static constexpr uint32_t PLOC_MPSOC_BAUD = 115200; static constexpr uint32_t PLOC_SUPERVISOR_BAUD = 115200; static constexpr uint32_t STAR_TRACKER_BAUD = 115200; -- 2.43.0 From 94979e3561d219d1ca3e118551294c55985dc3a3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 2 Sep 2021 20:27:12 +0200 Subject: [PATCH 020/102] pulling reset pin gnss high --- bsp_q7s/boardconfig/busConf.h | 2 +- bsp_q7s/core/ObjectFactory.cpp | 9 ++++++++- linux/fsfwconfig/devices/gpioIds.h | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index 7385fe59..3f83828a 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -19,7 +19,7 @@ static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2"; /**************************************************************/ /** OBC1E */ /**************************************************************/ -static constexpr char GPIO_MULTIPURPOSE_1V8_OBC1D = "gpiochip4"; +static constexpr char GPIO_MULTIPURPOSE_1V8_OBC1D[] = "gpiochip4"; static const char* const GPIO_GYRO_ADIS_CHIP = GPIO_MULTIPURPOSE_1V8_OBC1D; static constexpr uint32_t GPIO_GYRO_0_ADIS_CS = 0; // Package Pin: W20 static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 2; // AA22 diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 1b122b93..cae61ab6 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -391,7 +391,6 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComIF* uartComIF) { GpioCookie* gpioCookieAcsBoard = new GpioCookie(); GpiodRegular* gpio = nullptr; - // TODO: Determine new Gyro GPIO pins gpio = new GpiodRegular(q7s::GPIO_GYRO_ADIS_CHIP, q7s::GPIO_GYRO_0_ADIS_CS, "CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); @@ -418,6 +417,14 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI "CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); + // GNSS reset pins are active low + gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_RESET_GNSS_0, + "GNSS_0_NRESET", gpio::OUT, gpio::HIGH); + gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_NRESET, gpio); + gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_RESET_GNSS_1, + "GNSS_1_NRESET", gpio::OUT, gpio::HIGH); + gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio); + gpioComIF->addGpios(gpioCookieAcsBoard); std::string spiDev = q7s::SPI_DEFAULT_DEV; diff --git a/linux/fsfwconfig/devices/gpioIds.h b/linux/fsfwconfig/devices/gpioIds.h index ae91e905..e8709f2e 100644 --- a/linux/fsfwconfig/devices/gpioIds.h +++ b/linux/fsfwconfig/devices/gpioIds.h @@ -25,6 +25,9 @@ enum gpioId_t { MGM_2_LIS3_CS, MGM_3_RM3100_CS, + GNSS_0_NRESET, + GNSS_1_NRESET, + TEST_ID_0, TEST_ID_1, -- 2.43.0 From ac3812f268a65972b0a9bb2510324a0187976fe3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Sep 2021 11:12:29 +0200 Subject: [PATCH 021/102] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index d2093dca..03d0cf6e 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit d2093dca5e87a9dd7ac39321ae0f19711a5eb4ed +Subproject commit 03d0cf6e0921cdce71a5f99da233c88c92963a46 -- 2.43.0 From 49b8232f128fd872f0b2e20cb471d63fd9bdaba0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Sep 2021 11:12:54 +0200 Subject: [PATCH 022/102] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 03d0cf6e..48d781aa 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 03d0cf6e0921cdce71a5f99da233c88c92963a46 +Subproject commit 48d781aaf19c3884d97859634349ad1c02ac2d6c -- 2.43.0 From f97d5df75f35d8ca02f102f7428be65052b6d129 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Sep 2021 11:35:23 +0200 Subject: [PATCH 023/102] fsfw and tmtc update --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index fd2916af..469eba3c 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit fd2916af1162aabbf5dc2b7914885b251700f907 +Subproject commit 469eba3ce2f82c7b2fcdd494d4ac279eef308195 diff --git a/tmtc b/tmtc index 48d781aa..9e15d2bc 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 48d781aaf19c3884d97859634349ad1c02ac2d6c +Subproject commit 9e15d2bce2d1eacd3b89f8a991b4bd09a6f6c3d1 -- 2.43.0 From 45409fc2d66c2aba2ec521690632fac20e4565b3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Sep 2021 12:07:15 +0200 Subject: [PATCH 024/102] gps handler working properly now --- fsfw | 2 +- mission/devices/GPSHyperionHandler.cpp | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/fsfw b/fsfw index 469eba3c..924c150a 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 469eba3ce2f82c7b2fcdd494d4ac279eef308195 +Subproject commit 924c150af27484f9eb4439ec80c048b46c226890 diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 22e1d948..9a97d2c0 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -110,6 +110,7 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, } } *foundLen = len; + *foundId = GpsHyperion::GPS_REPLY; } return HasReturnvaluesIF::RETURN_OK; @@ -153,13 +154,4 @@ void GPSHyperionHandler::modeChanged() { void GPSHyperionHandler::debugInterface(uint8_t positionTracker, object_id_t objectId, uint32_t parameter) { - if(positionTracker == 0) { - sif::debug << "state machine, mode " << parameter << std::endl; - } - else if(positionTracker == 1) { - sif::debug << "ALIVE" << std::endl; - } - if(positionTracker == 5) { - (void) positionTracker; - } } -- 2.43.0 From 773b745c76135941b45cdf84c36a8611b297d885 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Sep 2021 14:53:04 +0200 Subject: [PATCH 025/102] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 9e15d2bc..0f09809d 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 9e15d2bce2d1eacd3b89f8a991b4bd09a6f6c3d1 +Subproject commit 0f09809d21ceec9878396fb80b645868a0286c2a -- 2.43.0 From d78c746552cd2cccaab89829c3ff5f1babf3b637 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Sep 2021 18:27:33 +0200 Subject: [PATCH 026/102] GPS Handler bugfixes --- mission/devices/GPSHyperionHandler.cpp | 3 ++- tmtc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 9a97d2c0..e6389b58 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -82,7 +82,8 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, // Negative latitude -> South direction gpsSet.latitude.value = gpsData.latitude; // Negative longitude -> West direction - gpsSet.longitude.value = gpsData.latitude; + gpsSet.longitude.value = gpsData.longitude; + gpsSet.altitude.value = gpsData.altitude; gpsSet.fixMode.value = gpsData.fix_mode; gpsSet.satInUse.value = gpsData.sats_in_use; Clock::TimeOfDay_t timeStruct = {}; diff --git a/tmtc b/tmtc index 0f09809d..4e4d69f6 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 0f09809d21ceec9878396fb80b645868a0286c2a +Subproject commit 4e4d69f6d6f6e55b40e90804b3b8ecdba10d96f5 -- 2.43.0 From 30a57ad5a481aeafb6014d4c21350e7077417323 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Sep 2021 18:42:58 +0200 Subject: [PATCH 027/102] using old transition delay --- mission/devices/GPSHyperionHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index e6389b58..a010a6b0 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -123,7 +123,7 @@ ReturnValue_t GPSHyperionHandler::interpretDeviceReply(DeviceCommandId_t id, } uint32_t GPSHyperionHandler::getTransitionDelayMs(Mode_t from, Mode_t to) { - return 20000; + return 5000; } ReturnValue_t GPSHyperionHandler::initializeLocalDataPool( -- 2.43.0 From 24c7a4e7e3229638c4cf4d319271de06880e5e13 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 7 Sep 2021 09:45:12 +0200 Subject: [PATCH 028/102] added additional comment --- bsp_q7s/core/ObjectFactory.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index cae61ab6..6ce2f6aa 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -425,6 +425,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI "GNSS_1_NRESET", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio); + // GNSS enable pins must be pulled high + gpioComIF->addGpios(gpioCookieAcsBoard); std::string spiDev = q7s::SPI_DEFAULT_DEV; -- 2.43.0 From 405b9e707424bf6ce98a65a7209e280f727f0777 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 7 Sep 2021 09:45:51 +0200 Subject: [PATCH 029/102] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index d2093dca..90b42e7d 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit d2093dca5e87a9dd7ac39321ae0f19711a5eb4ed +Subproject commit 90b42e7de172fee8e6b41d21ee3de13334ec9e53 -- 2.43.0 From 3b3b2ed8c355c15d61177eb08cacaca04912ef74 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 7 Sep 2021 12:00:22 +0200 Subject: [PATCH 030/102] preproc define to log NMEA data --- linux/fsfwconfig/FSFWConfig.h.in | 3 ++- mission/devices/GPSHyperionHandler.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/linux/fsfwconfig/FSFWConfig.h.in b/linux/fsfwconfig/FSFWConfig.h.in index a8519cff..7d1521dc 100644 --- a/linux/fsfwconfig/FSFWConfig.h.in +++ b/linux/fsfwconfig/FSFWConfig.h.in @@ -72,6 +72,7 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; } -#define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 +#define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 +#define FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV 0 #endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index a010a6b0..0dd1f751 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -109,6 +109,8 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, printf("Longitude: %f degrees\n", gpsData.longitude); printf("Altitude: %f meters\n", gpsData.altitude); } +#if FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV == 1 +#endif } *foundLen = len; *foundId = GpsHyperion::GPS_REPLY; -- 2.43.0 From f7c6f167774e8fa58b80d96ff546888f8ccabe03 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 7 Sep 2021 16:11:02 +0200 Subject: [PATCH 031/102] added gps reset callback --- bsp_q7s/CMakeLists.txt | 2 +- .../CMakeLists.txt | 1 + bsp_q7s/callbacks/gnssCallback.cpp | 26 + bsp_q7s/callbacks/gnssCallback.h | 19 + .../rwSpiCallback.cpp | 11 +- .../rwSpiCallback.h | 6 +- bsp_q7s/core/ObjectFactory.cpp | 16 +- mission/devices/GPSHyperionHandler.cpp | 35 +- mission/devices/GPSHyperionHandler.h | 4 + mission/devices/GomspaceDeviceHandler.cpp | 9 + mission/devices/GomspaceDeviceHandler.h | 7 + mission/devices/PDU1Handler.cpp | 76 +- mission/devices/PDU1Handler.h | 2 + .../devicedefinitions/GPSDefinitions.h | 1 + .../devicedefinitions/GomspaceDefinitions.h | 2222 +++++++++-------- tmtc | 2 +- 16 files changed, 1293 insertions(+), 1146 deletions(-) rename bsp_q7s/{spiCallbacks => callbacks}/CMakeLists.txt (76%) create mode 100644 bsp_q7s/callbacks/gnssCallback.cpp create mode 100644 bsp_q7s/callbacks/gnssCallback.h rename bsp_q7s/{spiCallbacks => callbacks}/rwSpiCallback.cpp (97%) rename bsp_q7s/{spiCallbacks => callbacks}/rwSpiCallback.h (93%) diff --git a/bsp_q7s/CMakeLists.txt b/bsp_q7s/CMakeLists.txt index 408d58c1..b2c24d5f 100644 --- a/bsp_q7s/CMakeLists.txt +++ b/bsp_q7s/CMakeLists.txt @@ -12,6 +12,6 @@ else() add_subdirectory(gpio) add_subdirectory(core) add_subdirectory(memory) - add_subdirectory(spiCallbacks) + add_subdirectory(callbacks) add_subdirectory(devices) endif() diff --git a/bsp_q7s/spiCallbacks/CMakeLists.txt b/bsp_q7s/callbacks/CMakeLists.txt similarity index 76% rename from bsp_q7s/spiCallbacks/CMakeLists.txt rename to bsp_q7s/callbacks/CMakeLists.txt index 59d507e6..8c83e26f 100644 --- a/bsp_q7s/spiCallbacks/CMakeLists.txt +++ b/bsp_q7s/callbacks/CMakeLists.txt @@ -1,3 +1,4 @@ target_sources(${TARGET_NAME} PRIVATE rwSpiCallback.cpp + gnssCallback.cpp ) diff --git a/bsp_q7s/callbacks/gnssCallback.cpp b/bsp_q7s/callbacks/gnssCallback.cpp new file mode 100644 index 00000000..479f4a2b --- /dev/null +++ b/bsp_q7s/callbacks/gnssCallback.cpp @@ -0,0 +1,26 @@ +#include "gnssCallback.h" +#include "devices/gpioIds.h" + +#include "fsfw/tasks/TaskFactory.h" + +ReturnValue_t gps::triggerGpioResetPin(void *args) { + ResetArgs* resetArgs = reinterpret_cast(args); + if(args == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + if (resetArgs->gpioComIF == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + gpioId_t gpioId; + if(resetArgs->gnss1) { + gpioId = gpioIds::GNSS_1_NRESET; + + } + else { + gpioId = gpioIds::GNSS_0_NRESET; + } + resetArgs->gpioComIF->pullLow(gpioId); + TaskFactory::delayTask(resetArgs->waitPeriodMs); + resetArgs->gpioComIF->pullHigh(gpioId); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/bsp_q7s/callbacks/gnssCallback.h b/bsp_q7s/callbacks/gnssCallback.h new file mode 100644 index 00000000..9cbb6669 --- /dev/null +++ b/bsp_q7s/callbacks/gnssCallback.h @@ -0,0 +1,19 @@ +#ifndef BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_ +#define BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_ + +#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" + +struct ResetArgs { + bool gnss1 = false; + LinuxLibgpioIF* gpioComIF = nullptr; + uint32_t waitPeriodMs = 100; +}; + +namespace gps { + +ReturnValue_t triggerGpioResetPin(void* args); + +} + +#endif /* BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_ */ diff --git a/bsp_q7s/spiCallbacks/rwSpiCallback.cpp b/bsp_q7s/callbacks/rwSpiCallback.cpp similarity index 97% rename from bsp_q7s/spiCallbacks/rwSpiCallback.cpp rename to bsp_q7s/callbacks/rwSpiCallback.cpp index dce79c42..70fa3ebe 100644 --- a/bsp_q7s/spiCallbacks/rwSpiCallback.cpp +++ b/bsp_q7s/callbacks/rwSpiCallback.cpp @@ -1,9 +1,10 @@ -#include -#include -#include -#include -#include +#include "rwSpiCallback.h" #include "devices/gpioIds.h" +#include "mission/devices/RwHandler.h" + +#include "fsfw_hal/linux/spi/SpiCookie.h" +#include "fsfw_hal/linux/UnixFileGuard.h" +#include "fsfw/serviceinterface/ServiceInterface.h" namespace rwSpiCallback { diff --git a/bsp_q7s/spiCallbacks/rwSpiCallback.h b/bsp_q7s/callbacks/rwSpiCallback.h similarity index 93% rename from bsp_q7s/spiCallbacks/rwSpiCallback.h rename to bsp_q7s/callbacks/rwSpiCallback.h index e5a79e64..cc7c6cbe 100644 --- a/bsp_q7s/spiCallbacks/rwSpiCallback.h +++ b/bsp_q7s/callbacks/rwSpiCallback.h @@ -1,9 +1,9 @@ #ifndef BSP_Q7S_RW_SPI_CALLBACK_H_ #define BSP_Q7S_RW_SPI_CALLBACK_H_ -#include -#include -#include +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw_hal/linux/spi/SpiComIF.h" +#include "fsfw_hal/common/gpio/GpioCookie.h" namespace rwSpiCallback { diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 7ad33c9b..8fcbfa52 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -9,12 +9,13 @@ #include "devices/powerSwitcherList.h" #include "bsp_q7s/gpio/gpioCallbacks.h" #include "bsp_q7s/core/CoreController.h" -#include "bsp_q7s/spiCallbacks/rwSpiCallback.h" #include "bsp_q7s/boardtest/Q7STestTask.h" #include "bsp_q7s/memory/FileSystemHandler.h" #include "bsp_q7s/devices/PlocSupervisorHandler.h" #include "bsp_q7s/devices/PlocUpdater.h" #include "bsp_q7s/devices/PlocMemoryDumper.h" +#include "bsp_q7s/callbacks/rwSpiCallback.h" +#include "bsp_q7s/callbacks/gnssCallback.h" #include "linux/devices/HeaterHandler.h" #include "linux/devices/SolarArrayDeploymentHandler.h" @@ -82,6 +83,9 @@ #include "linux/boardtest/LibgpiodTest.h" #endif +ResetArgs resetArgsGnss0; +ResetArgs resetArgsGnss1; + void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); } @@ -427,6 +431,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI "GNSS_1_NRESET", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio); + + // GNSS enable pins must be pulled high gpioComIF->addGpios(gpioCookieAcsBoard); @@ -485,6 +491,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI objects::SPI_COM_IF, spiCookie); gyroL3gHandler->setStartUpImmediately(); + resetArgsGnss1.gnss1 = true; + resetArgsGnss1.gpioComIF = gpioComIF; + resetArgsGnss1.waitPeriodMs = 100; + resetArgsGnss0.gnss1 = false; + resetArgsGnss0.gpioComIF = gpioComIF; + resetArgsGnss0.waitPeriodMs = 100; auto uartCookieGps0 = new UartCookie(objects::GPS0_HANDLER, q7s::UART_GNSS_0_DEV, UartModes::CANONICAL, uart::GNSS_BAUD, uart::HYPERION_GPS_REPLY_MAX_BUFFER); uartCookieGps0->setToFlushInput(true); @@ -495,9 +507,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI uartCookieGps1->setReadCycles(6); auto gpsHandler0 = new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, uartCookieGps0, true); + gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0); gpsHandler0->setStartUpImmediately(); auto gpsHandler1 = new GPSHyperionHandler(objects::GPS1_HANDLER, objects::UART_COM_IF, uartCookieGps1, true); + gpsHandler1->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss1); gpsHandler1->setStartUpImmediately(); } diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 0dd1f751..c4cb460d 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -6,6 +6,11 @@ #include "lwgps/lwgps.h" +#if FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV == 1 +#include +#include +#endif + GPSHyperionHandler::GPSHyperionHandler(object_id_t objectId, object_id_t deviceCommunication, CookieIF *comCookie, bool debugHyperionGps): DeviceHandlerBase(objectId, deviceCommunication, comCookie), gpsSet(this), @@ -47,6 +52,19 @@ ReturnValue_t GPSHyperionHandler::buildNormalDeviceCommand(DeviceCommandId_t *id ReturnValue_t GPSHyperionHandler::buildCommandFromCommand( DeviceCommandId_t deviceCommand, const uint8_t *commandData, size_t commandDataLen) { + switch(deviceCommand) { + case(GpsHyperion::TRIGGER_RESET_PIN): { + if(resetPinTrigger != nullptr) { + PoolReadGuard pg(&gpsSet); + // Set HK entries invalid + gpsSet.setValidity(false, true); + // The user needs to implement this. Don't touch states for now, the device should + // quickly reboot and send valid strings again. + return resetPinTrigger(resetPinTriggerArgs); + } + return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; + } + } return HasReturnvaluesIF::RETURN_OK; } @@ -54,9 +72,9 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, size_t *foundLen) { // Pass data to GPS library if(len > 0) { - sif::info << "GPSHandler::scanForReply: Received " << len << " bytes" << std::endl; + sif::debug << "GPSHandler::scanForReply: Received " << len << " bytes" << std::endl; if (internalState == InternalStates::WAIT_FIRST_MESSAGE) { - // TODO: Check whether data is valid by chcking whether NMEA start string is valid + // TODO: Check whether data is valid by checking whether NMEA start string is valid? commandExecuted = true; } int result = lwgps_process(&gpsData, start, len); @@ -110,6 +128,13 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, printf("Altitude: %f meters\n", gpsData.altitude); } #if FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV == 1 + std::string filename = "/mnt/sd0/gps_log_070921.txt"; + std::ofstream gpsFile; + if(not std::filesystem::exists(filename)) { + gpsFile.open(filename, std::ofstream::out); + } + gpsFile.open(filename, std::ofstream::out | std::ofstream::app); + gpsFile.write(reinterpret_cast(start), len); #endif } *foundLen = len; @@ -155,6 +180,12 @@ void GPSHyperionHandler::modeChanged() { internalState = InternalStates::NONE; } +void GPSHyperionHandler::setResetPinTriggerFunction(ReturnValue_t (*function)(void *args), + void *args) { + resetPinTrigger = function; + resetPinTriggerArgs = args; +} + void GPSHyperionHandler::debugInterface(uint8_t positionTracker, object_id_t objectId, uint32_t parameter) { } diff --git a/mission/devices/GPSHyperionHandler.h b/mission/devices/GPSHyperionHandler.h index ca7898ae..06c505d0 100644 --- a/mission/devices/GPSHyperionHandler.h +++ b/mission/devices/GPSHyperionHandler.h @@ -19,8 +19,12 @@ public: CookieIF* comCookie, bool debugHyperionGps = false); virtual ~GPSHyperionHandler(); + void setResetPinTriggerFunction(ReturnValue_t (*function) (void*args), void*args); protected: + ReturnValue_t (*resetPinTrigger) (void* args) = nullptr; + void* resetPinTriggerArgs = nullptr; + enum class InternalStates { NONE, WAIT_FIRST_MESSAGE, diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index d83de9fe..ba3327fa 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -75,6 +75,10 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand( } break; } + case(GOMSPACE::PRINT_OUT_ENB_STATUS): { + result = printStatus(deviceCommand); + break; + } case(GOMSPACE::REQUEST_HK_TABLE): { result = generateRequestFullHkTableCmd(hkTableReplySize); if(result != HasReturnvaluesIF::RETURN_OK){ @@ -396,3 +400,8 @@ LocalPoolDataSetBase* GomspaceDeviceHandler::getDataSetHandle(sid_t sid) { void GomspaceDeviceHandler::setModeNormal() { mode = MODE_NORMAL; } + +ReturnValue_t GomspaceDeviceHandler::printStatus(DeviceCommandId_t cmd) { + sif::info << "No printHkTable implementation given.." << std::endl; + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/mission/devices/GomspaceDeviceHandler.h b/mission/devices/GomspaceDeviceHandler.h index b73f3bb7..78257b83 100644 --- a/mission/devices/GomspaceDeviceHandler.h +++ b/mission/devices/GomspaceDeviceHandler.h @@ -88,6 +88,13 @@ protected: */ virtual ReturnValue_t generateRequestFullHkTableCmd(uint16_t hkTableSize); + /** + * This command handles printing the HK table to the console. This is useful for debugging + * purposes + * @return + */ + virtual ReturnValue_t printStatus(DeviceCommandId_t cmd); + /** * @brief Because housekeeping tables are device specific the handling of the reply is * given to the child class. diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index f6bd938a..8df972e5 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -1,11 +1,12 @@ +#include #include "PDU1Handler.h" #include #include PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie) : GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS, - PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE, &pdu1HkTableDataset), pdu1HkTableDataset( - this) { + PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE, &pdu1HkTableDataset), + pdu1HkTableDataset(this) { } PDU1Handler::~PDU1Handler() { @@ -55,25 +56,9 @@ void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac << std::endl; sif::info << "PDU1 channel 8 current: " << pdu1HkTableDataset.currentOutChannel8 << std::endl; - sif::info << "PDU1 TCS Board switch: " - << static_cast(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << std::endl; - sif::info << "PDU1 Syrlinks switch: " - << static_cast(pdu1HkTableDataset.outEnabledSyrlinks.value) << std::endl; - sif::info << "PDU1 star tracker switch: " - << static_cast(pdu1HkTableDataset.outEnabledStarTracker.value) << std::endl; - sif::info << "PDU1 MGT switch: " - << static_cast(pdu1HkTableDataset.outEnabledMGT.value) << std::endl; - sif::info << "PDU1 SUS nominal switch: " - << static_cast(pdu1HkTableDataset.outEnabledSUSNominal.value) << std::endl; - sif::info << "PDU1 solar cell experiment switch: " - << static_cast(pdu1HkTableDataset.outEnabledSolarCellExp.value) << std::endl; - sif::info << "PDU1 PLOC switch: " - << static_cast(pdu1HkTableDataset.outEnabledPLOC.value) << std::endl; - sif::info << "PDU1 ACS Side A switch: " - << static_cast(pdu1HkTableDataset.outEnabledAcsBoardSideA.value) << std::endl; - sif::info << "PDU1 channel 8 switch: " - << static_cast(pdu1HkTableDataset.outEnabledChannel8.value) << std::endl; - sif::info << "PDU1 battery mode: " << static_cast(pdu1HkTableDataset.battMode.value) << std::endl; + printOutputSwitchStates(); + sif::info << "PDU1 battery mode: " << + static_cast(pdu1HkTableDataset.battMode.value) << std::endl; sif::info << "PDU1 VCC: " << pdu1HkTableDataset.vcc << " mV" << std::endl; float vbat = pdu1HkTableDataset.vbat.value * 0.001; sif::info << "PDU1 VBAT: " << vbat << "V" << std::endl; @@ -87,9 +72,35 @@ void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac #endif } +void PDU1Handler::printOutputSwitchStates() { + sif::info << "PDU1 TCS Board switch: " << + static_cast(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << std::endl; + sif::info << "PDU1 Syrlinks switch: " << + static_cast(pdu1HkTableDataset.outEnabledSyrlinks.value) << std::endl; + sif::info << "PDU1 star tracker switch: " << + static_cast(pdu1HkTableDataset.outEnabledStarTracker.value) << std::endl; + sif::info << "PDU1 MGT switch: " << + static_cast(pdu1HkTableDataset.outEnabledMGT.value) << std::endl; + sif::info << "PDU1 SUS nominal switch: " << + static_cast(pdu1HkTableDataset.outEnabledSUSNominal.value) << std::endl; + sif::info << "PDU1 solar cell experiment switch: " << + static_cast(pdu1HkTableDataset.outEnabledSolarCellExp.value) << std::endl; + sif::info << "PDU1 PLOC switch: " << + static_cast(pdu1HkTableDataset.outEnabledPLOC.value) << std::endl; + sif::info << "PDU1 ACS Side A switch: " << + static_cast(pdu1HkTableDataset.outEnabledAcsBoardSideA.value) << std::endl; + sif::info << "PDU1 channel 8 switch: " << + static_cast(pdu1HkTableDataset.outEnabledChannel8.value) << std::endl; +} + void PDU1Handler::parseHkTableReply(const uint8_t *packet) { uint16_t dataOffset = 0; - pdu1HkTableDataset.read(); + PoolReadGuard pg(&pdu1HkTableDataset); + ReturnValue_t readResult = pg.getReadResult(); + if(readResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading PDU1 HK table failed!" << std::endl; + return; + } /* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table * address. */ dataOffset += 12; @@ -249,8 +260,10 @@ void PDU1Handler::parseHkTableReply(const uint8_t *packet) { dataOffset += 3; pdu1HkTableDataset.csp2WatchdogPingsLeft = *(packet + dataOffset); - pdu1HkTableDataset.commit(); pdu1HkTableDataset.setChanged(true); + if(not pdu1HkTableDataset.isValid()) { + pdu1HkTableDataset.setValidity(true, true); + } } ReturnValue_t PDU1Handler::initializeLocalDataPool( @@ -341,3 +354,20 @@ ReturnValue_t PDU1Handler::initializeLocalDataPool( return HasReturnvaluesIF::RETURN_OK; } +ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { + switch(cmd) { + case(GOMSPACE::PRINT_OUT_ENB_STATUS): { + PoolReadGuard pg(&pdu1HkTableDataset); + ReturnValue_t readResult = pg.getReadResult(); + if(readResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading PDU1 HK table failed!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + printOutputSwitchStates(); + return HasReturnvaluesIF::RETURN_OK; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } +} diff --git a/mission/devices/PDU1Handler.h b/mission/devices/PDU1Handler.h index ed22a6ef..fa73b584 100644 --- a/mission/devices/PDU1Handler.h +++ b/mission/devices/PDU1Handler.h @@ -32,11 +32,13 @@ protected: */ virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override; virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override; + ReturnValue_t printStatus(DeviceCommandId_t cmd) override; private: /** Dataset for the housekeeping table of the PDU1 */ PDU1::PDU1HkTableDataset pdu1HkTableDataset; + void printOutputSwitchStates(); void parseHkTableReply(const uint8_t *packet); }; diff --git a/mission/devices/devicedefinitions/GPSDefinitions.h b/mission/devices/devicedefinitions/GPSDefinitions.h index 8f147651..90fdb123 100644 --- a/mission/devices/devicedefinitions/GPSDefinitions.h +++ b/mission/devices/devicedefinitions/GPSDefinitions.h @@ -7,6 +7,7 @@ namespace GpsHyperion { static constexpr DeviceCommandId_t GPS_REPLY = 0; +static constexpr DeviceCommandId_t TRIGGER_RESET_PIN = 5; static constexpr uint32_t DATASET_ID = 0; diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index 4600ecc7..f4e50466 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -15,594 +15,596 @@ #include namespace GOMSPACE{ - static const uint16_t IGNORE_CHECKSUM = 0xbb0; - /** The size of the header of a gomspace CSP packet. */ - static const uint8_t GS_HDR_LENGTH = 12; - /** CSP port to ping gomspace devices. */ - static const uint8_t PING_PORT = 1; - static const uint8_t REBOOT_PORT = 4; - /** CSP port of gomspace devices to request or set parameters */ - static const uint8_t PARAM_PORT = 7; - static const uint8_t P60_PORT_GNDWDT_RESET = 9; +static const uint16_t IGNORE_CHECKSUM = 0xbb0; +/** The size of the header of a gomspace CSP packet. */ +static const uint8_t GS_HDR_LENGTH = 12; +/** CSP port to ping gomspace devices. */ +static const uint8_t PING_PORT = 1; +static const uint8_t REBOOT_PORT = 4; +/** CSP port of gomspace devices to request or set parameters */ +static const uint8_t PARAM_PORT = 7; +static const uint8_t P60_PORT_GNDWDT_RESET = 9; + +/* Device commands are derived from the rparam.h of the gomspace lib */ +static const DeviceCommandId_t PING = 1; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t NONE = 2; // Set when no command is pending +static const DeviceCommandId_t REBOOT = 4; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t GNDWDT_RESET = 9; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t PRINT_OUT_ENB_STATUS = 17; //!< [EXPORT] : [COMMAND] - /* Device commands are derived from the rparam.h of the gomspace lib */ - static const DeviceCommandId_t PING = 0x1; //!< [EXPORT] : [COMMAND] - static const DeviceCommandId_t NONE = 0x2; // Set when no command is pending - static const DeviceCommandId_t REBOOT = 0x4; //!< [EXPORT] : [COMMAND] - static const DeviceCommandId_t GNDWDT_RESET = 0x9; //!< [EXPORT] : [COMMAND] - static const DeviceCommandId_t PARAM_GET = 0x00; //!< [EXPORT] : [COMMAND] - static const DeviceCommandId_t PARAM_SET = 0xFF; //!< [EXPORT] : [COMMAND] - static const DeviceCommandId_t REQUEST_HK_TABLE = 0x10; //!< [EXPORT] : [COMMAND] } namespace P60System { - enum P60SytemPoolIds: lp_id_t { - P60DOCK_CURRENT_ACU_VCC, - P60DOCK_CURRENT_PDU1_VCC, - P60DOCK_CURRENT_X3_IDLE_VCC, - P60DOCK_CURRENT_PDU2_VCC, - P60DOCK_CURRENT_ACU_VBAT, - P60DOCK_CURRENT_PDU1_VBAT, - P60DOCK_CURRENT_X3_IDLE_VBAT, - P60DOCK_CURRENT_PDU2_VBAT, - P60DOCK_CURRENT_STACK_VBAT, - P60DOCK_CURRENT_STACK_3V3, - P60DOCK_CURRENT_STACK_5V, - P60DOCK_CURRENT_GS3V3, - P60DOCK_CURRENT_GS5V, - P60DOCK_VOLTAGE_ACU_VCC, - P60DOCK_VOLTAGE_PDU1_VCC, - P60DOCK_VOLTAGE_X3_IDLE_VCC, - P60DOCK_VOLTAGE_PDU2_VCC, - P60DOCK_VOLTAGE_ACU_VBAT, - P60DOCK_VOLTAGE_PDU1_VBAT, - P60DOCK_VOLTAGE_X3_IDLE_VBAT, - P60DOCK_VOLTAGE_PDU2_VBAT, - P60DOCK_VOLTAGE_STACK_VBAT, - P60DOCK_VOLTAGE_STACK_3V3, - P60DOCK_VOLTAGE_STACK_5V, - P60DOCK_VOLTAGE_GS3V3, - P60DOCK_VOLTAGE_GS5V, - P60DOCK_OUTPUTENABLE_ACU_VCC, - P60DOCK_OUTPUTENABLE_PDU1_VCC, - P60DOCK_OUTPUTENABLE_X3_IDLE_VCC, - P60DOCK_OUTPUTENABLE_PDU2_VCC, - P60DOCK_OUTPUTENABLE_ACU_VBAT, - P60DOCK_OUTPUTENABLE_PDU1_VBAT, - P60DOCK_OUTPUTENABLE_X3_IDLE_VBAT, - P60DOCK_OUTPUTENABLE_PDU2_VBAT, - P60DOCK_OUTPUTENABLE_STACK_VBAT, - P60DOCK_OUTPUTENABLE_STACK_3V3, - P60DOCK_OUTPUTENABLE_STACK_5V, - P60DOCK_OUTPUTENABLE_GS3V3, - P60DOCK_OUTPUTENABLE_GS5V, - P60DOCK_TEMPERATURE_1, - P60DOCK_TEMPERATURE_2, - P60DOCK_BOOT_CAUSE, - P60DOCK_BOOT_CNT, - P60DOCK_UPTIME, - P60DOCK_RESETCAUSE, - P60DOCK_BATT_MODE, - P60DOCK_HEATER_ON, - P60DOCK_CONV_5V_ENABLE_STATUS, - P60DOCK_LATCHUP_ACU_VCC, - P60DOCK_LATCHUP_PDU1_VCC, - P60DOCK_LATCHUP_X3_IDLE_VCC, - P60DOCK_LATCHUP_PDU2_VCC, - P60DOCK_LATCHUP_ACU_VBAT, - P60DOCK_LATCHUP_PDU1_VBAT, - P60DOCK_LATCHUP_X3_IDLE_VBAT, - P60DOCK_LATCHUP_PDU2_VBAT, - P60DOCK_LATCHUP_STACK_VBAT, - P60DOCK_LATCHUP_STACK_3V3, - P60DOCK_LATCHUP_STACK_5V, - P60DOCK_LATCHUP_GS3V3, - P60DOCK_LATCHUP_GS5V, - P60DOCK_VBAT_VALUE, - P60DOCK_VCC_CURRENT_VALUE, - P60DOCK_BATTERY_CURRENT, - P60DOCK_BATTERY_VOLTAGE, - P60DOCK_BATTERY_TEMPERATURE_1, - P60DOCK_BATTERY_TEMPERATURE_2, - P60DOCK_DEVICE_0, - P60DOCK_DEVICE_1, - P60DOCK_DEVICE_2, - P60DOCK_DEVICE_3, - P60DOCK_DEVICE_4, - P60DOCK_DEVICE_5, - P60DOCK_DEVICE_6, - P60DOCK_DEVICE_7, - P60DOCK_DEVICE_0_STATUS, - P60DOCK_DEVICE_1_STATUS, - P60DOCK_DEVICE_2_STATUS, - P60DOCK_DEVICE_3_STATUS, - P60DOCK_DEVICE_4_STATUS, - P60DOCK_DEVICE_5_STATUS, - P60DOCK_DEVICE_6_STATUS, - P60DOCK_DEVICE_7_STATUS, - P60DOCK_DEVICE_TYPE_GROUP, - P60DOCK_DEVICE_STATUS_GROUP, - P60DOCK_DEARM_STATUS, - P60DOCK_WDT_CNT_GND, - P60DOCK_WDT_CNT_I2C, - P60DOCK_WDT_CNT_CAN, - P60DOCK_WDT_CNT_CSP_1, - P60DOCK_WDT_CNT_CSP_2, - P60DOCK_WDT_GND_LEFT, - P60DOCK_WDT_I2C_LEFT, - P60DOCK_WDT_CAN_LEFT, - P60DOCK_WDT_CSP_LEFT_1, - P60DOCK_WDT_CSP_LEFT_2, - P60DOCK_BATT_CHARGE_CURRENT, - P60DOCK_BATT_DISCHARGE_CURRENT, - P60DOCK_ANT6_DEPL, - P60DOCK_AR6_DEPL, +enum P60SytemPoolIds: lp_id_t { + P60DOCK_CURRENT_ACU_VCC, + P60DOCK_CURRENT_PDU1_VCC, + P60DOCK_CURRENT_X3_IDLE_VCC, + P60DOCK_CURRENT_PDU2_VCC, + P60DOCK_CURRENT_ACU_VBAT, + P60DOCK_CURRENT_PDU1_VBAT, + P60DOCK_CURRENT_X3_IDLE_VBAT, + P60DOCK_CURRENT_PDU2_VBAT, + P60DOCK_CURRENT_STACK_VBAT, + P60DOCK_CURRENT_STACK_3V3, + P60DOCK_CURRENT_STACK_5V, + P60DOCK_CURRENT_GS3V3, + P60DOCK_CURRENT_GS5V, + P60DOCK_VOLTAGE_ACU_VCC, + P60DOCK_VOLTAGE_PDU1_VCC, + P60DOCK_VOLTAGE_X3_IDLE_VCC, + P60DOCK_VOLTAGE_PDU2_VCC, + P60DOCK_VOLTAGE_ACU_VBAT, + P60DOCK_VOLTAGE_PDU1_VBAT, + P60DOCK_VOLTAGE_X3_IDLE_VBAT, + P60DOCK_VOLTAGE_PDU2_VBAT, + P60DOCK_VOLTAGE_STACK_VBAT, + P60DOCK_VOLTAGE_STACK_3V3, + P60DOCK_VOLTAGE_STACK_5V, + P60DOCK_VOLTAGE_GS3V3, + P60DOCK_VOLTAGE_GS5V, + P60DOCK_OUTPUTENABLE_ACU_VCC, + P60DOCK_OUTPUTENABLE_PDU1_VCC, + P60DOCK_OUTPUTENABLE_X3_IDLE_VCC, + P60DOCK_OUTPUTENABLE_PDU2_VCC, + P60DOCK_OUTPUTENABLE_ACU_VBAT, + P60DOCK_OUTPUTENABLE_PDU1_VBAT, + P60DOCK_OUTPUTENABLE_X3_IDLE_VBAT, + P60DOCK_OUTPUTENABLE_PDU2_VBAT, + P60DOCK_OUTPUTENABLE_STACK_VBAT, + P60DOCK_OUTPUTENABLE_STACK_3V3, + P60DOCK_OUTPUTENABLE_STACK_5V, + P60DOCK_OUTPUTENABLE_GS3V3, + P60DOCK_OUTPUTENABLE_GS5V, + P60DOCK_TEMPERATURE_1, + P60DOCK_TEMPERATURE_2, + P60DOCK_BOOT_CAUSE, + P60DOCK_BOOT_CNT, + P60DOCK_UPTIME, + P60DOCK_RESETCAUSE, + P60DOCK_BATT_MODE, + P60DOCK_HEATER_ON, + P60DOCK_CONV_5V_ENABLE_STATUS, + P60DOCK_LATCHUP_ACU_VCC, + P60DOCK_LATCHUP_PDU1_VCC, + P60DOCK_LATCHUP_X3_IDLE_VCC, + P60DOCK_LATCHUP_PDU2_VCC, + P60DOCK_LATCHUP_ACU_VBAT, + P60DOCK_LATCHUP_PDU1_VBAT, + P60DOCK_LATCHUP_X3_IDLE_VBAT, + P60DOCK_LATCHUP_PDU2_VBAT, + P60DOCK_LATCHUP_STACK_VBAT, + P60DOCK_LATCHUP_STACK_3V3, + P60DOCK_LATCHUP_STACK_5V, + P60DOCK_LATCHUP_GS3V3, + P60DOCK_LATCHUP_GS5V, + P60DOCK_VBAT_VALUE, + P60DOCK_VCC_CURRENT_VALUE, + P60DOCK_BATTERY_CURRENT, + P60DOCK_BATTERY_VOLTAGE, + P60DOCK_BATTERY_TEMPERATURE_1, + P60DOCK_BATTERY_TEMPERATURE_2, + P60DOCK_DEVICE_0, + P60DOCK_DEVICE_1, + P60DOCK_DEVICE_2, + P60DOCK_DEVICE_3, + P60DOCK_DEVICE_4, + P60DOCK_DEVICE_5, + P60DOCK_DEVICE_6, + P60DOCK_DEVICE_7, + P60DOCK_DEVICE_0_STATUS, + P60DOCK_DEVICE_1_STATUS, + P60DOCK_DEVICE_2_STATUS, + P60DOCK_DEVICE_3_STATUS, + P60DOCK_DEVICE_4_STATUS, + P60DOCK_DEVICE_5_STATUS, + P60DOCK_DEVICE_6_STATUS, + P60DOCK_DEVICE_7_STATUS, + P60DOCK_DEVICE_TYPE_GROUP, + P60DOCK_DEVICE_STATUS_GROUP, + P60DOCK_DEARM_STATUS, + P60DOCK_WDT_CNT_GND, + P60DOCK_WDT_CNT_I2C, + P60DOCK_WDT_CNT_CAN, + P60DOCK_WDT_CNT_CSP_1, + P60DOCK_WDT_CNT_CSP_2, + P60DOCK_WDT_GND_LEFT, + P60DOCK_WDT_I2C_LEFT, + P60DOCK_WDT_CAN_LEFT, + P60DOCK_WDT_CSP_LEFT_1, + P60DOCK_WDT_CSP_LEFT_2, + P60DOCK_BATT_CHARGE_CURRENT, + P60DOCK_BATT_DISCHARGE_CURRENT, + P60DOCK_ANT6_DEPL, + P60DOCK_AR6_DEPL, - PDU1_CURRENT_OUT_TCS_BOARD_3V3, - PDU1_CURRENT_OUT_SYRLINKS, - PDU1_CURRENT_OUT_STAR_TRACKER, - PDU1_CURRENT_OUT_MGT, - PDU1_CURRENT_OUT_SUS_NOMINAL, - PDU1_CURRENT_OUT_SOLAR_CELL_EXP, - PDU1_CURRENT_OUT_PLOC, - PDU1_CURRENT_OUT_ACS_BOARD_SIDE_A, - PDU1_CURRENT_OUT_CHANNEL8, - PDU1_VOLTAGE_OUT_TCS_BOARD_3V3, - PDU1_VOLTAGE_OUT_SYRLINKS, - PDU1_VOLTAGE_OUT_STAR_TRACKER, - PDU1_VOLTAGE_OUT_MGT, - PDU1_VOLTAGE_OUT_SUS_NOMINAL, - PDU1_VOLTAGE_OUT_SOLAR_CELL_EXP, - PDU1_VOLTAGE_OUT_PLOC, - PDU1_VOLTAGE_OUT_ACS_BOARD_SIDE_A, - PDU1_VOLTAGE_OUT_CHANNEL8, - PDU1_VCC, - PDU1_VBAT, - PDU1_TEMPERATURE, - PDU1_CONV_EN_1, - PDU1_CONV_EN_2, - PDU1_CONV_EN_3, - PDU1_OUT_EN_TCS_BOARD_3V3, - PDU1_OUT_EN_SYRLINKS, - PDU1_OUT_EN_STAR_TRACKER, - PDU1_OUT_EN_MGT, - PDU1_OUT_EN_SUS_NOMINAL, - PDU1_OUT_EN_SOLAR_CELL_EXP, - PDU1_OUT_EN_PLOC, - PDU1_OUT_EN_ACS_BOARD_SIDE_A, - PDU1_OUT_EN_CHANNEL8, - PDU1_BOOTCAUSE, - PDU1_BOOTCNT, - PDU1_UPTIME, - PDU1_RESETCAUSE, - PDU1_BATT_MODE, - PDU1_LATCHUP_TCS_BOARD_3V3, - PDU1_LATCHUP_SYRLINKS, - PDU1_LATCHUP_STAR_TRACKER, - PDU1_LATCHUP_MGT, - PDU1_LATCHUP_SUS_NOMINAL, - PDU1_LATCHUP_SOLAR_CELL_EXP, - PDU1_LATCHUP_PLOC, - PDU1_LATCHUP_ACS_BOARD_SIDE_A, - PDU1_LATCHUP_CHANNEL8, - PDU1_DEVICE_0, - PDU1_DEVICE_1, - PDU1_DEVICE_2, - PDU1_DEVICE_3, - PDU1_DEVICE_4, - PDU1_DEVICE_5, - PDU1_DEVICE_6, - PDU1_DEVICE_7, - PDU1_DEVICE_0_STATUS, - PDU1_DEVICE_1_STATUS, - PDU1_DEVICE_2_STATUS, - PDU1_DEVICE_3_STATUS, - PDU1_DEVICE_4_STATUS, - PDU1_DEVICE_5_STATUS, - PDU1_DEVICE_6_STATUS, - PDU1_DEVICE_7_STATUS, - PDU1_WDT_CNT_GND, - PDU1_WDT_CNT_I2C, - PDU1_WDT_CNT_CAN, - PDU1_WDT_CNT_CSP1, - PDU1_WDT_CNT_CSP2, - PDU1_WDT_GND_LEFT, - PDU1_WDT_I2C_LEFT, - PDU1_WDT_CAN_LEFT, - PDU1_WDT_CSP_LEFT1, - PDU1_WDT_CSP_LEFT2, + PDU1_CURRENT_OUT_TCS_BOARD_3V3, + PDU1_CURRENT_OUT_SYRLINKS, + PDU1_CURRENT_OUT_STAR_TRACKER, + PDU1_CURRENT_OUT_MGT, + PDU1_CURRENT_OUT_SUS_NOMINAL, + PDU1_CURRENT_OUT_SOLAR_CELL_EXP, + PDU1_CURRENT_OUT_PLOC, + PDU1_CURRENT_OUT_ACS_BOARD_SIDE_A, + PDU1_CURRENT_OUT_CHANNEL8, + PDU1_VOLTAGE_OUT_TCS_BOARD_3V3, + PDU1_VOLTAGE_OUT_SYRLINKS, + PDU1_VOLTAGE_OUT_STAR_TRACKER, + PDU1_VOLTAGE_OUT_MGT, + PDU1_VOLTAGE_OUT_SUS_NOMINAL, + PDU1_VOLTAGE_OUT_SOLAR_CELL_EXP, + PDU1_VOLTAGE_OUT_PLOC, + PDU1_VOLTAGE_OUT_ACS_BOARD_SIDE_A, + PDU1_VOLTAGE_OUT_CHANNEL8, + PDU1_VCC, + PDU1_VBAT, + PDU1_TEMPERATURE, + PDU1_CONV_EN_1, + PDU1_CONV_EN_2, + PDU1_CONV_EN_3, + PDU1_OUT_EN_TCS_BOARD_3V3, + PDU1_OUT_EN_SYRLINKS, + PDU1_OUT_EN_STAR_TRACKER, + PDU1_OUT_EN_MGT, + PDU1_OUT_EN_SUS_NOMINAL, + PDU1_OUT_EN_SOLAR_CELL_EXP, + PDU1_OUT_EN_PLOC, + PDU1_OUT_EN_ACS_BOARD_SIDE_A, + PDU1_OUT_EN_CHANNEL8, + PDU1_BOOTCAUSE, + PDU1_BOOTCNT, + PDU1_UPTIME, + PDU1_RESETCAUSE, + PDU1_BATT_MODE, + PDU1_LATCHUP_TCS_BOARD_3V3, + PDU1_LATCHUP_SYRLINKS, + PDU1_LATCHUP_STAR_TRACKER, + PDU1_LATCHUP_MGT, + PDU1_LATCHUP_SUS_NOMINAL, + PDU1_LATCHUP_SOLAR_CELL_EXP, + PDU1_LATCHUP_PLOC, + PDU1_LATCHUP_ACS_BOARD_SIDE_A, + PDU1_LATCHUP_CHANNEL8, + PDU1_DEVICE_0, + PDU1_DEVICE_1, + PDU1_DEVICE_2, + PDU1_DEVICE_3, + PDU1_DEVICE_4, + PDU1_DEVICE_5, + PDU1_DEVICE_6, + PDU1_DEVICE_7, + PDU1_DEVICE_0_STATUS, + PDU1_DEVICE_1_STATUS, + PDU1_DEVICE_2_STATUS, + PDU1_DEVICE_3_STATUS, + PDU1_DEVICE_4_STATUS, + PDU1_DEVICE_5_STATUS, + PDU1_DEVICE_6_STATUS, + PDU1_DEVICE_7_STATUS, + PDU1_WDT_CNT_GND, + PDU1_WDT_CNT_I2C, + PDU1_WDT_CNT_CAN, + PDU1_WDT_CNT_CSP1, + PDU1_WDT_CNT_CSP2, + PDU1_WDT_GND_LEFT, + PDU1_WDT_I2C_LEFT, + PDU1_WDT_CAN_LEFT, + PDU1_WDT_CSP_LEFT1, + PDU1_WDT_CSP_LEFT2, - /** PDU2 Ids */ - PDU2_CURRENT_OUT_Q7S, - PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH1, - PDU2_CURRENT_OUT_RW, - PDU2_CURRENT_OUT_TCS_BOARD_HEATER_IN, - PDU2_CURRENT_OUT_SUS_REDUNDANT, - PDU2_CURRENT_OUT_DEPLOYMENT_MECHANISM, - PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH6, - PDU2_CURRENT_OUT_ACS_BOARD_SIDE_B, - PDU2_CURRENT_OUT_PAYLOAD_CAMERA, - PDU2_VOLTAGE_OUT_Q7S, - PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH1, - PDU2_VOLTAGE_OUT_RW, - PDU2_VOLTAGE_OUT_TCS_BOARD_HEATER_IN, - PDU2_VOLTAGE_OUT_SUS_REDUNDANT, - PDU2_VOLTAGE_OUT_DEPLOYMENT_MECHANISM, - PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH6, - PDU2_VOLTAGE_OUT_ACS_BOARD_SIDE_B, - PDU2_VOLTAGE_OUT_PAYLOAD_CAMERA, - PDU2_VCC, - PDU2_VBAT, - PDU2_TEMPERATURE, - PDU2_CONV_EN_1, - PDU2_CONV_EN_2, - PDU2_CONV_EN_3, - PDU2_OUT_EN_Q7S, - PDU2_OUT_EN_PAYLOAD_PCDU_CH1, - PDU2_OUT_EN_RW, - PDU2_OUT_EN_TCS_BOARD_HEATER_IN, - PDU2_OUT_EN_SUS_REDUNDANT, - PDU2_OUT_EN_DEPLOYMENT_MECHANISM, - PDU2_OUT_EN_PAYLOAD_PCDU_CH6, - PDU2_OUT_EN_ACS_BOARD_SIDE_B, - PDU2_OUT_EN_PAYLOAD_CAMERA, - PDU2_BOOTCAUSE, - PDU2_BOOTCNT, - PDU2_UPTIME, - PDU2_RESETCAUSE, - PDU2_BATT_MODE, - PDU2_LATCHUP_Q7S, - PDU2_LATCHUP_PAYLOAD_PCDU_CH1, - PDU2_LATCHUP_RW, - PDU2_LATCHUP_TCS_BOARD_HEATER_IN, - PDU2_LATCHUP_SUS_REDUNDANT, - PDU2_LATCHUP_DEPLOYMENT_MECHANISM, - PDU2_LATCHUP_PAYLOAD_PCDU_CH6, - PDU2_LATCHUP_ACS_BOARD_SIDE_B, - PDU2_LATCHUP_PAYLOAD_CAMERA, - PDU2_DEVICE_0, - PDU2_DEVICE_1, - PDU2_DEVICE_2, - PDU2_DEVICE_3, - PDU2_DEVICE_4, - PDU2_DEVICE_5, - PDU2_DEVICE_6, - PDU2_DEVICE_7, - PDU2_DEVICE_0_STATUS, - PDU2_DEVICE_1_STATUS, - PDU2_DEVICE_2_STATUS, - PDU2_DEVICE_3_STATUS, - PDU2_DEVICE_4_STATUS, - PDU2_DEVICE_5_STATUS, - PDU2_DEVICE_6_STATUS, - PDU2_DEVICE_7_STATUS, - PDU2_WDT_CNT_GND, - PDU2_WDT_CNT_I2C, - PDU2_WDT_CNT_CAN, - PDU2_WDT_CNT_CSP1, - PDU2_WDT_CNT_CSP2, - PDU2_WDT_GND_LEFT, - PDU2_WDT_I2C_LEFT, - PDU2_WDT_CAN_LEFT, - PDU2_WDT_CSP_LEFT1, - PDU2_WDT_CSP_LEFT2, + /** PDU2 Ids */ + PDU2_CURRENT_OUT_Q7S, + PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH1, + PDU2_CURRENT_OUT_RW, + PDU2_CURRENT_OUT_TCS_BOARD_HEATER_IN, + PDU2_CURRENT_OUT_SUS_REDUNDANT, + PDU2_CURRENT_OUT_DEPLOYMENT_MECHANISM, + PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH6, + PDU2_CURRENT_OUT_ACS_BOARD_SIDE_B, + PDU2_CURRENT_OUT_PAYLOAD_CAMERA, + PDU2_VOLTAGE_OUT_Q7S, + PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH1, + PDU2_VOLTAGE_OUT_RW, + PDU2_VOLTAGE_OUT_TCS_BOARD_HEATER_IN, + PDU2_VOLTAGE_OUT_SUS_REDUNDANT, + PDU2_VOLTAGE_OUT_DEPLOYMENT_MECHANISM, + PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH6, + PDU2_VOLTAGE_OUT_ACS_BOARD_SIDE_B, + PDU2_VOLTAGE_OUT_PAYLOAD_CAMERA, + PDU2_VCC, + PDU2_VBAT, + PDU2_TEMPERATURE, + PDU2_CONV_EN_1, + PDU2_CONV_EN_2, + PDU2_CONV_EN_3, + PDU2_OUT_EN_Q7S, + PDU2_OUT_EN_PAYLOAD_PCDU_CH1, + PDU2_OUT_EN_RW, + PDU2_OUT_EN_TCS_BOARD_HEATER_IN, + PDU2_OUT_EN_SUS_REDUNDANT, + PDU2_OUT_EN_DEPLOYMENT_MECHANISM, + PDU2_OUT_EN_PAYLOAD_PCDU_CH6, + PDU2_OUT_EN_ACS_BOARD_SIDE_B, + PDU2_OUT_EN_PAYLOAD_CAMERA, + PDU2_BOOTCAUSE, + PDU2_BOOTCNT, + PDU2_UPTIME, + PDU2_RESETCAUSE, + PDU2_BATT_MODE, + PDU2_LATCHUP_Q7S, + PDU2_LATCHUP_PAYLOAD_PCDU_CH1, + PDU2_LATCHUP_RW, + PDU2_LATCHUP_TCS_BOARD_HEATER_IN, + PDU2_LATCHUP_SUS_REDUNDANT, + PDU2_LATCHUP_DEPLOYMENT_MECHANISM, + PDU2_LATCHUP_PAYLOAD_PCDU_CH6, + PDU2_LATCHUP_ACS_BOARD_SIDE_B, + PDU2_LATCHUP_PAYLOAD_CAMERA, + PDU2_DEVICE_0, + PDU2_DEVICE_1, + PDU2_DEVICE_2, + PDU2_DEVICE_3, + PDU2_DEVICE_4, + PDU2_DEVICE_5, + PDU2_DEVICE_6, + PDU2_DEVICE_7, + PDU2_DEVICE_0_STATUS, + PDU2_DEVICE_1_STATUS, + PDU2_DEVICE_2_STATUS, + PDU2_DEVICE_3_STATUS, + PDU2_DEVICE_4_STATUS, + PDU2_DEVICE_5_STATUS, + PDU2_DEVICE_6_STATUS, + PDU2_DEVICE_7_STATUS, + PDU2_WDT_CNT_GND, + PDU2_WDT_CNT_I2C, + PDU2_WDT_CNT_CAN, + PDU2_WDT_CNT_CSP1, + PDU2_WDT_CNT_CSP2, + PDU2_WDT_GND_LEFT, + PDU2_WDT_I2C_LEFT, + PDU2_WDT_CAN_LEFT, + PDU2_WDT_CSP_LEFT1, + PDU2_WDT_CSP_LEFT2, - /** ACU Ids */ - ACU_CURRENT_IN_CHANNEL0, - ACU_CURRENT_IN_CHANNEL1, - ACU_CURRENT_IN_CHANNEL2, - ACU_CURRENT_IN_CHANNEL3, - ACU_CURRENT_IN_CHANNEL4, - ACU_CURRENT_IN_CHANNEL5, - ACU_VOLTAGE_IN_CHANNEL0, - ACU_VOLTAGE_IN_CHANNEL1, - ACU_VOLTAGE_IN_CHANNEL2, - ACU_VOLTAGE_IN_CHANNEL3, - ACU_VOLTAGE_IN_CHANNEL4, - ACU_VOLTAGE_IN_CHANNEL5, - ACU_VCC, - ACU_VBAT, - ACU_TEMPERATURE_1, - ACU_TEMPERATURE_2, - ACU_TEMPERATURE_3, - ACU_MPPT_MODE, - ACU_VBOOST_CHANNEL0, - ACU_VBOOST_CHANNEL1, - ACU_VBOOST_CHANNEL2, - ACU_VBOOST_CHANNEL3, - ACU_VBOOST_CHANNEL4, - ACU_VBOOST_CHANNEL5, - ACU_POWER_CHANNEL0, - ACU_POWER_CHANNEL1, - ACU_POWER_CHANNEL2, - ACU_POWER_CHANNEL3, - ACU_POWER_CHANNEL4, - ACU_POWER_CHANNEL5, - ACU_DAC_EN_0, - ACU_DAC_EN_1, - ACU_DAC_EN_2, - ACU_DAC_RAW_0, - ACU_DAC_RAW_1, - ACU_DAC_RAW_2, - ACU_DAC_RAW_3, - ACU_DAC_RAW_4, - ACU_DAC_RAW_5, - ACU_BOOTCAUSE, - ACU_BOOTCNT, - ACU_UPTIME, - ACU_RESET_CAUSE, - ACU_MPPT_TIME, - ACU_MPPT_PERIOD, - ACU_DEVICE_0, - ACU_DEVICE_1, - ACU_DEVICE_2, - ACU_DEVICE_3, - ACU_DEVICE_4, - ACU_DEVICE_5, - ACU_DEVICE_6, - ACU_DEVICE_7, - ACU_DEVICE_0_STATUS, - ACU_DEVICE_1_STATUS, - ACU_DEVICE_2_STATUS, - ACU_DEVICE_3_STATUS, - ACU_DEVICE_4_STATUS, - ACU_DEVICE_5_STATUS, - ACU_DEVICE_6_STATUS, - ACU_DEVICE_7_STATUS, - ACU_WDT_CNT_GND, - ACU_WDT_GND_LEFT - }; + /** ACU Ids */ + ACU_CURRENT_IN_CHANNEL0, + ACU_CURRENT_IN_CHANNEL1, + ACU_CURRENT_IN_CHANNEL2, + ACU_CURRENT_IN_CHANNEL3, + ACU_CURRENT_IN_CHANNEL4, + ACU_CURRENT_IN_CHANNEL5, + ACU_VOLTAGE_IN_CHANNEL0, + ACU_VOLTAGE_IN_CHANNEL1, + ACU_VOLTAGE_IN_CHANNEL2, + ACU_VOLTAGE_IN_CHANNEL3, + ACU_VOLTAGE_IN_CHANNEL4, + ACU_VOLTAGE_IN_CHANNEL5, + ACU_VCC, + ACU_VBAT, + ACU_TEMPERATURE_1, + ACU_TEMPERATURE_2, + ACU_TEMPERATURE_3, + ACU_MPPT_MODE, + ACU_VBOOST_CHANNEL0, + ACU_VBOOST_CHANNEL1, + ACU_VBOOST_CHANNEL2, + ACU_VBOOST_CHANNEL3, + ACU_VBOOST_CHANNEL4, + ACU_VBOOST_CHANNEL5, + ACU_POWER_CHANNEL0, + ACU_POWER_CHANNEL1, + ACU_POWER_CHANNEL2, + ACU_POWER_CHANNEL3, + ACU_POWER_CHANNEL4, + ACU_POWER_CHANNEL5, + ACU_DAC_EN_0, + ACU_DAC_EN_1, + ACU_DAC_EN_2, + ACU_DAC_RAW_0, + ACU_DAC_RAW_1, + ACU_DAC_RAW_2, + ACU_DAC_RAW_3, + ACU_DAC_RAW_4, + ACU_DAC_RAW_5, + ACU_BOOTCAUSE, + ACU_BOOTCNT, + ACU_UPTIME, + ACU_RESET_CAUSE, + ACU_MPPT_TIME, + ACU_MPPT_PERIOD, + ACU_DEVICE_0, + ACU_DEVICE_1, + ACU_DEVICE_2, + ACU_DEVICE_3, + ACU_DEVICE_4, + ACU_DEVICE_5, + ACU_DEVICE_6, + ACU_DEVICE_7, + ACU_DEVICE_0_STATUS, + ACU_DEVICE_1_STATUS, + ACU_DEVICE_2_STATUS, + ACU_DEVICE_3_STATUS, + ACU_DEVICE_4_STATUS, + ACU_DEVICE_5_STATUS, + ACU_DEVICE_6_STATUS, + ACU_DEVICE_7_STATUS, + ACU_WDT_CNT_GND, + ACU_WDT_GND_LEFT +}; } namespace P60Dock { - /** Max reply size reached when requesting full hk table */ - static const uint16_t MAX_REPLY_LENGTH = 407; +/** Max reply size reached when requesting full hk table */ +static const uint16_t MAX_REPLY_LENGTH = 407; - static const uint16_t MAX_CONFIGTABLE_ADDRESS = 408; - static const uint16_t MAX_HKTABLE_ADDRESS = 187; - static const uint16_t HK_TABLE_SIZE = 188; +static const uint16_t MAX_CONFIGTABLE_ADDRESS = 408; +static const uint16_t MAX_HKTABLE_ADDRESS = 187; +static const uint16_t HK_TABLE_SIZE = 188; - static const uint8_t HK_TABLE_DATA_SET_ID = 0x3; - static const uint8_t HK_TABLE_ENTRIES = 100; +static const uint8_t HK_TABLE_DATA_SET_ID = 0x3; +static const uint8_t HK_TABLE_ENTRIES = 100; - /** - * Requesting the full housekeeping table from the P60 dock will generate a reply comprising - * 402 bytes of data. - */ - static const uint16_t HK_TABLE_REPLY_SIZE = 407; +/** + * Requesting the full housekeeping table from the P60 dock will generate a reply comprising + * 402 bytes of data. + */ +static const uint16_t HK_TABLE_REPLY_SIZE = 407; - /** - * @brief This class defines a dataset for the hk table of the P60 Dock. - */ - class HkTableDataset: - public StaticLocalDataSet { - public: +/** + * @brief This class defines a dataset for the hk table of the P60 Dock. + */ +class HkTableDataset: + public StaticLocalDataSet { + public: - HkTableDataset(HasLocalDataPoolIF* owner): - StaticLocalDataSet(owner, HK_TABLE_DATA_SET_ID) { - } + HkTableDataset(HasLocalDataPoolIF* owner): + StaticLocalDataSet(owner, HK_TABLE_DATA_SET_ID) { + } - HkTableDataset(object_id_t objectId): - StaticLocalDataSet(sid_t(objectId, HK_TABLE_DATA_SET_ID)) { - } + HkTableDataset(object_id_t objectId): + StaticLocalDataSet(sid_t(objectId, HK_TABLE_DATA_SET_ID)) { + } - /** Measured output currents */ - lp_var_t currentAcuVcc = lp_var_t(sid.objectId, - P60System::P60DOCK_CURRENT_ACU_VCC, this); - lp_var_t currentPdu1Vcc = lp_var_t(sid.objectId, - P60System::P60DOCK_CURRENT_PDU1_VCC, this); - lp_var_t currentX3IdleVcc = lp_var_t(sid.objectId, - P60System::P60DOCK_CURRENT_X3_IDLE_VCC, this); - lp_var_t currentPdu2Vcc = lp_var_t(sid.objectId, - P60System::P60DOCK_CURRENT_PDU2_VCC, this); - lp_var_t currentAcuVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_CURRENT_ACU_VBAT, this); - lp_var_t currentPdu1Vbat = lp_var_t(sid.objectId, - P60System::P60DOCK_CURRENT_PDU1_VBAT, this); - lp_var_t currentX3IdleVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_CURRENT_X3_IDLE_VBAT, this); - lp_var_t currentPdu2Vbat = lp_var_t(sid.objectId, - P60System::P60DOCK_CURRENT_PDU2_VBAT, this); - lp_var_t currentStackVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_CURRENT_STACK_VBAT, this); - lp_var_t currentStack3V3 = lp_var_t(sid.objectId, - P60System::P60DOCK_CURRENT_STACK_3V3, this); - lp_var_t currentStack5V = lp_var_t(sid.objectId, - P60System::P60DOCK_CURRENT_STACK_5V, this); - lp_var_t currentGS3V3 = lp_var_t(sid.objectId, - P60System::P60DOCK_CURRENT_GS3V3, this); - lp_var_t currentGS5V = lp_var_t(sid.objectId, - P60System::P60DOCK_CURRENT_GS5V, this); + /** Measured output currents */ + lp_var_t currentAcuVcc = lp_var_t(sid.objectId, + P60System::P60DOCK_CURRENT_ACU_VCC, this); + lp_var_t currentPdu1Vcc = lp_var_t(sid.objectId, + P60System::P60DOCK_CURRENT_PDU1_VCC, this); + lp_var_t currentX3IdleVcc = lp_var_t(sid.objectId, + P60System::P60DOCK_CURRENT_X3_IDLE_VCC, this); + lp_var_t currentPdu2Vcc = lp_var_t(sid.objectId, + P60System::P60DOCK_CURRENT_PDU2_VCC, this); + lp_var_t currentAcuVbat = lp_var_t(sid.objectId, + P60System::P60DOCK_CURRENT_ACU_VBAT, this); + lp_var_t currentPdu1Vbat = lp_var_t(sid.objectId, + P60System::P60DOCK_CURRENT_PDU1_VBAT, this); + lp_var_t currentX3IdleVbat = lp_var_t(sid.objectId, + P60System::P60DOCK_CURRENT_X3_IDLE_VBAT, this); + lp_var_t currentPdu2Vbat = lp_var_t(sid.objectId, + P60System::P60DOCK_CURRENT_PDU2_VBAT, this); + lp_var_t currentStackVbat = lp_var_t(sid.objectId, + P60System::P60DOCK_CURRENT_STACK_VBAT, this); + lp_var_t currentStack3V3 = lp_var_t(sid.objectId, + P60System::P60DOCK_CURRENT_STACK_3V3, this); + lp_var_t currentStack5V = lp_var_t(sid.objectId, + P60System::P60DOCK_CURRENT_STACK_5V, this); + lp_var_t currentGS3V3 = lp_var_t(sid.objectId, + P60System::P60DOCK_CURRENT_GS3V3, this); + lp_var_t currentGS5V = lp_var_t(sid.objectId, + P60System::P60DOCK_CURRENT_GS5V, this); - /** Measured output voltages */ - lp_var_t voltageAcuVcc = lp_var_t(sid.objectId, - P60System::P60DOCK_VOLTAGE_ACU_VCC, this); - lp_var_t voltagePdu1Vcc = lp_var_t(sid.objectId, - P60System::P60DOCK_VOLTAGE_PDU1_VCC, this); - lp_var_t voltageX3IdleVcc = lp_var_t(sid.objectId, - P60System::P60DOCK_VOLTAGE_X3_IDLE_VCC, this); - lp_var_t voltagePdu2Vcc = lp_var_t(sid.objectId, - P60System::P60DOCK_VOLTAGE_PDU2_VCC, this); - lp_var_t voltageAcuVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_VOLTAGE_ACU_VBAT, this); - lp_var_t voltagePdu1Vbat = lp_var_t(sid.objectId, - P60System::P60DOCK_VOLTAGE_PDU1_VBAT, this); - lp_var_t voltageX3IdleVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_VOLTAGE_X3_IDLE_VBAT, this); - lp_var_t voltagePdu2Vbat = lp_var_t(sid.objectId, - P60System::P60DOCK_VOLTAGE_PDU2_VBAT, this); - lp_var_t voltageStackVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_VOLTAGE_STACK_VBAT, this); - lp_var_t voltageStack3V3 = lp_var_t(sid.objectId, - P60System::P60DOCK_VOLTAGE_STACK_3V3, this); - lp_var_t voltageStack5V = lp_var_t(sid.objectId, - P60System::P60DOCK_VOLTAGE_STACK_5V, this); - lp_var_t voltageGS3V3 = lp_var_t(sid.objectId, - P60System::P60DOCK_VOLTAGE_GS3V3, this); - lp_var_t voltageGS5V = lp_var_t(sid.objectId, - P60System::P60DOCK_VOLTAGE_GS5V, this); + /** Measured output voltages */ + lp_var_t voltageAcuVcc = lp_var_t(sid.objectId, + P60System::P60DOCK_VOLTAGE_ACU_VCC, this); + lp_var_t voltagePdu1Vcc = lp_var_t(sid.objectId, + P60System::P60DOCK_VOLTAGE_PDU1_VCC, this); + lp_var_t voltageX3IdleVcc = lp_var_t(sid.objectId, + P60System::P60DOCK_VOLTAGE_X3_IDLE_VCC, this); + lp_var_t voltagePdu2Vcc = lp_var_t(sid.objectId, + P60System::P60DOCK_VOLTAGE_PDU2_VCC, this); + lp_var_t voltageAcuVbat = lp_var_t(sid.objectId, + P60System::P60DOCK_VOLTAGE_ACU_VBAT, this); + lp_var_t voltagePdu1Vbat = lp_var_t(sid.objectId, + P60System::P60DOCK_VOLTAGE_PDU1_VBAT, this); + lp_var_t voltageX3IdleVbat = lp_var_t(sid.objectId, + P60System::P60DOCK_VOLTAGE_X3_IDLE_VBAT, this); + lp_var_t voltagePdu2Vbat = lp_var_t(sid.objectId, + P60System::P60DOCK_VOLTAGE_PDU2_VBAT, this); + lp_var_t voltageStackVbat = lp_var_t(sid.objectId, + P60System::P60DOCK_VOLTAGE_STACK_VBAT, this); + lp_var_t voltageStack3V3 = lp_var_t(sid.objectId, + P60System::P60DOCK_VOLTAGE_STACK_3V3, this); + lp_var_t voltageStack5V = lp_var_t(sid.objectId, + P60System::P60DOCK_VOLTAGE_STACK_5V, this); + lp_var_t voltageGS3V3 = lp_var_t(sid.objectId, + P60System::P60DOCK_VOLTAGE_GS3V3, this); + lp_var_t voltageGS5V = lp_var_t(sid.objectId, + P60System::P60DOCK_VOLTAGE_GS5V, this); - /** Output enable states */ - lp_var_t outputEnableStateAcuVcc = lp_var_t(sid.objectId, - P60System::P60DOCK_OUTPUTENABLE_ACU_VCC, this); - lp_var_t outputEnableStatePdu1Vcc = lp_var_t(sid.objectId, - P60System::P60DOCK_OUTPUTENABLE_PDU1_VCC, this); - lp_var_t outputEnableStateX3IdleVcc = lp_var_t(sid.objectId, - P60System::P60DOCK_OUTPUTENABLE_X3_IDLE_VCC, this); - lp_var_t outputEnableStatePdu2Vcc = lp_var_t(sid.objectId, - P60System::P60DOCK_OUTPUTENABLE_PDU2_VCC, this); - lp_var_t outputEnableStateAcuVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_OUTPUTENABLE_ACU_VBAT, this); - lp_var_t outputEnableStatePdu1Vbat = lp_var_t(sid.objectId, - P60System::P60DOCK_OUTPUTENABLE_PDU1_VBAT, this); - lp_var_t outputEnableStateX3IdleVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_OUTPUTENABLE_X3_IDLE_VBAT, this); - lp_var_t outputEnableStatePdu2Vbat = lp_var_t(sid.objectId, - P60System::P60DOCK_OUTPUTENABLE_PDU2_VBAT, this); - lp_var_t outputEnableStateStackVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_OUTPUTENABLE_STACK_VBAT, this); - lp_var_t outputEnableStateStack3V3 = lp_var_t(sid.objectId, - P60System::P60DOCK_OUTPUTENABLE_STACK_3V3, this); - lp_var_t outputEnableStateStack5V = lp_var_t(sid.objectId, - P60System::P60DOCK_OUTPUTENABLE_STACK_5V, this); - lp_var_t outputEnableStateGS3V3 = lp_var_t(sid.objectId, - P60System::P60DOCK_OUTPUTENABLE_GS3V3, this); - lp_var_t outputEnableStateGS5V = lp_var_t(sid.objectId, - P60System::P60DOCK_OUTPUTENABLE_GS5V, this); + /** Output enable states */ + lp_var_t outputEnableStateAcuVcc = lp_var_t(sid.objectId, + P60System::P60DOCK_OUTPUTENABLE_ACU_VCC, this); + lp_var_t outputEnableStatePdu1Vcc = lp_var_t(sid.objectId, + P60System::P60DOCK_OUTPUTENABLE_PDU1_VCC, this); + lp_var_t outputEnableStateX3IdleVcc = lp_var_t(sid.objectId, + P60System::P60DOCK_OUTPUTENABLE_X3_IDLE_VCC, this); + lp_var_t outputEnableStatePdu2Vcc = lp_var_t(sid.objectId, + P60System::P60DOCK_OUTPUTENABLE_PDU2_VCC, this); + lp_var_t outputEnableStateAcuVbat = lp_var_t(sid.objectId, + P60System::P60DOCK_OUTPUTENABLE_ACU_VBAT, this); + lp_var_t outputEnableStatePdu1Vbat = lp_var_t(sid.objectId, + P60System::P60DOCK_OUTPUTENABLE_PDU1_VBAT, this); + lp_var_t outputEnableStateX3IdleVbat = lp_var_t(sid.objectId, + P60System::P60DOCK_OUTPUTENABLE_X3_IDLE_VBAT, this); + lp_var_t outputEnableStatePdu2Vbat = lp_var_t(sid.objectId, + P60System::P60DOCK_OUTPUTENABLE_PDU2_VBAT, this); + lp_var_t outputEnableStateStackVbat = lp_var_t(sid.objectId, + P60System::P60DOCK_OUTPUTENABLE_STACK_VBAT, this); + lp_var_t outputEnableStateStack3V3 = lp_var_t(sid.objectId, + P60System::P60DOCK_OUTPUTENABLE_STACK_3V3, this); + lp_var_t outputEnableStateStack5V = lp_var_t(sid.objectId, + P60System::P60DOCK_OUTPUTENABLE_STACK_5V, this); + lp_var_t outputEnableStateGS3V3 = lp_var_t(sid.objectId, + P60System::P60DOCK_OUTPUTENABLE_GS3V3, this); + lp_var_t outputEnableStateGS5V = lp_var_t(sid.objectId, + P60System::P60DOCK_OUTPUTENABLE_GS5V, this); - lp_var_t temperature1 = lp_var_t(sid.objectId, - P60System::P60DOCK_TEMPERATURE_1, this); - lp_var_t temperature2 = lp_var_t(sid.objectId, - P60System::P60DOCK_TEMPERATURE_2, this); + lp_var_t temperature1 = lp_var_t(sid.objectId, + P60System::P60DOCK_TEMPERATURE_1, this); + lp_var_t temperature2 = lp_var_t(sid.objectId, + P60System::P60DOCK_TEMPERATURE_2, this); - lp_var_t bootcause = lp_var_t(sid.objectId, - P60System::P60DOCK_BOOT_CAUSE, this); - lp_var_t bootCount = lp_var_t(sid.objectId, - P60System::P60DOCK_BOOT_CNT, this); - lp_var_t uptime = lp_var_t(sid.objectId, - P60System::P60DOCK_UPTIME, this); - lp_var_t resetcause = lp_var_t(sid.objectId, - P60System::P60DOCK_RESETCAUSE, this); - lp_var_t battMode = lp_var_t(sid.objectId, - P60System::P60DOCK_BATT_MODE, this); - /** Battery heater control only possible on BP4 packs */ - lp_var_t heaterOn = lp_var_t(sid.objectId, - P60System::P60DOCK_HEATER_ON, this); - lp_var_t converter5VStatus = lp_var_t(sid.objectId, - P60System::P60DOCK_CONV_5V_ENABLE_STATUS, this); + lp_var_t bootcause = lp_var_t(sid.objectId, + P60System::P60DOCK_BOOT_CAUSE, this); + lp_var_t bootCount = lp_var_t(sid.objectId, + P60System::P60DOCK_BOOT_CNT, this); + lp_var_t uptime = lp_var_t(sid.objectId, + P60System::P60DOCK_UPTIME, this); + lp_var_t resetcause = lp_var_t(sid.objectId, + P60System::P60DOCK_RESETCAUSE, this); + lp_var_t battMode = lp_var_t(sid.objectId, + P60System::P60DOCK_BATT_MODE, this); + /** Battery heater control only possible on BP4 packs */ + lp_var_t heaterOn = lp_var_t(sid.objectId, + P60System::P60DOCK_HEATER_ON, this); + lp_var_t converter5VStatus = lp_var_t(sid.objectId, + P60System::P60DOCK_CONV_5V_ENABLE_STATUS, this); - /** Number of detected latchups on each output channel */ - lp_var_t latchupsAcuVcc = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_ACU_VCC, this); - lp_var_t latchupsPdu1Vcc = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_PDU1_VCC, this); - lp_var_t latchupsX3IdleVcc = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_X3_IDLE_VCC, this); - lp_var_t latchupsPdu2Vcc = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_PDU2_VCC, this); - lp_var_t latchupsAcuVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_ACU_VBAT, this); - lp_var_t latchupsPdu1Vbat = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_PDU1_VBAT, this); - lp_var_t latchupsX3IdleVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_X3_IDLE_VBAT, this); - lp_var_t latchupsPdu2Vbat = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_PDU2_VBAT, this); - lp_var_t latchupsStackVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_STACK_VBAT, this); - lp_var_t latchupsStack3V3 = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_STACK_3V3, this); - lp_var_t latchupsStack5V = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_STACK_5V, this); - lp_var_t latchupsGS3V3 = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_GS3V3, this); - lp_var_t latchupsGS5V = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_GS5V, this); + /** Number of detected latchups on each output channel */ + lp_var_t latchupsAcuVcc = lp_var_t(sid.objectId, + P60System::P60DOCK_LATCHUP_ACU_VCC, this); + lp_var_t latchupsPdu1Vcc = lp_var_t(sid.objectId, + P60System::P60DOCK_LATCHUP_PDU1_VCC, this); + lp_var_t latchupsX3IdleVcc = lp_var_t(sid.objectId, + P60System::P60DOCK_LATCHUP_X3_IDLE_VCC, this); + lp_var_t latchupsPdu2Vcc = lp_var_t(sid.objectId, + P60System::P60DOCK_LATCHUP_PDU2_VCC, this); + lp_var_t latchupsAcuVbat = lp_var_t(sid.objectId, + P60System::P60DOCK_LATCHUP_ACU_VBAT, this); + lp_var_t latchupsPdu1Vbat = lp_var_t(sid.objectId, + P60System::P60DOCK_LATCHUP_PDU1_VBAT, this); + lp_var_t latchupsX3IdleVbat = lp_var_t(sid.objectId, + P60System::P60DOCK_LATCHUP_X3_IDLE_VBAT, this); + lp_var_t latchupsPdu2Vbat = lp_var_t(sid.objectId, + P60System::P60DOCK_LATCHUP_PDU2_VBAT, this); + lp_var_t latchupsStackVbat = lp_var_t(sid.objectId, + P60System::P60DOCK_LATCHUP_STACK_VBAT, this); + lp_var_t latchupsStack3V3 = lp_var_t(sid.objectId, + P60System::P60DOCK_LATCHUP_STACK_3V3, this); + lp_var_t latchupsStack5V = lp_var_t(sid.objectId, + P60System::P60DOCK_LATCHUP_STACK_5V, this); + lp_var_t latchupsGS3V3 = lp_var_t(sid.objectId, + P60System::P60DOCK_LATCHUP_GS3V3, this); + lp_var_t latchupsGS5V = lp_var_t(sid.objectId, + P60System::P60DOCK_LATCHUP_GS5V, this); - lp_var_t vbatVoltageValue = lp_var_t(sid.objectId, - P60System::P60DOCK_VBAT_VALUE, this); - lp_var_t vccCurrent = lp_var_t(sid.objectId, - P60System::P60DOCK_VCC_CURRENT_VALUE, this); - lp_var_t batteryCurrent = lp_var_t(sid.objectId, - P60System::P60DOCK_BATTERY_CURRENT, this); - lp_var_t batteryVoltage = lp_var_t(sid.objectId, - P60System::P60DOCK_BATTERY_VOLTAGE, this); + lp_var_t vbatVoltageValue = lp_var_t(sid.objectId, + P60System::P60DOCK_VBAT_VALUE, this); + lp_var_t vccCurrent = lp_var_t(sid.objectId, + P60System::P60DOCK_VCC_CURRENT_VALUE, this); + lp_var_t batteryCurrent = lp_var_t(sid.objectId, + P60System::P60DOCK_BATTERY_CURRENT, this); + lp_var_t batteryVoltage = lp_var_t(sid.objectId, + P60System::P60DOCK_BATTERY_VOLTAGE, this); - lp_var_t batteryTemperature1 = lp_var_t(sid.objectId, - P60System::P60DOCK_BATTERY_TEMPERATURE_1, this); - lp_var_t batteryTemperature2 = lp_var_t(sid.objectId, - P60System::P60DOCK_BATTERY_TEMPERATURE_2, this); + lp_var_t batteryTemperature1 = lp_var_t(sid.objectId, + P60System::P60DOCK_BATTERY_TEMPERATURE_1, this); + lp_var_t batteryTemperature2 = lp_var_t(sid.objectId, + P60System::P60DOCK_BATTERY_TEMPERATURE_2, this); - lp_var_t device0 = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_0, this); - lp_var_t device1 = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_1, this); - lp_var_t device2 = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_2, this); - lp_var_t device3 = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_3, this); - lp_var_t device4 = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_4, this); - lp_var_t device5 = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_5, this); - lp_var_t device6 = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_6, this); - lp_var_t device7 = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_7, this); + lp_var_t device0 = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_0, this); + lp_var_t device1 = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_1, this); + lp_var_t device2 = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_2, this); + lp_var_t device3 = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_3, this); + lp_var_t device4 = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_4, this); + lp_var_t device5 = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_5, this); + lp_var_t device6 = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_6, this); + lp_var_t device7 = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_7, this); - lp_var_t device0Status = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_0_STATUS, this); - lp_var_t device1Status = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_1_STATUS, this); - lp_var_t device2Status = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_2_STATUS, this); - lp_var_t device3Status = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_3_STATUS, this); - lp_var_t device4Status = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_4_STATUS, this); - lp_var_t device5Status = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_5_STATUS, this); - lp_var_t device6Status = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_6_STATUS, this); - lp_var_t device7Status = lp_var_t(sid.objectId, - P60System::P60DOCK_DEVICE_7_STATUS, this); + lp_var_t device0Status = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_0_STATUS, this); + lp_var_t device1Status = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_1_STATUS, this); + lp_var_t device2Status = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_2_STATUS, this); + lp_var_t device3Status = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_3_STATUS, this); + lp_var_t device4Status = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_4_STATUS, this); + lp_var_t device5Status = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_5_STATUS, this); + lp_var_t device6Status = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_6_STATUS, this); + lp_var_t device7Status = lp_var_t(sid.objectId, + P60System::P60DOCK_DEVICE_7_STATUS, this); - lp_var_t dearmStatus = lp_var_t(sid.objectId, - P60System::P60DOCK_DEARM_STATUS, this); + lp_var_t dearmStatus = lp_var_t(sid.objectId, + P60System::P60DOCK_DEARM_STATUS, this); - /** Number of reboots due to gnd, i2c, csp watchdog timeout */ - lp_var_t wdtCntGnd = lp_var_t(sid.objectId, - P60System::P60DOCK_WDT_CNT_GND, this); - lp_var_t wdtCntI2c = lp_var_t(sid.objectId, - P60System::P60DOCK_WDT_CNT_I2C, this); - lp_var_t wdtCntCan = lp_var_t(sid.objectId, - P60System::P60DOCK_WDT_CNT_CAN, this); - lp_var_t wdtCntCsp1 = lp_var_t(sid.objectId, - P60System::P60DOCK_WDT_CNT_CSP_1, this); - lp_var_t wdtCntCsp2 = lp_var_t(sid.objectId, - P60System::P60DOCK_WDT_CNT_CSP_2, this); + /** Number of reboots due to gnd, i2c, csp watchdog timeout */ + lp_var_t wdtCntGnd = lp_var_t(sid.objectId, + P60System::P60DOCK_WDT_CNT_GND, this); + lp_var_t wdtCntI2c = lp_var_t(sid.objectId, + P60System::P60DOCK_WDT_CNT_I2C, this); + lp_var_t wdtCntCan = lp_var_t(sid.objectId, + P60System::P60DOCK_WDT_CNT_CAN, this); + lp_var_t wdtCntCsp1 = lp_var_t(sid.objectId, + P60System::P60DOCK_WDT_CNT_CSP_1, this); + lp_var_t wdtCntCsp2 = lp_var_t(sid.objectId, + P60System::P60DOCK_WDT_CNT_CSP_2, this); - lp_var_t wdtGndLeft = lp_var_t(sid.objectId, - P60System::P60DOCK_WDT_GND_LEFT, this); - lp_var_t wdtI2cLeft = lp_var_t(sid.objectId, - P60System::P60DOCK_WDT_I2C_LEFT, this); - lp_var_t wdtCanLeft = lp_var_t(sid.objectId, - P60System::P60DOCK_WDT_CAN_LEFT, this); - lp_var_t wdtCspLeft1 = lp_var_t(sid.objectId, - P60System::P60DOCK_WDT_CSP_LEFT_1, this); - lp_var_t wdtCspLeft2 = lp_var_t(sid.objectId, - P60System::P60DOCK_WDT_CSP_LEFT_2, this); - lp_var_t batteryChargeCurrent = lp_var_t(sid.objectId, - P60System::P60DOCK_BATT_CHARGE_CURRENT, this); - lp_var_t batteryDischargeCurrent = lp_var_t(sid.objectId, - P60System::P60DOCK_BATT_DISCHARGE_CURRENT, this); - lp_var_t ant6Depl = lp_var_t(sid.objectId, - P60System::P60DOCK_ANT6_DEPL, this); - lp_var_t ar6Depl = lp_var_t(sid.objectId, - P60System::P60DOCK_AR6_DEPL, this); - }; + lp_var_t wdtGndLeft = lp_var_t(sid.objectId, + P60System::P60DOCK_WDT_GND_LEFT, this); + lp_var_t wdtI2cLeft = lp_var_t(sid.objectId, + P60System::P60DOCK_WDT_I2C_LEFT, this); + lp_var_t wdtCanLeft = lp_var_t(sid.objectId, + P60System::P60DOCK_WDT_CAN_LEFT, this); + lp_var_t wdtCspLeft1 = lp_var_t(sid.objectId, + P60System::P60DOCK_WDT_CSP_LEFT_1, this); + lp_var_t wdtCspLeft2 = lp_var_t(sid.objectId, + P60System::P60DOCK_WDT_CSP_LEFT_2, this); + lp_var_t batteryChargeCurrent = lp_var_t(sid.objectId, + P60System::P60DOCK_BATT_CHARGE_CURRENT, this); + lp_var_t batteryDischargeCurrent = lp_var_t(sid.objectId, + P60System::P60DOCK_BATT_DISCHARGE_CURRENT, this); + lp_var_t ant6Depl = lp_var_t(sid.objectId, + P60System::P60DOCK_ANT6_DEPL, this); + lp_var_t ar6Depl = lp_var_t(sid.objectId, + P60System::P60DOCK_AR6_DEPL, this); +}; } @@ -610,597 +612,597 @@ namespace P60Dock { * @brief Constants common for both PDU1 and PDU2. */ namespace PDU{ - /** When retrieving full configuration parameter table */ - static const uint16_t MAX_REPLY_LENGTH = 318; - static const uint16_t MAX_CONFIGTABLE_ADDRESS = 316; - static const uint16_t MAX_HKTABLE_ADDRESS = 141; - /** The size of the csp reply containing the housekeeping table data */ - static const uint16_t HK_TABLE_REPLY_SIZE = 303; - static const uint8_t HK_TABLE_ENTRIES = 73; +/** When retrieving full configuration parameter table */ +static const uint16_t MAX_REPLY_LENGTH = 318; +static const uint16_t MAX_CONFIGTABLE_ADDRESS = 316; +static const uint16_t MAX_HKTABLE_ADDRESS = 141; +/** The size of the csp reply containing the housekeeping table data */ +static const uint16_t HK_TABLE_REPLY_SIZE = 303; +static const uint8_t HK_TABLE_ENTRIES = 73; } namespace PDU1 { - static const uint32_t HK_TABLE_DATA_SET_ID = 0x1; // hk table has table id 4 - /** - * Addresses within configuration table to enable or disable output channels. Refer also to - * gs-man-nanopower-p60-pdu-200.pdf on page 16. - */ - static const uint16_t CONFIG_ADDRESS_OUT_EN_TCS_BOARD_3V3 = 0x48; - static const uint16_t CONFIG_ADDRESS_OUT_EN_SYRLINKS = 0x49; - static const uint16_t CONFIG_ADDRESS_OUT_EN_STAR_TRACKER = 0x50; - static const uint16_t CONFIG_ADDRESS_OUT_EN_MGT = 0x51; - static const uint16_t CONFIG_ADDRESS_OUT_EN_SUS_NOMINAL = 0x52; - static const uint16_t CONFIG_ADDRESS_OUT_EN_SOLAR_CELL_EXP = 0x53; - static const uint16_t CONFIG_ADDRESS_OUT_EN_PLOC = 0x54; - static const uint16_t CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_A = 0x55; - static const uint16_t CONFIG_ADDRESS_OUT_EN_CHANNEL8 = 0x56; +static const uint32_t HK_TABLE_DATA_SET_ID = 0x1; // hk table has table id 4 +/** + * Addresses within configuration table to enable or disable output channels. Refer also to + * gs-man-nanopower-p60-pdu-200.pdf on page 16. + */ +static const uint16_t CONFIG_ADDRESS_OUT_EN_TCS_BOARD_3V3 = 0x48; +static const uint16_t CONFIG_ADDRESS_OUT_EN_SYRLINKS = 0x49; +static const uint16_t CONFIG_ADDRESS_OUT_EN_STAR_TRACKER = 0x50; +static const uint16_t CONFIG_ADDRESS_OUT_EN_MGT = 0x51; +static const uint16_t CONFIG_ADDRESS_OUT_EN_SUS_NOMINAL = 0x52; +static const uint16_t CONFIG_ADDRESS_OUT_EN_SOLAR_CELL_EXP = 0x53; +static const uint16_t CONFIG_ADDRESS_OUT_EN_PLOC = 0x54; +static const uint16_t CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_A = 0x55; +static const uint16_t CONFIG_ADDRESS_OUT_EN_CHANNEL8 = 0x56; + +/** + * @brief This class defines a dataset for the hk table of the PDU1. + */ +class PDU1HkTableDataset : + public StaticLocalDataSet { + public: + + PDU1HkTableDataset(HasLocalDataPoolIF* owner): + StaticLocalDataSet(owner, HK_TABLE_DATA_SET_ID) { + } + + PDU1HkTableDataset(object_id_t objectId): + StaticLocalDataSet(sid_t(objectId, HK_TABLE_DATA_SET_ID)) { + } + + /** Measured output currents */ + lp_var_t currentOutTCSBoard3V3 = lp_var_t(sid.objectId, + P60System::PDU1_CURRENT_OUT_TCS_BOARD_3V3, this); + lp_var_t currentOutSyrlinks = lp_var_t(sid.objectId, + P60System::PDU1_CURRENT_OUT_SYRLINKS, this); + lp_var_t currentOutStarTracker = lp_var_t(sid.objectId, + P60System::PDU1_CURRENT_OUT_STAR_TRACKER, this); + lp_var_t currentOutMGT = lp_var_t(sid.objectId, + P60System::PDU1_CURRENT_OUT_MGT, this); + lp_var_t currentOutSUSNominal = lp_var_t(sid.objectId, + P60System::PDU1_CURRENT_OUT_SUS_NOMINAL, this); + lp_var_t currentOutSolarCellExp = lp_var_t(sid.objectId, + P60System::PDU1_CURRENT_OUT_SOLAR_CELL_EXP, this); + lp_var_t currentOutPLOC = lp_var_t(sid.objectId, + P60System::PDU1_CURRENT_OUT_PLOC, this); + lp_var_t currentOutACSBoardSideA = lp_var_t(sid.objectId, + P60System::PDU1_CURRENT_OUT_ACS_BOARD_SIDE_A, this); + lp_var_t currentOutChannel8 = lp_var_t(sid.objectId, + P60System::PDU1_CURRENT_OUT_CHANNEL8, this); + /** Measured voltage of output channels */ + lp_var_t voltageOutTCSBoard3V3 = lp_var_t(sid.objectId, + P60System::PDU1_VOLTAGE_OUT_TCS_BOARD_3V3, this); + lp_var_t voltageOutSyrlinks = lp_var_t(sid.objectId, + P60System::PDU1_VOLTAGE_OUT_SYRLINKS, this); + lp_var_t voltageOutStarTracker = lp_var_t(sid.objectId, + P60System::PDU1_VOLTAGE_OUT_STAR_TRACKER, this); + lp_var_t voltageOutMGT = lp_var_t(sid.objectId, + P60System::PDU1_VOLTAGE_OUT_MGT, this); + lp_var_t voltageOutSUSNominal = lp_var_t(sid.objectId, + P60System::PDU1_VOLTAGE_OUT_SUS_NOMINAL, this); + lp_var_t voltageOutSolarCellExp = lp_var_t(sid.objectId, + P60System::PDU1_VOLTAGE_OUT_SOLAR_CELL_EXP, this); + lp_var_t voltageOutPLOC = lp_var_t(sid.objectId, + P60System::PDU1_VOLTAGE_OUT_PLOC, this); + lp_var_t voltageOutACSBoardSideA = lp_var_t(sid.objectId, + P60System::PDU1_VOLTAGE_OUT_ACS_BOARD_SIDE_A, this); + lp_var_t voltageOutChannel8 = lp_var_t(sid.objectId, + P60System::PDU1_VOLTAGE_OUT_CHANNEL8, this); + /** Measured VCC */ + lp_var_t vcc = lp_var_t(sid.objectId, + P60System::PDU1_VCC, this); + /** Measured VBAT */ + lp_var_t vbat = lp_var_t(sid.objectId, + P60System::PDU1_VBAT, this); + lp_var_t temperature = lp_var_t(sid.objectId, + P60System::PDU1_TEMPERATURE, this); + /** Output converter enable status */ + lp_var_t converterEnable1 = lp_var_t(sid.objectId, + P60System::PDU1_CONV_EN_1, this); + lp_var_t converterEnable2 = lp_var_t(sid.objectId, + P60System::PDU1_CONV_EN_2, this); + lp_var_t converterEnable3 = lp_var_t(sid.objectId, + P60System::PDU1_CONV_EN_3, this); + + /** Output channels enable status */ + lp_var_t outEnabledTCSBoard3V3 = lp_var_t(sid.objectId, + P60System::PDU1_OUT_EN_TCS_BOARD_3V3, this); + lp_var_t outEnabledSyrlinks = lp_var_t(sid.objectId, + P60System::PDU1_OUT_EN_SYRLINKS, this); + lp_var_t outEnabledStarTracker = lp_var_t(sid.objectId, + P60System::PDU1_OUT_EN_STAR_TRACKER, this); + lp_var_t outEnabledMGT = lp_var_t(sid.objectId, + P60System::PDU1_OUT_EN_MGT, this); + lp_var_t outEnabledSUSNominal = lp_var_t(sid.objectId, + P60System::PDU1_OUT_EN_SUS_NOMINAL, this); + lp_var_t outEnabledSolarCellExp = lp_var_t(sid.objectId, + P60System::PDU1_OUT_EN_SOLAR_CELL_EXP, this); + lp_var_t outEnabledPLOC = lp_var_t(sid.objectId, + P60System::PDU1_OUT_EN_PLOC, this); + lp_var_t outEnabledAcsBoardSideA = lp_var_t(sid.objectId, + P60System::PDU1_OUT_EN_ACS_BOARD_SIDE_A, this); + lp_var_t outEnabledChannel8 = lp_var_t(sid.objectId, + P60System::PDU1_OUT_EN_CHANNEL8, this); + lp_var_t bootcause = lp_var_t(sid.objectId, + P60System::PDU1_BOOTCAUSE, this); + /** Number of reboots */ + lp_var_t bootcount = lp_var_t(sid.objectId, + P60System::PDU1_BOOTCNT, this); + /** Uptime in seconds */ + lp_var_t uptime = lp_var_t(sid.objectId, + P60System::PDU1_UPTIME, this); + lp_var_t resetcause = lp_var_t(sid.objectId, + P60System::PDU1_RESETCAUSE, this); + /** Battery mode: 1 = Critical, 2 = Safe, 3 = Normal, 4 = Full */ + lp_var_t battMode = lp_var_t(sid.objectId, + P60System::PDU1_BATT_MODE, this); + + /** Number of detected latchups on each output channel */ + lp_var_t latchupsTcsBoard3V3 = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_TCS_BOARD_3V3, this); + lp_var_t latchupsSyrlinks = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_SYRLINKS, this); + lp_var_t latchupsStarTracker = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_STAR_TRACKER, this); + lp_var_t latchupsMgt = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_MGT, this); + lp_var_t latchupsSusNominal = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_SUS_NOMINAL, this); + lp_var_t latchupsSolarCellExp = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_SOLAR_CELL_EXP, this); + lp_var_t latchupsPloc = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_PLOC, this); + lp_var_t latchupsAcsBoardSideA = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_ACS_BOARD_SIDE_A, this); + lp_var_t latchupsChannel8 = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_CHANNEL8, this); /** - * @brief This class defines a dataset for the hk table of the PDU1. + * There are 8 devices on the PDU. FRAM, ADCs, temperature sensor etc. Each device is + * identified by an ID. Refer also to gs-man-nanopower-p60-pdu-200-1.pdf on pages 17 and 18. */ - class PDU1HkTableDataset : - public StaticLocalDataSet { - public: + lp_var_t device0 = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_0, this); + lp_var_t device1 = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_1, this); + lp_var_t device2 = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_2, this); + lp_var_t device3 = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_3, this); + lp_var_t device4 = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_4, this); + lp_var_t device5 = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_5, this); + lp_var_t device6 = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_6, this); + lp_var_t device7 = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_7, this); + /** The status of each device. 0 = None, 1 = Ok, 2 = Error, 3 = Not found */ + lp_var_t device0Status = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_0_STATUS, this); + lp_var_t device1Status = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_1_STATUS, this); + lp_var_t device2Status = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_2_STATUS, this); + lp_var_t device3Status = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_3_STATUS, this); + lp_var_t device4Status = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_4_STATUS, this); + lp_var_t device5Status = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_5_STATUS, this); + lp_var_t device6Status = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_6_STATUS, this); + lp_var_t device7Status = lp_var_t(sid.objectId, + P60System::PDU1_DEVICE_7_STATUS, this); - PDU1HkTableDataset(HasLocalDataPoolIF* owner): - StaticLocalDataSet(owner, HK_TABLE_DATA_SET_ID) { - } - - PDU1HkTableDataset(object_id_t objectId): - StaticLocalDataSet(sid_t(objectId, HK_TABLE_DATA_SET_ID)) { - } - - /** Measured output currents */ - lp_var_t currentOutTCSBoard3V3 = lp_var_t(sid.objectId, - P60System::PDU1_CURRENT_OUT_TCS_BOARD_3V3, this); - lp_var_t currentOutSyrlinks = lp_var_t(sid.objectId, - P60System::PDU1_CURRENT_OUT_SYRLINKS, this); - lp_var_t currentOutStarTracker = lp_var_t(sid.objectId, - P60System::PDU1_CURRENT_OUT_STAR_TRACKER, this); - lp_var_t currentOutMGT = lp_var_t(sid.objectId, - P60System::PDU1_CURRENT_OUT_MGT, this); - lp_var_t currentOutSUSNominal = lp_var_t(sid.objectId, - P60System::PDU1_CURRENT_OUT_SUS_NOMINAL, this); - lp_var_t currentOutSolarCellExp = lp_var_t(sid.objectId, - P60System::PDU1_CURRENT_OUT_SOLAR_CELL_EXP, this); - lp_var_t currentOutPLOC = lp_var_t(sid.objectId, - P60System::PDU1_CURRENT_OUT_PLOC, this); - lp_var_t currentOutACSBoardSideA = lp_var_t(sid.objectId, - P60System::PDU1_CURRENT_OUT_ACS_BOARD_SIDE_A, this); - lp_var_t currentOutChannel8 = lp_var_t(sid.objectId, - P60System::PDU1_CURRENT_OUT_CHANNEL8, this); - /** Measured voltage of output channels */ - lp_var_t voltageOutTCSBoard3V3 = lp_var_t(sid.objectId, - P60System::PDU1_VOLTAGE_OUT_TCS_BOARD_3V3, this); - lp_var_t voltageOutSyrlinks = lp_var_t(sid.objectId, - P60System::PDU1_VOLTAGE_OUT_SYRLINKS, this); - lp_var_t voltageOutStarTracker = lp_var_t(sid.objectId, - P60System::PDU1_VOLTAGE_OUT_STAR_TRACKER, this); - lp_var_t voltageOutMGT = lp_var_t(sid.objectId, - P60System::PDU1_VOLTAGE_OUT_MGT, this); - lp_var_t voltageOutSUSNominal = lp_var_t(sid.objectId, - P60System::PDU1_VOLTAGE_OUT_SUS_NOMINAL, this); - lp_var_t voltageOutSolarCellExp = lp_var_t(sid.objectId, - P60System::PDU1_VOLTAGE_OUT_SOLAR_CELL_EXP, this); - lp_var_t voltageOutPLOC = lp_var_t(sid.objectId, - P60System::PDU1_VOLTAGE_OUT_PLOC, this); - lp_var_t voltageOutACSBoardSideA = lp_var_t(sid.objectId, - P60System::PDU1_VOLTAGE_OUT_ACS_BOARD_SIDE_A, this); - lp_var_t voltageOutChannel8 = lp_var_t(sid.objectId, - P60System::PDU1_VOLTAGE_OUT_CHANNEL8, this); - /** Measured VCC */ - lp_var_t vcc = lp_var_t(sid.objectId, - P60System::PDU1_VCC, this); - /** Measured VBAT */ - lp_var_t vbat = lp_var_t(sid.objectId, - P60System::PDU1_VBAT, this); - lp_var_t temperature = lp_var_t(sid.objectId, - P60System::PDU1_TEMPERATURE, this); - /** Output converter enable status */ - lp_var_t converterEnable1 = lp_var_t(sid.objectId, - P60System::PDU1_CONV_EN_1, this); - lp_var_t converterEnable2 = lp_var_t(sid.objectId, - P60System::PDU1_CONV_EN_2, this); - lp_var_t converterEnable3 = lp_var_t(sid.objectId, - P60System::PDU1_CONV_EN_3, this); - - /** Output channels enable status */ - lp_var_t outEnabledTCSBoard3V3 = lp_var_t(sid.objectId, - P60System::PDU1_OUT_EN_TCS_BOARD_3V3, this); - lp_var_t outEnabledSyrlinks = lp_var_t(sid.objectId, - P60System::PDU1_OUT_EN_SYRLINKS, this); - lp_var_t outEnabledStarTracker = lp_var_t(sid.objectId, - P60System::PDU1_OUT_EN_STAR_TRACKER, this); - lp_var_t outEnabledMGT = lp_var_t(sid.objectId, - P60System::PDU1_OUT_EN_MGT, this); - lp_var_t outEnabledSUSNominal = lp_var_t(sid.objectId, - P60System::PDU1_OUT_EN_SUS_NOMINAL, this); - lp_var_t outEnabledSolarCellExp = lp_var_t(sid.objectId, - P60System::PDU1_OUT_EN_SOLAR_CELL_EXP, this); - lp_var_t outEnabledPLOC = lp_var_t(sid.objectId, - P60System::PDU1_OUT_EN_PLOC, this); - lp_var_t outEnabledAcsBoardSideA = lp_var_t(sid.objectId, - P60System::PDU1_OUT_EN_ACS_BOARD_SIDE_A, this); - lp_var_t outEnabledChannel8 = lp_var_t(sid.objectId, - P60System::PDU1_OUT_EN_CHANNEL8, this); - lp_var_t bootcause = lp_var_t(sid.objectId, - P60System::PDU1_BOOTCAUSE, this); - /** Number of reboots */ - lp_var_t bootcount = lp_var_t(sid.objectId, - P60System::PDU1_BOOTCNT, this); - /** Uptime in seconds */ - lp_var_t uptime = lp_var_t(sid.objectId, - P60System::PDU1_UPTIME, this); - lp_var_t resetcause = lp_var_t(sid.objectId, - P60System::PDU1_RESETCAUSE, this); - /** Battery mode: 1 = Critical, 2 = Safe, 3 = Normal, 4 = Full */ - lp_var_t battMode = lp_var_t(sid.objectId, - P60System::PDU1_BATT_MODE, this); - - /** Number of detected latchups on each output channel */ - lp_var_t latchupsTcsBoard3V3 = lp_var_t(sid.objectId, - P60System::PDU1_LATCHUP_TCS_BOARD_3V3, this); - lp_var_t latchupsSyrlinks = lp_var_t(sid.objectId, - P60System::PDU1_LATCHUP_SYRLINKS, this); - lp_var_t latchupsStarTracker = lp_var_t(sid.objectId, - P60System::PDU1_LATCHUP_STAR_TRACKER, this); - lp_var_t latchupsMgt = lp_var_t(sid.objectId, - P60System::PDU1_LATCHUP_MGT, this); - lp_var_t latchupsSusNominal = lp_var_t(sid.objectId, - P60System::PDU1_LATCHUP_SUS_NOMINAL, this); - lp_var_t latchupsSolarCellExp = lp_var_t(sid.objectId, - P60System::PDU1_LATCHUP_SOLAR_CELL_EXP, this); - lp_var_t latchupsPloc = lp_var_t(sid.objectId, - P60System::PDU1_LATCHUP_PLOC, this); - lp_var_t latchupsAcsBoardSideA = lp_var_t(sid.objectId, - P60System::PDU1_LATCHUP_ACS_BOARD_SIDE_A, this); - lp_var_t latchupsChannel8 = lp_var_t(sid.objectId, - P60System::PDU1_LATCHUP_CHANNEL8, this); - - /** - * There are 8 devices on the PDU. FRAM, ADCs, temperature sensor etc. Each device is - * identified by an ID. Refer also to gs-man-nanopower-p60-pdu-200-1.pdf on pages 17 and 18. - */ - lp_var_t device0 = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_0, this); - lp_var_t device1 = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_1, this); - lp_var_t device2 = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_2, this); - lp_var_t device3 = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_3, this); - lp_var_t device4 = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_4, this); - lp_var_t device5 = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_5, this); - lp_var_t device6 = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_6, this); - lp_var_t device7 = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_7, this); - /** The status of each device. 0 = None, 1 = Ok, 2 = Error, 3 = Not found */ - lp_var_t device0Status = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_0_STATUS, this); - lp_var_t device1Status = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_1_STATUS, this); - lp_var_t device2Status = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_2_STATUS, this); - lp_var_t device3Status = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_3_STATUS, this); - lp_var_t device4Status = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_4_STATUS, this); - lp_var_t device5Status = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_5_STATUS, this); - lp_var_t device6Status = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_6_STATUS, this); - lp_var_t device7Status = lp_var_t(sid.objectId, - P60System::PDU1_DEVICE_7_STATUS, this); - - /** Number of reboots triggered by the ground watchdog */ - lp_var_t gndWdtReboots = lp_var_t(sid.objectId, - P60System::PDU1_WDT_CNT_GND, this); - /** Number of reboots triggered through the I2C watchdog. Not relevant for EIVE. */ - lp_var_t i2cWdtReboots = lp_var_t(sid.objectId, - P60System::PDU1_WDT_CNT_I2C, this); - /** Number of reboots triggered through the CAN watchdog */ - lp_var_t canWdtReboots = lp_var_t(sid.objectId, - P60System::PDU1_WDT_CNT_CAN, this); - /** Number of reboots triggered through the CSP watchdog */ - lp_var_t csp1WdtReboots = lp_var_t(sid.objectId, - P60System::PDU1_WDT_CNT_CSP1, this); - lp_var_t csp2WdtReboots = lp_var_t(sid.objectId, - P60System::PDU1_WDT_CNT_CSP2, this); - /** Ground watchdog remaining seconds before rebooting */ - lp_var_t groundWatchdogSecondsLeft = lp_var_t(sid.objectId, - P60System::PDU1_WDT_GND_LEFT, this); - /** I2C watchdog remaining seconds before rebooting. Not relevant for EIVE. */ - lp_var_t i2cWatchdogSecondsLeft = lp_var_t(sid.objectId, - P60System::PDU1_WDT_I2C_LEFT, this); - /** CAN watchdog remaining seconds before rebooting. */ - lp_var_t canWatchdogSecondsLeft = lp_var_t(sid.objectId, - P60System::PDU1_WDT_CAN_LEFT, this); - /** CSP watchdogs remaining pings before rebooting. */ - lp_var_t csp2WatchdogPingsLeft = lp_var_t(sid.objectId, - P60System::PDU1_WDT_CSP_LEFT1, this); - lp_var_t csp1WatchdogPingsLeft = lp_var_t(sid.objectId, - P60System::PDU1_WDT_CSP_LEFT2, this); - }; + /** Number of reboots triggered by the ground watchdog */ + lp_var_t gndWdtReboots = lp_var_t(sid.objectId, + P60System::PDU1_WDT_CNT_GND, this); + /** Number of reboots triggered through the I2C watchdog. Not relevant for EIVE. */ + lp_var_t i2cWdtReboots = lp_var_t(sid.objectId, + P60System::PDU1_WDT_CNT_I2C, this); + /** Number of reboots triggered through the CAN watchdog */ + lp_var_t canWdtReboots = lp_var_t(sid.objectId, + P60System::PDU1_WDT_CNT_CAN, this); + /** Number of reboots triggered through the CSP watchdog */ + lp_var_t csp1WdtReboots = lp_var_t(sid.objectId, + P60System::PDU1_WDT_CNT_CSP1, this); + lp_var_t csp2WdtReboots = lp_var_t(sid.objectId, + P60System::PDU1_WDT_CNT_CSP2, this); + /** Ground watchdog remaining seconds before rebooting */ + lp_var_t groundWatchdogSecondsLeft = lp_var_t(sid.objectId, + P60System::PDU1_WDT_GND_LEFT, this); + /** I2C watchdog remaining seconds before rebooting. Not relevant for EIVE. */ + lp_var_t i2cWatchdogSecondsLeft = lp_var_t(sid.objectId, + P60System::PDU1_WDT_I2C_LEFT, this); + /** CAN watchdog remaining seconds before rebooting. */ + lp_var_t canWatchdogSecondsLeft = lp_var_t(sid.objectId, + P60System::PDU1_WDT_CAN_LEFT, this); + /** CSP watchdogs remaining pings before rebooting. */ + lp_var_t csp2WatchdogPingsLeft = lp_var_t(sid.objectId, + P60System::PDU1_WDT_CSP_LEFT1, this); + lp_var_t csp1WatchdogPingsLeft = lp_var_t(sid.objectId, + P60System::PDU1_WDT_CSP_LEFT2, this); +}; } namespace PDU2 { - static const uint32_t HK_TABLE_DATA_SET_ID = 0x2; - /** - * Addresses within configuration table to enable or disable output channels. Refer also to - * gs-man-nanopower-p60-pdu-200.pdf on page 16. - */ - static const uint16_t CONFIG_ADDRESS_OUT_EN_Q7S = 0x48; - static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH1 = 0x49; - static const uint16_t CONFIG_ADDRESS_OUT_EN_RW = 0x4A; - static const uint16_t CONFIG_ADDRESS_OUT_EN_TCS_BOARD_HEATER_IN = 0x4B; - static const uint16_t CONFIG_ADDRESS_OUT_EN_SUS_REDUNDANT = 0x4C; - static const uint16_t CONFIG_ADDRESS_OUT_EN_DEPLOYMENT_MECHANISM = 0x4D; - static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH6PLOC = 0x4E; - static const uint16_t CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_B = 0x4F; - static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_CAMERA = 0x50; +static const uint32_t HK_TABLE_DATA_SET_ID = 0x2; +/** + * Addresses within configuration table to enable or disable output channels. Refer also to + * gs-man-nanopower-p60-pdu-200.pdf on page 16. + */ +static const uint16_t CONFIG_ADDRESS_OUT_EN_Q7S = 0x48; +static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH1 = 0x49; +static const uint16_t CONFIG_ADDRESS_OUT_EN_RW = 0x4A; +static const uint16_t CONFIG_ADDRESS_OUT_EN_TCS_BOARD_HEATER_IN = 0x4B; +static const uint16_t CONFIG_ADDRESS_OUT_EN_SUS_REDUNDANT = 0x4C; +static const uint16_t CONFIG_ADDRESS_OUT_EN_DEPLOYMENT_MECHANISM = 0x4D; +static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH6PLOC = 0x4E; +static const uint16_t CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_B = 0x4F; +static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_CAMERA = 0x50; + +/** + * @brief This class defines a dataset for the hk table of the PDU2. + */ +class PDU2HkTableDataset: + public StaticLocalDataSet { + public: + + PDU2HkTableDataset(HasLocalDataPoolIF* owner): + StaticLocalDataSet(owner, HK_TABLE_DATA_SET_ID) { + } + + PDU2HkTableDataset(object_id_t objectId): + StaticLocalDataSet(sid_t(objectId, HK_TABLE_DATA_SET_ID)) { + } + + /** Measured output currents */ + lp_var_t currentOutQ7S = lp_var_t(sid.objectId, + P60System::PDU2_CURRENT_OUT_Q7S, this); + lp_var_t currentOutPayloadPCDUCh1 = lp_var_t(sid.objectId, + P60System::PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH1, this); + lp_var_t currentOutReactionWheels = lp_var_t(sid.objectId, + P60System::PDU2_CURRENT_OUT_RW, this); + lp_var_t currentOutTCSBoardHeaterIn = lp_var_t(sid.objectId, + P60System::PDU2_CURRENT_OUT_TCS_BOARD_HEATER_IN, this); + lp_var_t currentOutSUSRedundant = lp_var_t(sid.objectId, + P60System::PDU2_CURRENT_OUT_SUS_REDUNDANT, this); + lp_var_t currentOutDeplMechanism = lp_var_t(sid.objectId, + P60System::PDU2_CURRENT_OUT_DEPLOYMENT_MECHANISM, this); + lp_var_t currentOutPayloadPCDUCh6 = lp_var_t(sid.objectId, + P60System::PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH6, this); + lp_var_t currentOutACSBoardSideB = lp_var_t(sid.objectId, + P60System::PDU2_CURRENT_OUT_ACS_BOARD_SIDE_B, this); + lp_var_t currentOutPayloadCamera = lp_var_t(sid.objectId, + P60System::PDU2_CURRENT_OUT_PAYLOAD_CAMERA, this); + /** Measured voltage of output channels */ + lp_var_t voltageOutQ7S = lp_var_t(sid.objectId, + P60System::PDU2_VOLTAGE_OUT_Q7S, this); + lp_var_t voltageOutPayloadPCDUCh1 = lp_var_t(sid.objectId, + P60System::PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH1, this); + lp_var_t voltageOutReactionWheels = lp_var_t(sid.objectId, + P60System::PDU2_VOLTAGE_OUT_RW, this); + lp_var_t voltageOutTCSBoardHeaterIn = lp_var_t(sid.objectId, + P60System::PDU2_VOLTAGE_OUT_TCS_BOARD_HEATER_IN, this); + lp_var_t voltageOutSUSRedundant = lp_var_t(sid.objectId, + P60System::PDU2_VOLTAGE_OUT_SUS_REDUNDANT, this); + lp_var_t voltageOutDeplMechanism = lp_var_t(sid.objectId, + P60System::PDU2_VOLTAGE_OUT_DEPLOYMENT_MECHANISM, this); + lp_var_t voltageOutPayloadPCDUCh6 = lp_var_t(sid.objectId, + P60System::PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH6, this); + lp_var_t voltageOutACSBoardSideB = lp_var_t(sid.objectId, + P60System::PDU2_VOLTAGE_OUT_ACS_BOARD_SIDE_B, this); + lp_var_t voltageOutPayloadCamera = lp_var_t(sid.objectId, + P60System::PDU2_VOLTAGE_OUT_PAYLOAD_CAMERA, this); + /** Measured VCC */ + lp_var_t vcc = lp_var_t(sid.objectId, + P60System::PDU2_VCC, this); + /** Measured VBAT */ + lp_var_t vbat = lp_var_t(sid.objectId, + P60System::PDU2_VBAT, this); + lp_var_t temperature = lp_var_t(sid.objectId, + P60System::PDU2_TEMPERATURE, this); + /** Output converter enable status */ + lp_var_t converterEnable1 = lp_var_t(sid.objectId, + P60System::PDU2_CONV_EN_1, this); + lp_var_t converterEnable2 = lp_var_t(sid.objectId, + P60System::PDU2_CONV_EN_2, this); + lp_var_t converterEnable3 = lp_var_t(sid.objectId, + P60System::PDU2_CONV_EN_3, this); + /** Output channels enable status */ + lp_var_t outEnabledQ7S = lp_var_t(sid.objectId, + P60System::PDU2_OUT_EN_Q7S, this); + lp_var_t outEnabledPlPCDUCh1 = lp_var_t(sid.objectId, + P60System::PDU2_OUT_EN_PAYLOAD_PCDU_CH1, this); + lp_var_t outEnabledReactionWheels = lp_var_t(sid.objectId, + P60System::PDU2_OUT_EN_RW, this); + lp_var_t outEnabledTCSBoardHeaterIn = lp_var_t(sid.objectId, + P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, this); + lp_var_t outEnabledSUSRedundant = lp_var_t(sid.objectId, + P60System::PDU2_OUT_EN_SUS_REDUNDANT, this); + lp_var_t outEnabledDeplMechanism = lp_var_t(sid.objectId, + P60System::PDU2_OUT_EN_DEPLOYMENT_MECHANISM, this); + lp_var_t outEnabledPlPCDUCh6 = lp_var_t(sid.objectId, + P60System::PDU2_OUT_EN_PAYLOAD_PCDU_CH6, this); + lp_var_t outEnabledAcsBoardSideB = lp_var_t(sid.objectId, + P60System::PDU2_OUT_EN_ACS_BOARD_SIDE_B, this); + lp_var_t outEnabledPayloadCamera = lp_var_t(sid.objectId, + P60System::PDU2_OUT_EN_PAYLOAD_CAMERA, this); + + lp_var_t bootcause = lp_var_t(sid.objectId, + P60System::PDU2_BOOTCAUSE, this); + /** Number of reboots */ + lp_var_t bootcount = lp_var_t(sid.objectId, + P60System::PDU2_BOOTCNT, this); + /** Uptime in seconds */ + lp_var_t uptime = lp_var_t(sid.objectId, + P60System::PDU2_UPTIME, this); + lp_var_t resetcause = lp_var_t(sid.objectId, + P60System::PDU2_RESETCAUSE, this); + /** Battery mode: 1 = Critical, 2 = Safe, 3 = Normal, 4 = Full */ + lp_var_t battMode = lp_var_t(sid.objectId, + P60System::PDU2_BATT_MODE, this); + + /** Number of detected latchups on each output channel */ + lp_var_t latchupsQ7S = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_Q7S, this); + lp_var_t latchupsPayloadPcduCh1 = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH1, this); + lp_var_t latchupsRw = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_RW, this); + lp_var_t latchupsTcsBoardHeaterIn = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, this); + lp_var_t latchupsSusRedundant = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_SUS_REDUNDANT, this); + lp_var_t latchupsDeplMenchanism = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_DEPLOYMENT_MECHANISM, this); + lp_var_t latchupsPayloadPcduCh6 = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH6, this); + lp_var_t latchupsAcsBoardSideB = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_ACS_BOARD_SIDE_B, this); + lp_var_t latchupsPayloadCamera = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_PAYLOAD_CAMERA, this); /** - * @brief This class defines a dataset for the hk table of the PDU2. + * There are 8 devices on the PDU. FRAM, ADCs, temperature sensor etc. Each device is + * identified by an ID. Refer also to gs-man-nanopower-p60-pdu-200-1.pdf on pages 17 and 18. */ - class PDU2HkTableDataset: - public StaticLocalDataSet { - public: + lp_var_t device0 = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_0, this); + lp_var_t device1 = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_1, this); + lp_var_t device2 = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_2, this); + lp_var_t device3 = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_3, this); + lp_var_t device4 = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_4, this); + lp_var_t device5 = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_5, this); + lp_var_t device6 = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_6, this); + lp_var_t device7 = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_7, this); + /** The status of each device. 0 = None, 1 = Ok, 2 = Error, 3 = Not found */ + lp_var_t device0Status = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_0_STATUS, this); + lp_var_t device1Status = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_1_STATUS, this); + lp_var_t device2Status = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_2_STATUS, this); + lp_var_t device3Status = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_3_STATUS, this); + lp_var_t device4Status = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_4_STATUS, this); + lp_var_t device5Status = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_5_STATUS, this); + lp_var_t device6Status = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_6_STATUS, this); + lp_var_t device7Status = lp_var_t(sid.objectId, + P60System::PDU2_DEVICE_7_STATUS, this); - PDU2HkTableDataset(HasLocalDataPoolIF* owner): - StaticLocalDataSet(owner, HK_TABLE_DATA_SET_ID) { - } - - PDU2HkTableDataset(object_id_t objectId): - StaticLocalDataSet(sid_t(objectId, HK_TABLE_DATA_SET_ID)) { - } - - /** Measured output currents */ - lp_var_t currentOutQ7S = lp_var_t(sid.objectId, - P60System::PDU2_CURRENT_OUT_Q7S, this); - lp_var_t currentOutPayloadPCDUCh1 = lp_var_t(sid.objectId, - P60System::PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH1, this); - lp_var_t currentOutReactionWheels = lp_var_t(sid.objectId, - P60System::PDU2_CURRENT_OUT_RW, this); - lp_var_t currentOutTCSBoardHeaterIn = lp_var_t(sid.objectId, - P60System::PDU2_CURRENT_OUT_TCS_BOARD_HEATER_IN, this); - lp_var_t currentOutSUSRedundant = lp_var_t(sid.objectId, - P60System::PDU2_CURRENT_OUT_SUS_REDUNDANT, this); - lp_var_t currentOutDeplMechanism = lp_var_t(sid.objectId, - P60System::PDU2_CURRENT_OUT_DEPLOYMENT_MECHANISM, this); - lp_var_t currentOutPayloadPCDUCh6 = lp_var_t(sid.objectId, - P60System::PDU2_CURRENT_OUT_PAYLOAD_PCDU_CH6, this); - lp_var_t currentOutACSBoardSideB = lp_var_t(sid.objectId, - P60System::PDU2_CURRENT_OUT_ACS_BOARD_SIDE_B, this); - lp_var_t currentOutPayloadCamera = lp_var_t(sid.objectId, - P60System::PDU2_CURRENT_OUT_PAYLOAD_CAMERA, this); - /** Measured voltage of output channels */ - lp_var_t voltageOutQ7S = lp_var_t(sid.objectId, - P60System::PDU2_VOLTAGE_OUT_Q7S, this); - lp_var_t voltageOutPayloadPCDUCh1 = lp_var_t(sid.objectId, - P60System::PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH1, this); - lp_var_t voltageOutReactionWheels = lp_var_t(sid.objectId, - P60System::PDU2_VOLTAGE_OUT_RW, this); - lp_var_t voltageOutTCSBoardHeaterIn = lp_var_t(sid.objectId, - P60System::PDU2_VOLTAGE_OUT_TCS_BOARD_HEATER_IN, this); - lp_var_t voltageOutSUSRedundant = lp_var_t(sid.objectId, - P60System::PDU2_VOLTAGE_OUT_SUS_REDUNDANT, this); - lp_var_t voltageOutDeplMechanism = lp_var_t(sid.objectId, - P60System::PDU2_VOLTAGE_OUT_DEPLOYMENT_MECHANISM, this); - lp_var_t voltageOutPayloadPCDUCh6 = lp_var_t(sid.objectId, - P60System::PDU2_VOLTAGE_OUT_PAYLOAD_PCDU_CH6, this); - lp_var_t voltageOutACSBoardSideB = lp_var_t(sid.objectId, - P60System::PDU2_VOLTAGE_OUT_ACS_BOARD_SIDE_B, this); - lp_var_t voltageOutPayloadCamera = lp_var_t(sid.objectId, - P60System::PDU2_VOLTAGE_OUT_PAYLOAD_CAMERA, this); - /** Measured VCC */ - lp_var_t vcc = lp_var_t(sid.objectId, - P60System::PDU2_VCC, this); - /** Measured VBAT */ - lp_var_t vbat = lp_var_t(sid.objectId, - P60System::PDU2_VBAT, this); - lp_var_t temperature = lp_var_t(sid.objectId, - P60System::PDU2_TEMPERATURE, this); - /** Output converter enable status */ - lp_var_t converterEnable1 = lp_var_t(sid.objectId, - P60System::PDU2_CONV_EN_1, this); - lp_var_t converterEnable2 = lp_var_t(sid.objectId, - P60System::PDU2_CONV_EN_2, this); - lp_var_t converterEnable3 = lp_var_t(sid.objectId, - P60System::PDU2_CONV_EN_3, this); - /** Output channels enable status */ - lp_var_t outEnabledQ7S = lp_var_t(sid.objectId, - P60System::PDU2_OUT_EN_Q7S, this); - lp_var_t outEnabledPlPCDUCh1 = lp_var_t(sid.objectId, - P60System::PDU2_OUT_EN_PAYLOAD_PCDU_CH1, this); - lp_var_t outEnabledReactionWheels = lp_var_t(sid.objectId, - P60System::PDU2_OUT_EN_RW, this); - lp_var_t outEnabledTCSBoardHeaterIn = lp_var_t(sid.objectId, - P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, this); - lp_var_t outEnabledSUSRedundant = lp_var_t(sid.objectId, - P60System::PDU2_OUT_EN_SUS_REDUNDANT, this); - lp_var_t outEnabledDeplMechanism = lp_var_t(sid.objectId, - P60System::PDU2_OUT_EN_DEPLOYMENT_MECHANISM, this); - lp_var_t outEnabledPlPCDUCh6 = lp_var_t(sid.objectId, - P60System::PDU2_OUT_EN_PAYLOAD_PCDU_CH6, this); - lp_var_t outEnabledAcsBoardSideB = lp_var_t(sid.objectId, - P60System::PDU2_OUT_EN_ACS_BOARD_SIDE_B, this); - lp_var_t outEnabledPayloadCamera = lp_var_t(sid.objectId, - P60System::PDU2_OUT_EN_PAYLOAD_CAMERA, this); - - lp_var_t bootcause = lp_var_t(sid.objectId, - P60System::PDU2_BOOTCAUSE, this); - /** Number of reboots */ - lp_var_t bootcount = lp_var_t(sid.objectId, - P60System::PDU2_BOOTCNT, this); - /** Uptime in seconds */ - lp_var_t uptime = lp_var_t(sid.objectId, - P60System::PDU2_UPTIME, this); - lp_var_t resetcause = lp_var_t(sid.objectId, - P60System::PDU2_RESETCAUSE, this); - /** Battery mode: 1 = Critical, 2 = Safe, 3 = Normal, 4 = Full */ - lp_var_t battMode = lp_var_t(sid.objectId, - P60System::PDU2_BATT_MODE, this); - - /** Number of detected latchups on each output channel */ - lp_var_t latchupsQ7S = lp_var_t(sid.objectId, - P60System::PDU2_LATCHUP_Q7S, this); - lp_var_t latchupsPayloadPcduCh1 = lp_var_t(sid.objectId, - P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH1, this); - lp_var_t latchupsRw = lp_var_t(sid.objectId, - P60System::PDU2_LATCHUP_RW, this); - lp_var_t latchupsTcsBoardHeaterIn = lp_var_t(sid.objectId, - P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, this); - lp_var_t latchupsSusRedundant = lp_var_t(sid.objectId, - P60System::PDU2_LATCHUP_SUS_REDUNDANT, this); - lp_var_t latchupsDeplMenchanism = lp_var_t(sid.objectId, - P60System::PDU2_LATCHUP_DEPLOYMENT_MECHANISM, this); - lp_var_t latchupsPayloadPcduCh6 = lp_var_t(sid.objectId, - P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH6, this); - lp_var_t latchupsAcsBoardSideB = lp_var_t(sid.objectId, - P60System::PDU2_LATCHUP_ACS_BOARD_SIDE_B, this); - lp_var_t latchupsPayloadCamera = lp_var_t(sid.objectId, - P60System::PDU2_LATCHUP_PAYLOAD_CAMERA, this); - - /** - * There are 8 devices on the PDU. FRAM, ADCs, temperature sensor etc. Each device is - * identified by an ID. Refer also to gs-man-nanopower-p60-pdu-200-1.pdf on pages 17 and 18. - */ - lp_var_t device0 = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_0, this); - lp_var_t device1 = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_1, this); - lp_var_t device2 = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_2, this); - lp_var_t device3 = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_3, this); - lp_var_t device4 = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_4, this); - lp_var_t device5 = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_5, this); - lp_var_t device6 = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_6, this); - lp_var_t device7 = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_7, this); - /** The status of each device. 0 = None, 1 = Ok, 2 = Error, 3 = Not found */ - lp_var_t device0Status = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_0_STATUS, this); - lp_var_t device1Status = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_1_STATUS, this); - lp_var_t device2Status = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_2_STATUS, this); - lp_var_t device3Status = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_3_STATUS, this); - lp_var_t device4Status = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_4_STATUS, this); - lp_var_t device5Status = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_5_STATUS, this); - lp_var_t device6Status = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_6_STATUS, this); - lp_var_t device7Status = lp_var_t(sid.objectId, - P60System::PDU2_DEVICE_7_STATUS, this); - - /** Number of reboots triggered by the ground watchdog */ - lp_var_t gndWdtReboots = lp_var_t(sid.objectId, - P60System::PDU2_WDT_CNT_GND, this); - /** Number of reboots triggered through the I2C watchdog. Not relevant for EIVE. */ - lp_var_t i2cWdtReboots = lp_var_t(sid.objectId, - P60System::PDU2_WDT_CNT_I2C, this); - /** Number of reboots triggered through the CAN watchdog */ - lp_var_t canWdtReboots = lp_var_t(sid.objectId, - P60System::PDU2_WDT_CNT_CAN, this); - /** Number of reboots triggered through the CSP watchdog */ - lp_var_t csp1WdtReboots = lp_var_t(sid.objectId, - P60System::PDU2_WDT_CNT_CSP1, this); - lp_var_t csp2WdtReboots = lp_var_t(sid.objectId, - P60System::PDU2_WDT_CNT_CSP2, this); - /** Ground watchdog remaining seconds before rebooting */ - lp_var_t groundWatchdogSecondsLeft = lp_var_t(sid.objectId, - P60System::PDU2_WDT_GND_LEFT, this); - /** I2C watchdog remaining seconds before rebooting. Not relevant for EIVE. */ - lp_var_t i2cWatchdogSecondsLeft = lp_var_t(sid.objectId, - P60System::PDU2_WDT_I2C_LEFT, this); - /** CAN watchdog remaining seconds before rebooting. */ - lp_var_t canWatchdogSecondsLeft = lp_var_t(sid.objectId, - P60System::PDU2_WDT_CAN_LEFT, this); - /** CSP watchdog remaining pings before rebooting. */ - lp_var_t csp1WatchdogPingsLeft = lp_var_t(sid.objectId, - P60System::PDU2_WDT_CSP_LEFT1, this); - lp_var_t csp2WatchdogPingsLeft = lp_var_t(sid.objectId, - P60System::PDU2_WDT_CSP_LEFT2, this); - }; + /** Number of reboots triggered by the ground watchdog */ + lp_var_t gndWdtReboots = lp_var_t(sid.objectId, + P60System::PDU2_WDT_CNT_GND, this); + /** Number of reboots triggered through the I2C watchdog. Not relevant for EIVE. */ + lp_var_t i2cWdtReboots = lp_var_t(sid.objectId, + P60System::PDU2_WDT_CNT_I2C, this); + /** Number of reboots triggered through the CAN watchdog */ + lp_var_t canWdtReboots = lp_var_t(sid.objectId, + P60System::PDU2_WDT_CNT_CAN, this); + /** Number of reboots triggered through the CSP watchdog */ + lp_var_t csp1WdtReboots = lp_var_t(sid.objectId, + P60System::PDU2_WDT_CNT_CSP1, this); + lp_var_t csp2WdtReboots = lp_var_t(sid.objectId, + P60System::PDU2_WDT_CNT_CSP2, this); + /** Ground watchdog remaining seconds before rebooting */ + lp_var_t groundWatchdogSecondsLeft = lp_var_t(sid.objectId, + P60System::PDU2_WDT_GND_LEFT, this); + /** I2C watchdog remaining seconds before rebooting. Not relevant for EIVE. */ + lp_var_t i2cWatchdogSecondsLeft = lp_var_t(sid.objectId, + P60System::PDU2_WDT_I2C_LEFT, this); + /** CAN watchdog remaining seconds before rebooting. */ + lp_var_t canWatchdogSecondsLeft = lp_var_t(sid.objectId, + P60System::PDU2_WDT_CAN_LEFT, this); + /** CSP watchdog remaining pings before rebooting. */ + lp_var_t csp1WatchdogPingsLeft = lp_var_t(sid.objectId, + P60System::PDU2_WDT_CSP_LEFT1, this); + lp_var_t csp2WatchdogPingsLeft = lp_var_t(sid.objectId, + P60System::PDU2_WDT_CSP_LEFT2, this); +}; } namespace ACU { - static const uint32_t HK_TABLE_DATA_SET_ID = 0x4; +static const uint32_t HK_TABLE_DATA_SET_ID = 0x4; - /* When receiving full housekeeping (telemetry) table */ - static const uint16_t MAX_REPLY_LENGTH = 262; - static const uint16_t MAX_CONFIGTABLE_ADDRESS = 26; - static const uint16_t MAX_HKTABLE_ADDRESS = 120; - static const uint8_t HK_TABLE_ENTRIES = 64; - static const uint16_t HK_TABLE_REPLY_SIZE = 262; +/* When receiving full housekeeping (telemetry) table */ +static const uint16_t MAX_REPLY_LENGTH = 262; +static const uint16_t MAX_CONFIGTABLE_ADDRESS = 26; +static const uint16_t MAX_HKTABLE_ADDRESS = 120; +static const uint8_t HK_TABLE_ENTRIES = 64; +static const uint16_t HK_TABLE_REPLY_SIZE = 262; - /** - * @brief This class defines a dataset for the hk table of the ACU. - */ - class HkTableDataset: - public StaticLocalDataSet { - public: +/** + * @brief This class defines a dataset for the hk table of the ACU. + */ +class HkTableDataset: + public StaticLocalDataSet { + public: - HkTableDataset(HasLocalDataPoolIF* owner): - StaticLocalDataSet(owner, HK_TABLE_DATA_SET_ID) { - } + HkTableDataset(HasLocalDataPoolIF* owner): + StaticLocalDataSet(owner, HK_TABLE_DATA_SET_ID) { + } - HkTableDataset(object_id_t objectId): - StaticLocalDataSet(sid_t(objectId, HK_TABLE_DATA_SET_ID)) { - } + HkTableDataset(object_id_t objectId): + StaticLocalDataSet(sid_t(objectId, HK_TABLE_DATA_SET_ID)) { + } - lp_var_t currentInChannel0 = lp_var_t(sid.objectId, - P60System::ACU_CURRENT_IN_CHANNEL0, this); - lp_var_t currentInChannel1 = lp_var_t(sid.objectId, - P60System::ACU_CURRENT_IN_CHANNEL1, this); - lp_var_t currentInChannel2 = lp_var_t(sid.objectId, - P60System::ACU_CURRENT_IN_CHANNEL2, this); - lp_var_t currentInChannel3 = lp_var_t(sid.objectId, - P60System::ACU_CURRENT_IN_CHANNEL3, this); - lp_var_t currentInChannel4 = lp_var_t(sid.objectId, - P60System::ACU_CURRENT_IN_CHANNEL4, this); - lp_var_t currentInChannel5 = lp_var_t(sid.objectId, - P60System::ACU_CURRENT_IN_CHANNEL5, this); + lp_var_t currentInChannel0 = lp_var_t(sid.objectId, + P60System::ACU_CURRENT_IN_CHANNEL0, this); + lp_var_t currentInChannel1 = lp_var_t(sid.objectId, + P60System::ACU_CURRENT_IN_CHANNEL1, this); + lp_var_t currentInChannel2 = lp_var_t(sid.objectId, + P60System::ACU_CURRENT_IN_CHANNEL2, this); + lp_var_t currentInChannel3 = lp_var_t(sid.objectId, + P60System::ACU_CURRENT_IN_CHANNEL3, this); + lp_var_t currentInChannel4 = lp_var_t(sid.objectId, + P60System::ACU_CURRENT_IN_CHANNEL4, this); + lp_var_t currentInChannel5 = lp_var_t(sid.objectId, + P60System::ACU_CURRENT_IN_CHANNEL5, this); - lp_var_t voltageInChannel0 = lp_var_t(sid.objectId, - P60System::ACU_VOLTAGE_IN_CHANNEL0, this); - lp_var_t voltageInChannel1 = lp_var_t(sid.objectId, - P60System::ACU_VOLTAGE_IN_CHANNEL1, this); - lp_var_t voltageInChannel2 = lp_var_t(sid.objectId, - P60System::ACU_VOLTAGE_IN_CHANNEL2, this); - lp_var_t voltageInChannel3 = lp_var_t(sid.objectId, - P60System::ACU_VOLTAGE_IN_CHANNEL3, this); - lp_var_t voltageInChannel4 = lp_var_t(sid.objectId, - P60System::ACU_VOLTAGE_IN_CHANNEL4, this); - lp_var_t voltageInChannel5 = lp_var_t(sid.objectId, - P60System::ACU_VOLTAGE_IN_CHANNEL5, this); + lp_var_t voltageInChannel0 = lp_var_t(sid.objectId, + P60System::ACU_VOLTAGE_IN_CHANNEL0, this); + lp_var_t voltageInChannel1 = lp_var_t(sid.objectId, + P60System::ACU_VOLTAGE_IN_CHANNEL1, this); + lp_var_t voltageInChannel2 = lp_var_t(sid.objectId, + P60System::ACU_VOLTAGE_IN_CHANNEL2, this); + lp_var_t voltageInChannel3 = lp_var_t(sid.objectId, + P60System::ACU_VOLTAGE_IN_CHANNEL3, this); + lp_var_t voltageInChannel4 = lp_var_t(sid.objectId, + P60System::ACU_VOLTAGE_IN_CHANNEL4, this); + lp_var_t voltageInChannel5 = lp_var_t(sid.objectId, + P60System::ACU_VOLTAGE_IN_CHANNEL5, this); - lp_var_t vcc = lp_var_t(sid.objectId, - P60System::ACU_VCC, this); - lp_var_t vbat = lp_var_t(sid.objectId, - P60System::ACU_VBAT, this); + lp_var_t vcc = lp_var_t(sid.objectId, + P60System::ACU_VCC, this); + lp_var_t vbat = lp_var_t(sid.objectId, + P60System::ACU_VBAT, this); - lp_var_t temperature1 = lp_var_t(sid.objectId, - P60System::ACU_TEMPERATURE_1, this); - lp_var_t temperature2 = lp_var_t(sid.objectId, - P60System::ACU_TEMPERATURE_2, this); - lp_var_t temperature3 = lp_var_t(sid.objectId, - P60System::ACU_TEMPERATURE_3, this); + lp_var_t temperature1 = lp_var_t(sid.objectId, + P60System::ACU_TEMPERATURE_1, this); + lp_var_t temperature2 = lp_var_t(sid.objectId, + P60System::ACU_TEMPERATURE_2, this); + lp_var_t temperature3 = lp_var_t(sid.objectId, + P60System::ACU_TEMPERATURE_3, this); - lp_var_t mpptMode = lp_var_t(sid.objectId, - P60System::ACU_MPPT_MODE, this); + lp_var_t mpptMode = lp_var_t(sid.objectId, + P60System::ACU_MPPT_MODE, this); - lp_var_t vboostInChannel0 = lp_var_t(sid.objectId, - P60System::ACU_VBOOST_CHANNEL0, this); - lp_var_t vboostInChannel1 = lp_var_t(sid.objectId, - P60System::ACU_VBOOST_CHANNEL1, this); - lp_var_t vboostInChannel2 = lp_var_t(sid.objectId, - P60System::ACU_VBOOST_CHANNEL2, this); - lp_var_t vboostInChannel3 = lp_var_t(sid.objectId, - P60System::ACU_VBOOST_CHANNEL3, this); - lp_var_t vboostInChannel4 = lp_var_t(sid.objectId, - P60System::ACU_VBOOST_CHANNEL4, this); - lp_var_t vboostInChannel5 = lp_var_t(sid.objectId, - P60System::ACU_VBOOST_CHANNEL5, this); + lp_var_t vboostInChannel0 = lp_var_t(sid.objectId, + P60System::ACU_VBOOST_CHANNEL0, this); + lp_var_t vboostInChannel1 = lp_var_t(sid.objectId, + P60System::ACU_VBOOST_CHANNEL1, this); + lp_var_t vboostInChannel2 = lp_var_t(sid.objectId, + P60System::ACU_VBOOST_CHANNEL2, this); + lp_var_t vboostInChannel3 = lp_var_t(sid.objectId, + P60System::ACU_VBOOST_CHANNEL3, this); + lp_var_t vboostInChannel4 = lp_var_t(sid.objectId, + P60System::ACU_VBOOST_CHANNEL4, this); + lp_var_t vboostInChannel5 = lp_var_t(sid.objectId, + P60System::ACU_VBOOST_CHANNEL5, this); - lp_var_t powerInChannel0 = lp_var_t(sid.objectId, - P60System::ACU_POWER_CHANNEL0, this); - lp_var_t powerInChannel1 = lp_var_t(sid.objectId, - P60System::ACU_POWER_CHANNEL1, this); - lp_var_t powerInChannel2 = lp_var_t(sid.objectId, - P60System::ACU_POWER_CHANNEL2, this); - lp_var_t powerInChannel3 = lp_var_t(sid.objectId, - P60System::ACU_POWER_CHANNEL3, this); - lp_var_t powerInChannel4 = lp_var_t(sid.objectId, - P60System::ACU_POWER_CHANNEL4, this); - lp_var_t powerInChannel5 = lp_var_t(sid.objectId, - P60System::ACU_POWER_CHANNEL5, this); + lp_var_t powerInChannel0 = lp_var_t(sid.objectId, + P60System::ACU_POWER_CHANNEL0, this); + lp_var_t powerInChannel1 = lp_var_t(sid.objectId, + P60System::ACU_POWER_CHANNEL1, this); + lp_var_t powerInChannel2 = lp_var_t(sid.objectId, + P60System::ACU_POWER_CHANNEL2, this); + lp_var_t powerInChannel3 = lp_var_t(sid.objectId, + P60System::ACU_POWER_CHANNEL3, this); + lp_var_t powerInChannel4 = lp_var_t(sid.objectId, + P60System::ACU_POWER_CHANNEL4, this); + lp_var_t powerInChannel5 = lp_var_t(sid.objectId, + P60System::ACU_POWER_CHANNEL5, this); - lp_var_t dac0Enable = lp_var_t(sid.objectId, - P60System::ACU_DAC_EN_0, this); - lp_var_t dac1Enable = lp_var_t(sid.objectId, - P60System::ACU_DAC_EN_1, this); - lp_var_t dac2Enable = lp_var_t(sid.objectId, - P60System::ACU_DAC_EN_2, this); + lp_var_t dac0Enable = lp_var_t(sid.objectId, + P60System::ACU_DAC_EN_0, this); + lp_var_t dac1Enable = lp_var_t(sid.objectId, + P60System::ACU_DAC_EN_1, this); + lp_var_t dac2Enable = lp_var_t(sid.objectId, + P60System::ACU_DAC_EN_2, this); - lp_var_t dacRawChannelVal0 = lp_var_t(sid.objectId, - P60System::ACU_DAC_RAW_0, this); - lp_var_t dacRawChannelVal1 = lp_var_t(sid.objectId, - P60System::ACU_DAC_RAW_1, this); - lp_var_t dacRawChannelVal2 = lp_var_t(sid.objectId, - P60System::ACU_DAC_RAW_2, this); - lp_var_t dacRawChannelVal3 = lp_var_t(sid.objectId, - P60System::ACU_DAC_RAW_3, this); - lp_var_t dacRawChannelVal4 = lp_var_t(sid.objectId, - P60System::ACU_DAC_RAW_4, this); - lp_var_t dacRawChannelVal5 = lp_var_t(sid.objectId, - P60System::ACU_DAC_RAW_5, this); + lp_var_t dacRawChannelVal0 = lp_var_t(sid.objectId, + P60System::ACU_DAC_RAW_0, this); + lp_var_t dacRawChannelVal1 = lp_var_t(sid.objectId, + P60System::ACU_DAC_RAW_1, this); + lp_var_t dacRawChannelVal2 = lp_var_t(sid.objectId, + P60System::ACU_DAC_RAW_2, this); + lp_var_t dacRawChannelVal3 = lp_var_t(sid.objectId, + P60System::ACU_DAC_RAW_3, this); + lp_var_t dacRawChannelVal4 = lp_var_t(sid.objectId, + P60System::ACU_DAC_RAW_4, this); + lp_var_t dacRawChannelVal5 = lp_var_t(sid.objectId, + P60System::ACU_DAC_RAW_5, this); - lp_var_t bootCause = lp_var_t(sid.objectId, - P60System::ACU_BOOTCAUSE, this); - lp_var_t bootcnt = lp_var_t(sid.objectId, - P60System::ACU_BOOTCNT, this); - lp_var_t uptime = lp_var_t(sid.objectId, - P60System::ACU_UPTIME, this); - lp_var_t resetCause = lp_var_t(sid.objectId, - P60System::ACU_RESET_CAUSE, this); - lp_var_t mpptTime = lp_var_t(sid.objectId, - P60System::ACU_MPPT_TIME, this); - lp_var_t mpptPeriod = lp_var_t(sid.objectId, - P60System::ACU_MPPT_PERIOD, this); + lp_var_t bootCause = lp_var_t(sid.objectId, + P60System::ACU_BOOTCAUSE, this); + lp_var_t bootcnt = lp_var_t(sid.objectId, + P60System::ACU_BOOTCNT, this); + lp_var_t uptime = lp_var_t(sid.objectId, + P60System::ACU_UPTIME, this); + lp_var_t resetCause = lp_var_t(sid.objectId, + P60System::ACU_RESET_CAUSE, this); + lp_var_t mpptTime = lp_var_t(sid.objectId, + P60System::ACU_MPPT_TIME, this); + lp_var_t mpptPeriod = lp_var_t(sid.objectId, + P60System::ACU_MPPT_PERIOD, this); - lp_var_t device0 = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_0, this); - lp_var_t device1 = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_1, this); - lp_var_t device2 = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_2, this); - lp_var_t device3 = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_3, this); - lp_var_t device4 = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_4, this); - lp_var_t device5 = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_5, this); - lp_var_t device6 = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_6, this); - lp_var_t device7 = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_7, this); + lp_var_t device0 = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_0, this); + lp_var_t device1 = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_1, this); + lp_var_t device2 = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_2, this); + lp_var_t device3 = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_3, this); + lp_var_t device4 = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_4, this); + lp_var_t device5 = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_5, this); + lp_var_t device6 = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_6, this); + lp_var_t device7 = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_7, this); - lp_var_t device0Status = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_0_STATUS, this); - lp_var_t device1Status = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_1_STATUS, this); - lp_var_t device2Status = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_2_STATUS, this); - lp_var_t device3Status = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_3_STATUS, this); - lp_var_t device4Status = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_4_STATUS, this); - lp_var_t device5Status = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_5_STATUS, this); - lp_var_t device6Status = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_6_STATUS, this); - lp_var_t device7Status = lp_var_t(sid.objectId, - P60System::ACU_DEVICE_7_STATUS, this); + lp_var_t device0Status = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_0_STATUS, this); + lp_var_t device1Status = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_1_STATUS, this); + lp_var_t device2Status = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_2_STATUS, this); + lp_var_t device3Status = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_3_STATUS, this); + lp_var_t device4Status = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_4_STATUS, this); + lp_var_t device5Status = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_5_STATUS, this); + lp_var_t device6Status = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_6_STATUS, this); + lp_var_t device7Status = lp_var_t(sid.objectId, + P60System::ACU_DEVICE_7_STATUS, this); - lp_var_t wdtCntGnd = lp_var_t(sid.objectId, - P60System::ACU_WDT_CNT_GND, this); - lp_var_t wdtGndLeft = lp_var_t(sid.objectId, - P60System::ACU_WDT_GND_LEFT, this); - }; + lp_var_t wdtCntGnd = lp_var_t(sid.objectId, + P60System::ACU_WDT_CNT_GND, this); + lp_var_t wdtGndLeft = lp_var_t(sid.objectId, + P60System::ACU_WDT_GND_LEFT, this); +}; } #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINITIONS_H_ */ diff --git a/tmtc b/tmtc index 90b42e7d..eb8d5260 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 90b42e7de172fee8e6b41d21ee3de13334ec9e53 +Subproject commit eb8d52607b49b091764940f7d909b7e525238d1c -- 2.43.0 From e837532b22e831f8914bba066f58c72dfa8ec03d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 7 Sep 2021 16:14:54 +0200 Subject: [PATCH 032/102] form improvements --- mission/devices/GPSHyperionHandler.cpp | 10 +++++----- mission/devices/GPSHyperionHandler.h | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index c4cb460d..9b7e993d 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -54,13 +54,13 @@ ReturnValue_t GPSHyperionHandler::buildCommandFromCommand( size_t commandDataLen) { switch(deviceCommand) { case(GpsHyperion::TRIGGER_RESET_PIN): { - if(resetPinTrigger != nullptr) { + if(resetCallback != nullptr) { PoolReadGuard pg(&gpsSet); // Set HK entries invalid gpsSet.setValidity(false, true); // The user needs to implement this. Don't touch states for now, the device should // quickly reboot and send valid strings again. - return resetPinTrigger(resetPinTriggerArgs); + return resetCallback(resetCallbackArgs); } return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } @@ -180,10 +180,10 @@ void GPSHyperionHandler::modeChanged() { internalState = InternalStates::NONE; } -void GPSHyperionHandler::setResetPinTriggerFunction(ReturnValue_t (*function)(void *args), +void GPSHyperionHandler::setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void *args) { - resetPinTrigger = function; - resetPinTriggerArgs = args; + this->resetCallback = resetCallback; + resetCallbackArgs = args; } void GPSHyperionHandler::debugInterface(uint8_t positionTracker, object_id_t objectId, diff --git a/mission/devices/GPSHyperionHandler.h b/mission/devices/GPSHyperionHandler.h index 06c505d0..03c572a3 100644 --- a/mission/devices/GPSHyperionHandler.h +++ b/mission/devices/GPSHyperionHandler.h @@ -6,7 +6,6 @@ #include "devicedefinitions/GPSDefinitions.h" #include "lwgps/lwgps.h" - /** * @brief Device handler for the Hyperion HT-GPS200 device * @details @@ -15,15 +14,16 @@ */ class GPSHyperionHandler: public DeviceHandlerBase { public: + using gpioResetFunction_t = ReturnValue_t (*) (void* args); GPSHyperionHandler(object_id_t objectId, object_id_t deviceCommunication, CookieIF* comCookie, bool debugHyperionGps = false); virtual ~GPSHyperionHandler(); - void setResetPinTriggerFunction(ReturnValue_t (*function) (void*args), void*args); + void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void*args); protected: - ReturnValue_t (*resetPinTrigger) (void* args) = nullptr; - void* resetPinTriggerArgs = nullptr; + gpioResetFunction_t resetCallback = nullptr; + void* resetCallbackArgs = nullptr; enum class InternalStates { NONE, -- 2.43.0 From a4cd99ec905253c6b9be266c1be5a9d5d573fb16 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 7 Sep 2021 16:42:04 +0200 Subject: [PATCH 033/102] sanity check on altitude, set unix seconds --- mission/devices/GPSHyperionHandler.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 9b7e993d..e1e512e3 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -101,7 +101,13 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, gpsSet.latitude.value = gpsData.latitude; // Negative longitude -> West direction gpsSet.longitude.value = gpsData.longitude; - gpsSet.altitude.value = gpsData.altitude; + if(gpsData.altitude > 600000.0 or gpsData.altitude < 400000.0) { + gpsSet.altitude.setValid(false); + } + else { + gpsSet.altitude.setValid(true); + gpsSet.altitude.value = gpsData.altitude; + } gpsSet.fixMode.value = gpsData.fix_mode; gpsSet.satInUse.value = gpsData.sats_in_use; Clock::TimeOfDay_t timeStruct = {}; @@ -120,6 +126,7 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, gpsSet.hours = gpsData.hours; gpsSet.minutes = gpsData.minutes; gpsSet.seconds = gpsData.seconds; + gpsSet.unixSeconds = timeval.tv_sec; if(debugHyperionGps) { sif::info << "GPS Data" << std::endl; printf("Valid status: %d\n", gpsData.is_valid); -- 2.43.0 From baba8b5cf0156b7ad609f8544a8b824c5ff2adef Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Sep 2021 13:21:56 +0200 Subject: [PATCH 034/102] tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index eb8d5260..b1e89d40 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit eb8d52607b49b091764940f7d909b7e525238d1c +Subproject commit b1e89d40467b269774ac8c707c122a7524c90f39 -- 2.43.0 From 38c60f37da7d0e5e7ebe3e21811f16fe0e01fb14 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Sep 2021 13:46:33 +0200 Subject: [PATCH 035/102] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index eb8d5260..96346461 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit eb8d52607b49b091764940f7d909b7e525238d1c +Subproject commit 96346461b4602bbfb15c9f44afec8479f3e149e8 -- 2.43.0 From 63c7903f9b06bb1f812b8774e8c0e0e9fead46d1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Sep 2021 13:41:27 +0200 Subject: [PATCH 036/102] now the print command works --- mission/devices/GomspaceDeviceHandler.cpp | 1 + mission/devices/PDU2Handler.cpp | 73 +++++++++++++++-------- mission/devices/PDU2Handler.h | 26 ++++---- tmtc | 2 +- 4 files changed, 65 insertions(+), 37 deletions(-) diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index ba3327fa..c7de02bb 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -99,6 +99,7 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap(){ this->insertInCommandAndReplyMap(GOMSPACE::PARAM_GET, 3); this->insertInCommandAndReplyMap(GOMSPACE::REQUEST_HK_TABLE, 3); this->insertInCommandMap(GOMSPACE::GNDWDT_RESET); + this->insertInCommandMap(GOMSPACE::PRINT_OUT_ENB_STATUS); } ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t *start, diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 47fab6b6..8789695e 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -1,20 +1,22 @@ +#include "OBSWConfig.h" #include "PDU2Handler.h" + #include -#include +#include PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie) : - GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS, - PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE, &pdu2HkTableDataset), pdu2HkTableDataset( - this) { + GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS, + PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE, &pdu2HkTableDataset), + pdu2HkTableDataset(this) { } PDU2Handler::~PDU2Handler() { } ReturnValue_t PDU2Handler::buildNormalDeviceCommand( - DeviceCommandId_t * id) { - *id = GOMSPACE::REQUEST_HK_TABLE; - return buildCommandFromCommand(*id, NULL, 0); + DeviceCommandId_t * id) { + *id = GOMSPACE::REQUEST_HK_TABLE; + return buildCommandFromCommand(*id, NULL, 0); } void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) { @@ -34,23 +36,7 @@ void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac sif::info << "PDU2 VBAT: " << vbat << std::endl; float temperatureC = pdu2HkTableDataset.temperature.value * 0.1; sif::info << "PDU2 Temperature: " << temperatureC << " °C" << std::endl; - sif::info << "PDU2 Q7S enable state: " << unsigned(pdu2HkTableDataset.outEnabledQ7S.value) << std::endl; - sif::info << "PDU2 Payload PCDU channel 1 enable state: " - << unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh1.value) << std::endl; - sif::info << "PDU2 reaction wheels enable state: " - << unsigned(pdu2HkTableDataset.outEnabledReactionWheels.value) << std::endl; - sif::info << "PDU2 TCS Board 8V heater input enable state: " - << unsigned(pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value) << std::endl; - sif::info << "PDU2 redundant SUS group enable state: " - << unsigned(pdu2HkTableDataset.outEnabledSUSRedundant.value) << std::endl; - sif::info << "PDU2 deployment mechanism enable state: " - << unsigned(pdu2HkTableDataset.outEnabledDeplMechanism.value) << std::endl; - sif::info << "PDU2 PCDU channel 6 enable state: " - << unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh6.value) << std::endl; - sif::info << "PDU2 ACS board side B enable state: " - << unsigned(pdu2HkTableDataset.outEnabledAcsBoardSideB.value) << std::endl; - sif::info << "PDU2 payload camera enable state: " - << unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << std::endl; + printOutputSwitchStates(); sif::info << "PDU2 uptime: " << pdu2HkTableDataset.uptime << " seconds" << std::endl; sif::info << "PDU2 battery mode: " << unsigned(pdu2HkTableDataset.battMode.value) << std::endl; sif::info << "PDU2 ground watchdog reboots: " << pdu2HkTableDataset.gndWdtReboots << std::endl; @@ -323,3 +309,42 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool( return HasReturnvaluesIF::RETURN_OK; } + +ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { + switch(cmd) { + case(GOMSPACE::PRINT_OUT_ENB_STATUS): { + PoolReadGuard pg(&pdu2HkTableDataset); + ReturnValue_t readResult = pg.getReadResult(); + if(readResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading PDU2 HK table failed!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + printOutputSwitchStates(); + return HasReturnvaluesIF::RETURN_OK; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } +} + +void PDU2Handler::printOutputSwitchStates() { + sif::info << "PDU2 Q7S enable state: " << + unsigned(pdu2HkTableDataset.outEnabledQ7S.value) << std::endl; + sif::info << "PDU2 Payload PCDU channel 1 enable state: " + << unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh1.value) << std::endl; + sif::info << "PDU2 reaction wheels enable state: " + << unsigned(pdu2HkTableDataset.outEnabledReactionWheels.value) << std::endl; + sif::info << "PDU2 TCS Board 8V heater input enable state: " + << unsigned(pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value) << std::endl; + sif::info << "PDU2 redundant SUS group enable state: " + << unsigned(pdu2HkTableDataset.outEnabledSUSRedundant.value) << std::endl; + sif::info << "PDU2 deployment mechanism enable state: " + << unsigned(pdu2HkTableDataset.outEnabledDeplMechanism.value) << std::endl; + sif::info << "PDU2 PCDU channel 6 enable state: " + << unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh6.value) << std::endl; + sif::info << "PDU2 ACS board side B enable state: " + << unsigned(pdu2HkTableDataset.outEnabledAcsBoardSideB.value) << std::endl; + sif::info << "PDU2 payload camera enable state: " + << unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << std::endl; +} diff --git a/mission/devices/PDU2Handler.h b/mission/devices/PDU2Handler.h index ee30a12f..0aa7f0b5 100644 --- a/mission/devices/PDU2Handler.h +++ b/mission/devices/PDU2Handler.h @@ -20,25 +20,27 @@ */ class PDU2Handler: public GomspaceDeviceHandler { public: - PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie); - virtual ~PDU2Handler(); + PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie); + virtual ~PDU2Handler(); - virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, - LocalDataPoolManager& poolManager) override; + virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) override; protected: - /** - * @brief As soon as the device is in MODE_NORMAL, this function is executed periodically. - */ - virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override; - virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override; + /** + * @brief As soon as the device is in MODE_NORMAL, this function is executed periodically. + */ + virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override; + virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override; + ReturnValue_t printStatus(DeviceCommandId_t cmd) override; private: - /** Dataset for the housekeeping table of the PDU2 */ - PDU2::PDU2HkTableDataset pdu2HkTableDataset; + /** Dataset for the housekeeping table of the PDU2 */ + PDU2::PDU2HkTableDataset pdu2HkTableDataset; - void parseHkTableReply(const uint8_t *packet); + void printOutputSwitchStates(); + void parseHkTableReply(const uint8_t *packet); }; #endif /* MISSION_DEVICES_PDU2HANDLER_H_ */ diff --git a/tmtc b/tmtc index b1e89d40..d84c6a7e 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b1e89d40467b269774ac8c707c122a7524c90f39 +Subproject commit d84c6a7e70e68f28dcfb21ccfdaae6a0300eab40 -- 2.43.0 From 5779f511cf56c6c5b6cd7cc607a8f954355074dd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Sep 2021 16:03:20 +0200 Subject: [PATCH 037/102] some tweaks for reset pin command --- fsfw | 2 +- generators/.gitignore | 1 + mission/devices/GPSHyperionHandler.cpp | 3 +++ tmtc | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 generators/.gitignore diff --git a/fsfw b/fsfw index 924c150a..73eb11f4 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 924c150af27484f9eb4439ec80c048b46c226890 +Subproject commit 73eb11f4f1e7cc80f61d04ad7722fe53608f8051 diff --git a/generators/.gitignore b/generators/.gitignore new file mode 100644 index 00000000..181d655f --- /dev/null +++ b/generators/.gitignore @@ -0,0 +1 @@ +.~lock* diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index e1e512e3..a757c8a6 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -52,6 +52,8 @@ ReturnValue_t GPSHyperionHandler::buildNormalDeviceCommand(DeviceCommandId_t *id ReturnValue_t GPSHyperionHandler::buildCommandFromCommand( DeviceCommandId_t deviceCommand, const uint8_t *commandData, size_t commandDataLen) { + // By default, send nothing + rawPacketLen = 0; switch(deviceCommand) { case(GpsHyperion::TRIGGER_RESET_PIN): { if(resetCallback != nullptr) { @@ -181,6 +183,7 @@ ReturnValue_t GPSHyperionHandler::initializeLocalDataPool( void GPSHyperionHandler::fillCommandAndReplyMap() { // Reply length does not matter, packets should always arrive periodically insertInReplyMap(GpsHyperion::GPS_REPLY, 4, &gpsSet, 0, true); + insertInCommandMap(GpsHyperion::TRIGGER_RESET_PIN); } void GPSHyperionHandler::modeChanged() { diff --git a/tmtc b/tmtc index d84c6a7e..cce04cc1 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit d84c6a7e70e68f28dcfb21ccfdaae6a0300eab40 +Subproject commit cce04cc163c769136b7d6e3effa381a72d6f4c16 -- 2.43.0 From 6409c596f78da4447fa61da83a254ce4aa0bfbba Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Sep 2021 16:21:22 +0200 Subject: [PATCH 038/102] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 73eb11f4..e6e19362 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 73eb11f4f1e7cc80f61d04ad7722fe53608f8051 +Subproject commit e6e19362934ede9e79a2f353daeb23a54d9c7f2a -- 2.43.0 From 46e3956bca800a0242ce014a230669fedbb1a506 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Sep 2021 17:02:37 +0200 Subject: [PATCH 039/102] generating finish reply --- fsfw | 2 +- mission/devices/GPSHyperionHandler.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fsfw b/fsfw index e6e19362..a8167f54 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e6e19362934ede9e79a2f353daeb23a54d9c7f2a +Subproject commit a8167f5431b73ea67b82b84740b48646a4b6e35a diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index a757c8a6..30529474 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -62,6 +62,7 @@ ReturnValue_t GPSHyperionHandler::buildCommandFromCommand( gpsSet.setValidity(false, true); // The user needs to implement this. Don't touch states for now, the device should // quickly reboot and send valid strings again. + actionHelper.finish(true, getCommanderQueueId(deviceCommand), deviceCommand); return resetCallback(resetCallbackArgs); } return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; -- 2.43.0 From 366c475b05cc2f0db320df67562ee2c9890891f9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Sep 2021 17:25:13 +0200 Subject: [PATCH 040/102] bug fixed in fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index a8167f54..40adca5f 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit a8167f5431b73ea67b82b84740b48646a4b6e35a +Subproject commit 40adca5f1d13ef8d6c712842ebc37e37fe449446 -- 2.43.0 From 03433729105c3caeab9a72400e555dda111f3b10 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Sep 2021 19:27:49 +0200 Subject: [PATCH 041/102] very important bugfix for reset pin gnss --- bsp_q7s/boardconfig/busConf.h | 2 +- mission/devices/GPSHyperionHandler.cpp | 2 +- tmtc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index 3f83828a..74c91708 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -44,7 +44,7 @@ static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16; static constexpr uint32_t GPIO_MGM_3_RM3100_CS = 10; // Active low reset pin -static constexpr uint32_t GPIO_RESET_GNSS_0 = 8; // D22 +static constexpr uint32_t GPIO_RESET_GNSS_0 = 9; // C22 static constexpr uint32_t GPIO_RESET_GNSS_1 = 12; // B21 static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; // R18 diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 30529474..80331c58 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -138,7 +138,7 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, printf("Altitude: %f meters\n", gpsData.altitude); } #if FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV == 1 - std::string filename = "/mnt/sd0/gps_log_070921.txt"; + std::string filename = "/mnt/sd0/gps_log.txt"; std::ofstream gpsFile; if(not std::filesystem::exists(filename)) { gpsFile.open(filename, std::ofstream::out); diff --git a/tmtc b/tmtc index cce04cc1..90f85b7d 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit cce04cc163c769136b7d6e3effa381a72d6f4c16 +Subproject commit 90f85b7dae63e93a3c5686fab9dd0d4a8147e96b -- 2.43.0 From 2c65849bc645f64cbe553220900f61a49c40d1e7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 10 Sep 2021 10:05:37 +0200 Subject: [PATCH 042/102] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 90b42e7d..90f85b7d 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 90b42e7de172fee8e6b41d21ee3de13334ec9e53 +Subproject commit 90f85b7dae63e93a3c5686fab9dd0d4a8147e96b -- 2.43.0 From 9dff2e14790671797d46b1f44b66a97aab17fd42 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 11 Sep 2021 17:40:13 +0200 Subject: [PATCH 043/102] enable periodci reply now --- fsfw | 2 +- mission/devices/GPSHyperionHandler.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 40adca5f..c9bfc846 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 40adca5f1d13ef8d6c712842ebc37e37fe449446 +Subproject commit c9bfc8464aede0f79c167e18c5c0c79ded2444ce diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 80331c58..fe50d292 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -23,6 +23,7 @@ GPSHyperionHandler::~GPSHyperionHandler() {} void GPSHyperionHandler::doStartUp() { if(internalState == InternalStates::NONE) { commandExecuted = false; + enablePeriodicReply(GpsHyperion::GPS_REPLY); internalState = InternalStates::WAIT_FIRST_MESSAGE; } -- 2.43.0 From 9f389fb9204ca95202334ecdee9627665d478d7d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 13 Sep 2021 10:25:58 +0200 Subject: [PATCH 044/102] added newline --- mission/devices/GPSHyperionHandler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 80331c58..b7790c76 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -144,6 +144,7 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, gpsFile.open(filename, std::ofstream::out); } gpsFile.open(filename, std::ofstream::out | std::ofstream::app); + gpsFile.write("\n", 1); gpsFile.write(reinterpret_cast(start), len); #endif } -- 2.43.0 From 63ec5d6338d521674742096e1b642b956c44fd2e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 13 Sep 2021 10:26:20 +0200 Subject: [PATCH 045/102] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index c9bfc846..40adca5f 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit c9bfc8464aede0f79c167e18c5c0c79ded2444ce +Subproject commit 40adca5f1d13ef8d6c712842ebc37e37fe449446 -- 2.43.0 From c67a7ef1d842387ccf896ff22082b5e117a88f7f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 13 Sep 2021 11:48:11 +0200 Subject: [PATCH 046/102] added more package pin comments --- bsp_q7s/boardconfig/busConf.h | 22 +++++++++++-------- fsfw | 2 +- .../pollingSequenceFactory.cpp | 20 ++++++++--------- mission/devices/GPSHyperionHandler.cpp | 2 +- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index 74c91708..ba4eda03 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -33,17 +33,21 @@ static const char* const GPIO_RW_DEFAULT_CHIP = GPIO_FLEX_OBC1F_B0; static const char* const GPIO_RAD_SENSOR_CHIP = GPIO_FLEX_OBC1F_B0; static constexpr uint32_t GPIO_RW_0_CS = 7; // B20 -static constexpr uint32_t GPIO_RW_1_CS = 3; -static constexpr uint32_t GPIO_RW_2_CS = 11; -static constexpr uint32_t GPIO_RW_3_CS = 6; +static constexpr uint32_t GPIO_RW_1_CS = 3; // G22 +static constexpr uint32_t GPIO_RW_2_CS = 11; // E18 +static constexpr uint32_t GPIO_RW_3_CS = 6; // B19 -static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 18; -static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 1; -static constexpr uint32_t GPIO_MGM_0_LIS3_CS = 5; -static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16; +static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 18; // N22 +static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 1; // M21 +static constexpr uint32_t GPIO_MGM_0_LIS3_CS = 5; // C18 +// MGM_2 is part of gpiochip6 +static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16; // A16 +static constexpr uint32_t GPIO_MGM_3_RM3100_CS = 10; // C17 -static constexpr uint32_t GPIO_MGM_3_RM3100_CS = 10; -// Active low reset pin +// Active low enable pin (needs to be driven low for regular operations) +static constexpr uint32_t GPIO_GYRO_0_ENABLE = 2; // H22 + +// Active low reset pin (needs to be driven high for regular operations) static constexpr uint32_t GPIO_RESET_GNSS_0 = 9; // C22 static constexpr uint32_t GPIO_RESET_GNSS_1 = 12; // B21 diff --git a/fsfw b/fsfw index 40adca5f..97494a84 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 40adca5f1d13ef8d6c712842ebc37e37fe449446 +Subproject commit 97494a84dfd0acb9dc32770ae9d142f80d4bbcfa diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 9eb1bd12..5f7bfd35 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -436,16 +436,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); // -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); // // thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 3149a051..5e44f89c 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -23,7 +23,7 @@ GPSHyperionHandler::~GPSHyperionHandler() {} void GPSHyperionHandler::doStartUp() { if(internalState == InternalStates::NONE) { commandExecuted = false; - enablePeriodicReply(GpsHyperion::GPS_REPLY); + updatePeriodicReply(true, GpsHyperion::GPS_REPLY); internalState = InternalStates::WAIT_FIRST_MESSAGE; } -- 2.43.0 From 3354f2a69649355e963a853f9233515a56e90c32 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 13 Sep 2021 18:07:07 +0200 Subject: [PATCH 047/102] acd board tests continued --- .../fsfwconfig/devices/powerSwitcherList.h | 4 +- bsp_q7s/boardconfig/busConf.h | 3 +- bsp_q7s/core/InitMission.cpp | 4 +- bsp_q7s/core/ObjectFactory.cpp | 23 ++++--- bsp_q7s/core/ObjectFactory.h | 2 +- linux/boardtest/SpiTestClass.cpp | 68 +++++++++---------- linux/boardtest/SpiTestClass.h | 22 +++--- linux/fsfwconfig/devices/gpioIds.h | 3 + linux/fsfwconfig/devices/powerSwitcherList.h | 4 +- mission/devices/MGMHandlerRM3100.cpp | 30 ++++---- mission/devices/MGMHandlerRM3100.h | 7 +- mission/devices/PCDUHandler.cpp | 4 +- tmtc | 2 +- 13 files changed, 99 insertions(+), 77 deletions(-) diff --git a/bsp_hosted/fsfwconfig/devices/powerSwitcherList.h b/bsp_hosted/fsfwconfig/devices/powerSwitcherList.h index cacd23a1..c216c828 100644 --- a/bsp_hosted/fsfwconfig/devices/powerSwitcherList.h +++ b/bsp_hosted/fsfwconfig/devices/powerSwitcherList.h @@ -5,7 +5,7 @@ namespace pcduSwitches { /* Switches are uint8_t datatype and go from 0 to 255 */ - enum switcherList { + enum SwitcherList { Q7S, PAYLOAD_PCDU_CH1, RW, @@ -22,7 +22,7 @@ namespace pcduSwitches { SUS_NOMINAL, SOLAR_CELL_EXP, PLOC, - ACS_BORAD_SIDE_A, + ACS_BOARD_SIDE_A, NUMBER_OF_SWITCHES }; diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index ba4eda03..491930db 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -58,7 +58,7 @@ static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; // R18 /**************************************************************/ static constexpr char GPIO_FLEX_OBC1F_B1[] = "gpiochip6"; static const char* const GPIO_MGM2_LIS3_CHIP = GPIO_FLEX_OBC1F_B1; -static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0; +static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0; // D18 /**************************************************************/ /** OBC1C */ @@ -74,6 +74,7 @@ static constexpr uint32_t GPIO_HEATER_4_PIN = 3; static constexpr uint32_t GPIO_HEATER_5_PIN = 0; static constexpr uint32_t GPIO_HEATER_6_PIN = 1; static constexpr uint32_t GPIO_HEATER_7_PIN = 11; +static constexpr uint32_t GPIO_GYRO_2_ENABLE = 18; // F22 static constexpr uint32_t GPIO_SOL_DEPL_SA_0_PIN = 4; static constexpr uint32_t GPIO_SOL_DEPL_SA_1_PIN = 2; diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 1b5f10fd..49e9d8ca 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -121,7 +121,7 @@ void initmission::initTasks() { std::vector pstTasks; createPstTasks(*factory, missedDeadlineFunc, pstTasks); -#if OBSW_ADD_TEST_TASK == 1 +#if OBSW_ADD_TEST_CODE == 1 std::vector testTasks; createTestTasks(*factory, missedDeadlineFunc, testTasks); #endif @@ -147,7 +147,7 @@ void initmission::initTasks() { taskStarter(pstTasks, "PST task vector"); taskStarter(pusTasks, "PUS task vector"); -#if OBSW_ADD_TEST_TASK == 1 +#if OBSW_ADD_TEST_CODE == 1 taskStarter(testTasks, "Test task vector"); #endif diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 8fcbfa52..e529fe09 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -97,6 +97,8 @@ void Factory::setStaticFrameworkObjectIds() { CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; + //DeviceHandlerBase::powerSwitcherId = objects::PCDU_HANDLER; + DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT; TmFunnel::downlinkDestination = objects::TMTC_BRIDGE; // No storage object for now. TmFunnel::storageDestination = objects::NO_OBJECT; @@ -121,6 +123,7 @@ void ObjectFactory::produce(void* args){ createPcduComponents(); createRadSensorComponent(gpioComIF); createSunSensorComponents(gpioComIF, spiComIF); + #if OBSW_ADD_ACS_BOARD == 1 createAcsBoardComponents(gpioComIF, uartComIF); #endif /* OBSW_ADD_ACS_BOARD == 1 */ @@ -183,7 +186,7 @@ void ObjectFactory::produce(void* args){ /* Test Task */ #if OBSW_ADD_TEST_CODE == 1 - createTestComponents(); + createTestComponents(gpioComIF); #endif /* OBSW_ADD_TEST_CODE == 1 */ new PlocUpdater(objects::PLOC_UPDATER); @@ -431,10 +434,15 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI "GNSS_1_NRESET", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio); + // Enable pins must be pulled low for regular operations + gpio = new GpiodRegular(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE, + "GYRO_0_ENABLE", gpio::OUT, gpio::LOW); + gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ENABLE, gpio); + gpio = new GpiodRegular(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE, + "GYRO_2_ENABLE", gpio::OUT, gpio::LOW); + gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ENABLE, gpio); - - // GNSS enable pins must be pulled high - + // TODO: Add enable pins for GPS as soon as new interface board design is finished gpioComIF->addGpios(gpioCookieAcsBoard); std::string spiDev = q7s::SPI_DEFAULT_DEV; @@ -447,7 +455,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER, - objects::SPI_COM_IF, spiCookie); + objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_A); mgmRm3100Handler->setStartUpImmediately(); spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, @@ -459,10 +467,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_3_RM3100_HANDLER, - objects::SPI_COM_IF, spiCookie); + objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_B); mgmRm3100Handler->setStartUpImmediately(); - // Commented until ACS board V2 in in clean room again // Gyro 0 Side A spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, @@ -806,7 +813,7 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { rw4SpiCookie->setCallbackArgs(rwHandler4); } -void ObjectFactory::createTestComponents() { +void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { #if BOARD_TE0720 == 0 new Q7STestTask(objects::TEST_TASK); diff --git a/bsp_q7s/core/ObjectFactory.h b/bsp_q7s/core/ObjectFactory.h index 0e7ff9ff..ad9533a5 100644 --- a/bsp_q7s/core/ObjectFactory.h +++ b/bsp_q7s/core/ObjectFactory.h @@ -22,7 +22,7 @@ void createSolarArrayDeploymentComponents(); void createSyrlinksComponents(); void createRtdComponents(LinuxLibgpioIF* gpioComIF); void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF); -void createTestComponents(); +void createTestComponents(LinuxLibgpioIF* gpioComIF); }; diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 730a1743..ee08bc41 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -1,5 +1,4 @@ #include "SpiTestClass.h" -#include "OBSWConfig.h" #include "devices/gpioIds.h" @@ -20,7 +19,6 @@ #include #include - SpiTestClass::SpiTestClass(object_id_t objectId, GpioIF* gpioIF): TestTask(objectId), gpioIF(gpioIF) { if(gpioIF == nullptr) { @@ -37,11 +35,11 @@ ReturnValue_t SpiTestClass::performOneShotAction() { break; } case(TestModes::MGM_LIS3MDL): { - performLis3MdlTest(mgm2Lis3mdlChipSelect); + performLis3MdlTest(mgm0Lis3mdlChipSelect); break; } case(TestModes::MGM_RM3100): { - performRm3100Test(mgm3Rm3100ChipSelect); + performRm3100Test(mgm1Rm3100ChipSelect); break; } case(TestModes::GYRO_L3GD20H): { @@ -150,10 +148,10 @@ void SpiTestClass::performRm3100Test(uint8_t mgmId) { float fieldStrengthY = rawY * scaleFactor; float fieldStrengthZ = rawZ * scaleFactor; - sif::info << "RM3100 measured field strenghts in microtesla:" << std::endl; - sif::info << "Field Strength X: " << fieldStrengthX << " \xC2\xB5T" << std::endl; - sif::info << "Field Strength Y: " << fieldStrengthY << " \xC2\xB5T" << std::endl; - sif::info << "Field Strength Z: " << fieldStrengthZ << " \xC2\xB5T" << std::endl; + sif::info << "RM3100 measured field strengths in microtesla:" << std::endl; + sif::info << "Field Strength X: " << fieldStrengthX << " uT" << std::endl; + sif::info << "Field Strength Y: " << fieldStrengthY << " uT" << std::endl; + sif::info << "Field Strength Z: " << fieldStrengthZ << " uT" << std::endl; } void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) { @@ -174,8 +172,8 @@ void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) { else { currentGpioId = gpioIds::MGM_2_LIS3_CS; } - uint32_t spiSpeed = 3'900'000; - spi::SpiModes spiMode = spi::SpiModes::MODE_3; + uint32_t spiSpeed = 10'000'000; + spi::SpiModes spiMode = spi::SpiModes::MODE_0; #ifdef RASPBERRY_PI std::string deviceName = "/dev/spidev0.0"; #else @@ -208,10 +206,10 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { /* Configure all SPI chip selects and pull them high */ acsInit(); - l3gId = gyro2L3gd20ChipSelect; + l3gId = gyro3L3gd20ChipSelect; /* Adapt accordingly */ - if(l3gId != gyro1L3gd20ChipSelect and l3gId != gyro2L3gd20ChipSelect) { + if(l3gId != gyro1L3gd20ChipSelect and l3gId != gyro3L3gd20ChipSelect) { sif::warning << "SpiTestClass::performLis3MdlTest: Invalid MGM ID!" << std::endl; } gpioId_t currentGpioId = 0; @@ -331,36 +329,32 @@ void SpiTestClass::acsInit() { gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); #elif defined(XIPHOS_Q7S) - std::string q7sGpioName5 = "gpiochip5"; - std::string q7sGpioName6 = "gpiochip6"; - gpio = new GpiodRegular(q7sGpioName5, mgm0Lis3mdlChipSelect, "MGM_0_LIS3", - gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, mgm0Lis3mdlChipSelect, + "MGM_0_LIS3", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - - gpio = new GpiodRegular(q7sGpioName5, mgm1Rm3100ChipSelect, "MGM_1_RM3100", - gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, mgm1Rm3100ChipSelect, + "MGM_1_RM3100", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - - gpio = new GpiodRegular(q7sGpioName5, gyro0AdisChipSelect, "GYRO_0_ADIS", - gpio::Direction::OUT, gpio::HIGH); - gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - - gpio = new GpiodRegular(q7sGpioName5, gyro1L3gd20ChipSelect, "GYRO_1_L3G", - gpio::Direction::OUT, gpio::HIGH); - gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - - gpio = new GpiodRegular(q7sGpioName5, gyro2L3gd20ChipSelect, "GYRO_2_L3G", - gpio::Direction::OUT, gpio::HIGH); - gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); - - gpio = new GpiodRegular(q7sGpioName6, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", - gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegular(q7s::GPIO_MGM2_LIS3_CHIP, mgm2Lis3mdlChipSelect, + "MGM_2_LIS3", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - - gpio = new GpiodRegular(q7sGpioName5, mgm3Rm3100ChipSelect, "MGM_3_RM3100", - gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, mgm3Rm3100ChipSelect, + "MGM_3_RM3100", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); + + gpio = new GpiodRegular(q7s::GPIO_GYRO_ADIS_CHIP, gyro0AdisChipSelect, + "GYRO_0_ADIS", gpio::Direction::OUT, gpio::HIGH); + gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); + gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, gyro1L3gd20ChipSelect, + "GYRO_1_L3G", gpio::Direction::OUT, gpio::HIGH); + gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); + gpio = new GpiodRegular(q7s::GPIO_GYRO_ADIS_CHIP, gyro2AdisChipSelect, + "GYRO_2_ADIS", gpio::Direction::OUT, gpio::HIGH); + gpioCookie->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio); + gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, gyro3L3gd20ChipSelect, + "GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH); + gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); #endif if(gpioIF != nullptr) { gpioIF->addGpios(gpioCookie); diff --git a/linux/boardtest/SpiTestClass.h b/linux/boardtest/SpiTestClass.h index dd112a0e..d5309a1e 100644 --- a/linux/boardtest/SpiTestClass.h +++ b/linux/boardtest/SpiTestClass.h @@ -1,6 +1,12 @@ #ifndef LINUX_BOARDTEST_SPITESTCLASS_H_ #define LINUX_BOARDTEST_SPITESTCLASS_H_ +#include "OBSWConfig.h" + +#if defined(XIPHOS_Q7S) +#include "busConf.h" +#endif + #include #include #include @@ -47,14 +53,14 @@ private: uint8_t mgm2Lis3mdlChipSelect = 17; uint8_t mgm3Rm3100ChipSelect = 27; #elif defined(XIPHOS_Q7S) - uint8_t mgm0Lis3mdlChipSelect = 5; - uint8_t mgm1Rm3100ChipSelect = 17; - uint8_t gyro0AdisResetLine = 20; - uint8_t gyro0AdisChipSelect = 21; - uint8_t gyro1L3gd20ChipSelect = 10; - uint8_t gyro2L3gd20ChipSelect = 3; - uint8_t mgm2Lis3mdlChipSelect = 0; - uint8_t mgm3Rm3100ChipSelect = 23; + uint8_t mgm0Lis3mdlChipSelect = q7s::GPIO_MGM_0_LIS3_CS; + uint8_t mgm1Rm3100ChipSelect = q7s::GPIO_MGM_1_RM3100_CS; + uint8_t gyro0AdisChipSelect = q7s::GPIO_GYRO_0_ADIS_CS; + uint8_t gyro2AdisChipSelect = q7s::GPIO_GYRO_2_ADIS_CS; + uint8_t gyro1L3gd20ChipSelect = q7s::GPIO_GYRO_1_L3G_CS; + uint8_t gyro3L3gd20ChipSelect = q7s::GPIO_GYRO_3_L3G_CS; + uint8_t mgm2Lis3mdlChipSelect = q7s::GPIO_MGM_2_LIS3_CS; + uint8_t mgm3Rm3100ChipSelect = q7s::GPIO_MGM_3_RM3100_CS; #else uint8_t mgm0Lis3mdlChipSelect = 0; uint8_t mgm1Rm3100ChipSelect = 0; diff --git a/linux/fsfwconfig/devices/gpioIds.h b/linux/fsfwconfig/devices/gpioIds.h index e8709f2e..b450bf8b 100644 --- a/linux/fsfwconfig/devices/gpioIds.h +++ b/linux/fsfwconfig/devices/gpioIds.h @@ -28,6 +28,9 @@ enum gpioId_t { GNSS_0_NRESET, GNSS_1_NRESET, + GYRO_0_ENABLE, + GYRO_2_ENABLE, + TEST_ID_0, TEST_ID_1, diff --git a/linux/fsfwconfig/devices/powerSwitcherList.h b/linux/fsfwconfig/devices/powerSwitcherList.h index 9facfd80..bc5731fd 100644 --- a/linux/fsfwconfig/devices/powerSwitcherList.h +++ b/linux/fsfwconfig/devices/powerSwitcherList.h @@ -5,7 +5,7 @@ namespace pcduSwitches { /* Switches are uint8_t datatype and go from 0 to 255 */ - enum switcherList { + enum SwitcherList: uint8_t { Q7S, PAYLOAD_PCDU_CH1, RW, @@ -22,7 +22,7 @@ namespace pcduSwitches { SUS_NOMINAL, SOLAR_CELL_EXP, PLOC, - ACS_BORAD_SIDE_A, + ACS_BOARD_SIDE_A, NUMBER_OF_SWITCHES }; diff --git a/mission/devices/MGMHandlerRM3100.cpp b/mission/devices/MGMHandlerRM3100.cpp index 0f7fc729..a4878b95 100644 --- a/mission/devices/MGMHandlerRM3100.cpp +++ b/mission/devices/MGMHandlerRM3100.cpp @@ -8,9 +8,9 @@ MGMHandlerRM3100::MGMHandlerRM3100(object_id_t objectId, - object_id_t deviceCommunication, CookieIF* comCookie): + object_id_t deviceCommunication, CookieIF* comCookie, uint8_t switchId): DeviceHandlerBase(objectId, deviceCommunication, comCookie), - primaryDataset(this) { + primaryDataset(this), switchId(switchId) { #if OBSW_VERBOSE_LEVEL >= 1 debugDivider = new PeriodicOperationDivider(5); #endif @@ -300,16 +300,16 @@ ReturnValue_t MGMHandlerRM3100::handleTmrcConfigCommand( } void MGMHandlerRM3100::fillCommandAndReplyMap() { - insertInCommandAndReplyMap(RM3100::CONFIGURE_CMM, 1); - insertInCommandAndReplyMap(RM3100::READ_CMM, 1); + insertInCommandAndReplyMap(RM3100::CONFIGURE_CMM, 3); + insertInCommandAndReplyMap(RM3100::READ_CMM, 3); - insertInCommandAndReplyMap(RM3100::CONFIGURE_TMRC, 1); - insertInCommandAndReplyMap(RM3100::READ_TMRC, 1); + insertInCommandAndReplyMap(RM3100::CONFIGURE_TMRC, 3); + insertInCommandAndReplyMap(RM3100::READ_TMRC, 3); - insertInCommandAndReplyMap(RM3100::CONFIGURE_CYCLE_COUNT, 1); - insertInCommandAndReplyMap(RM3100::READ_CYCLE_COUNT, 1); + insertInCommandAndReplyMap(RM3100::CONFIGURE_CYCLE_COUNT, 3); + insertInCommandAndReplyMap(RM3100::READ_CYCLE_COUNT, 3); - insertInCommandAndReplyMap(RM3100::READ_DATA, 1, &primaryDataset); + insertInCommandAndReplyMap(RM3100::READ_DATA, 3, &primaryDataset); } void MGMHandlerRM3100::modeChanged(void) { @@ -328,6 +328,12 @@ uint32_t MGMHandlerRM3100::getTransitionDelayMs(Mode_t from, Mode_t to) { return 10000; } +ReturnValue_t MGMHandlerRM3100::getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) { + *switches = &switchId; + *numberOfSwitches = 1; + return HasReturnvaluesIF::RETURN_OK; +} + ReturnValue_t MGMHandlerRM3100::handleDataReadout(const uint8_t *packet) { /* Analyze data here. The sensor generates 24 bit signed values so we need to do some bitshift * trickery here to calculate the raw values first */ @@ -345,9 +351,9 @@ ReturnValue_t MGMHandlerRM3100::handleDataReadout(const uint8_t *packet) { sif::info << "MGMHandlerRM3100: Magnetic field strength in" " microtesla:" << std::endl; /* Set terminal to utf-8 if there is an issue with micro printout. */ - sif::info << "X: " << fieldStrengthX << " \xC2\xB5T" << std::endl; - sif::info << "Y: " << fieldStrengthY << " \xC2\xB5T" << std::endl; - sif::info << "Z: " << fieldStrengthZ << " \xC2\xB5T" << std::endl; + sif::info << "X: " << fieldStrengthX << " uT" << std::endl; + sif::info << "Y: " << fieldStrengthY << " uT" << std::endl; + sif::info << "Z: " << fieldStrengthZ << " uT" << std::endl; } #endif diff --git a/mission/devices/MGMHandlerRM3100.h b/mission/devices/MGMHandlerRM3100.h index 48173e65..a499c568 100644 --- a/mission/devices/MGMHandlerRM3100.h +++ b/mission/devices/MGMHandlerRM3100.h @@ -2,6 +2,7 @@ #define MISSION_DEVICES_MGMRM3100HANDLER_H_ #include "OBSWConfig.h" +#include "devices/powerSwitcherList.h" #include "devicedefinitions/MGMHandlerRM3100Definitions.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h" @@ -31,7 +32,7 @@ public: SUBSYSTEM_ID::MGM_RM3100, 0x01, severity::INFO); MGMHandlerRM3100(object_id_t objectId, object_id_t deviceCommunication, - CookieIF* comCookie); + CookieIF* comCookie, uint8_t switchId); virtual ~MGMHandlerRM3100(); protected: @@ -50,6 +51,8 @@ protected: DeviceCommandId_t *foundId, size_t *foundLen) override; ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override; + ReturnValue_t getSwitches(const uint8_t **switches, + uint8_t *numberOfSwitches) override; void fillCommandAndReplyMap() override; void modeChanged(void) override; @@ -87,6 +90,8 @@ private: float scaleFactorY = 1 / RM3100::DEFAULT_GAIN; float scaleFactorZ = 1 / RM3100::DEFAULT_GAIN; + uint8_t switchId; + ReturnValue_t handleCycleCountConfigCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,size_t commandDataLen); ReturnValue_t handleCycleCommand(bool oneCycleValue, diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index ba0e8667..fe7294ea 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -93,7 +93,7 @@ void PCDUHandler::initializeSwitchStates() { switchStates[pcduSwitches::SUS_NOMINAL] = pcduSwitches::INIT_STATE_SUS_NOMINAL; switchStates[pcduSwitches::SOLAR_CELL_EXP] = pcduSwitches::INIT_STATE_SOLAR_CELL_EXP; switchStates[pcduSwitches::PLOC] = pcduSwitches::INIT_STATE_PLOC; - switchStates[pcduSwitches::ACS_BORAD_SIDE_A] = pcduSwitches::INIT_STATE_ACS_BOARD_SIDE_A; + switchStates[pcduSwitches::ACS_BOARD_SIDE_A] = pcduSwitches::INIT_STATE_ACS_BOARD_SIDE_A; } void PCDUHandler::readCommandQueue() { @@ -186,7 +186,7 @@ void PCDUHandler::updatePdu1SwitchStates() { switchStates[pcduSwitches::SUS_NOMINAL] = pdu1HkTableDataset.voltageOutSUSNominal.value; switchStates[pcduSwitches::SOLAR_CELL_EXP] = pdu1HkTableDataset.voltageOutSolarCellExp.value; switchStates[pcduSwitches::PLOC] = pdu1HkTableDataset.voltageOutPLOC.value; - switchStates[pcduSwitches::ACS_BORAD_SIDE_A] = pdu1HkTableDataset.voltageOutACSBoardSideA.value; + switchStates[pcduSwitches::ACS_BOARD_SIDE_A] = pdu1HkTableDataset.voltageOutACSBoardSideA.value; } else { sif::debug << "PCDUHandler::updatePdu1SwitchStates: Failed to read dataset" << std::endl; diff --git a/tmtc b/tmtc index 90f85b7d..d9968031 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 90f85b7dae63e93a3c5686fab9dd0d4a8147e96b +Subproject commit d9968031d641249ca0ad62e7c1c19ed22390078c -- 2.43.0 From 10f5933c1e9910faf49246470bf13d0433b1ff41 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 13 Sep 2021 18:10:24 +0200 Subject: [PATCH 048/102] enable pins --- linux/boardtest/SpiTestClass.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index ee08bc41..a5a773d1 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -24,7 +24,7 @@ gpioIF(gpioIF) { if(gpioIF == nullptr) { sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl; } - testMode = TestModes::GYRO_L3GD20H; + testMode = TestModes::MGM_RM3100; spiTransferStruct.rx_buf = reinterpret_cast<__u64>(recvBuffer.data()); spiTransferStruct.tx_buf = reinterpret_cast<__u64>(sendBuffer.data()); } @@ -355,6 +355,14 @@ void SpiTestClass::acsInit() { gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, gyro3L3gd20ChipSelect, "GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); + + // Enable pins must be pulled low for regular operations + gpio = new GpiodRegular(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE, + "GYRO_0_ENABLE", gpio::OUT, gpio::LOW); + gpioCookie->addGpio(gpioIds::GYRO_0_ENABLE, gpio); + gpio = new GpiodRegular(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE, + "GYRO_2_ENABLE", gpio::OUT, gpio::LOW); + gpioCookie->addGpio(gpioIds::GYRO_2_ENABLE, gpio); #endif if(gpioIF != nullptr) { gpioIF->addGpios(gpioCookie); -- 2.43.0 From ca79f370b00394676797bdaca609501f4c581c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Teichr=C3=B6b?= Date: Tue, 14 Sep 2021 12:30:46 +0200 Subject: [PATCH 049/102] Fixed bugs in mag. field scaling math. --- mission/devices/MGMHandlerLIS3MDL.cpp | 18 ++++++++---------- .../MGMHandlerLIS3Definitions.h | 2 ++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mission/devices/MGMHandlerLIS3MDL.cpp b/mission/devices/MGMHandlerLIS3MDL.cpp index 85cb3407..54cf55c9 100644 --- a/mission/devices/MGMHandlerLIS3MDL.cpp +++ b/mission/devices/MGMHandlerLIS3MDL.cpp @@ -346,24 +346,22 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, } uint8_t MGMHandlerLIS3MDL::getFullScale(uint8_t ctrlRegister2) { - bool FS0 = false; - bool FS1 = false; - if ((ctrlRegister2 >> 5) == 1) - FS0 = true; - if ((ctrlRegister2 >> 6) == 1) - FS1 = true; - if ((FS0 == true) && (FS1 == true)) + uint8_t getFullScale(uint8_t ctrlRegister2) { + bool FS0_set = ctrlRegister2 & (1 << MGMLIS3MDL::FSO); // Checks if FS0 bit is set + bool FS1_set = ctrlRegister2 & (1 << MGMLIS3MDL::FS1); // Checks if FS1 bit is set + + if (FS0_set && FS1_set) return 16; - else if ((FS0 == false) && (FS1 == true)) + else if (!FS0_set && FS1_set) return 12; - else if ((FS0 == true) && (FS1 == false)) + else if (FS0_set && !FS1_set) return 8; else return 4; } float MGMHandlerLIS3MDL::getSensitivityFactor(uint8_t scale) { - return (float) scale / (INT16_MAX); + return (float)scale / (float)MGMLIS3MDL::FIELD_LSB_PER_GAUSS; } diff --git a/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h b/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h index c15b60ef..a0ebb33a 100644 --- a/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h +++ b/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h @@ -18,7 +18,9 @@ enum opMode { /* Actually 15, we just round up a bit */ static constexpr size_t MAX_BUFFER_SIZE = 16; +/* Field data register scaling */ static constexpr uint8_t GAUSS_TO_MICROTESLA_FACTOR = 100; +static constexpr uint16_t FIELD_LSB_PER_GAUSS = 27368; static const DeviceCommandId_t READ_CONFIG_AND_DATA = 0x00; static const DeviceCommandId_t SETUP_MGM = 0x01; -- 2.43.0 From 43fe7e0aa072747e876044b9f88b50993523cf20 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 14 Sep 2021 13:55:56 +0200 Subject: [PATCH 050/102] using enum for sensitivity now --- mission/devices/MGMHandlerLIS3MDL.cpp | 46 ++++++++++++------- mission/devices/MGMHandlerLIS3MDL.h | 12 ++--- .../MGMHandlerLIS3Definitions.h | 16 +++++-- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/mission/devices/MGMHandlerLIS3MDL.cpp b/mission/devices/MGMHandlerLIS3MDL.cpp index 54cf55c9..0291d8b0 100644 --- a/mission/devices/MGMHandlerLIS3MDL.cpp +++ b/mission/devices/MGMHandlerLIS3MDL.cpp @@ -269,9 +269,7 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, } case MGMLIS3MDL::READ_CONFIG_AND_DATA: { // TODO: Store configuration in new local datasets. - - uint8_t scale = getFullScale(registers[2]); - float sensitivityFactor = getSensitivityFactor(scale); + float sensitivityFactor = getSensitivityFactor(getSensitivity(registers[2])); int16_t mgmMeasurementRawX = packet[MGMLIS3MDL::X_HIGHBYTE_IDX] << 8 | packet[MGMLIS3MDL::X_LOWBYTE_IDX] ; @@ -345,23 +343,39 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, return RETURN_OK; } -uint8_t MGMHandlerLIS3MDL::getFullScale(uint8_t ctrlRegister2) { - uint8_t getFullScale(uint8_t ctrlRegister2) { - bool FS0_set = ctrlRegister2 & (1 << MGMLIS3MDL::FSO); // Checks if FS0 bit is set - bool FS1_set = ctrlRegister2 & (1 << MGMLIS3MDL::FS1); // Checks if FS1 bit is set +MGMLIS3MDL::Sensitivies MGMHandlerLIS3MDL::getSensitivity(uint8_t ctrlRegister2) { + bool fs0Set = ctrlRegister2 & (1 << MGMLIS3MDL::FSO); // Checks if FS0 bit is set + bool fs1Set = ctrlRegister2 & (1 << MGMLIS3MDL::FS1); // Checks if FS1 bit is set - if (FS0_set && FS1_set) - return 16; - else if (!FS0_set && FS1_set) - return 12; - else if (FS0_set && !FS1_set) - return 8; + if (fs0Set && fs1Set) + return MGMLIS3MDL::Sensitivies::GAUSS_16; + else if (!fs0Set && fs1Set) + return MGMLIS3MDL::Sensitivies::GAUSS_12; + else if (fs0Set && !fs1Set) + return MGMLIS3MDL::Sensitivies::GAUSS_8; else - return 4; + return MGMLIS3MDL::Sensitivies::GAUSS_4; } -float MGMHandlerLIS3MDL::getSensitivityFactor(uint8_t scale) { - return (float)scale / (float)MGMLIS3MDL::FIELD_LSB_PER_GAUSS; +float MGMHandlerLIS3MDL::getSensitivityFactor(MGMLIS3MDL::Sensitivies sens) { + switch(sens) { + case(MGMLIS3MDL::GAUSS_4): { + return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_4_SENS; + } + case(MGMLIS3MDL::GAUSS_8): { + return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_8_SENS; + } + case(MGMLIS3MDL::GAUSS_12): { + return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_12_SENS; + } + case(MGMLIS3MDL::GAUSS_16): { + return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_16_SENS; + } + default: { + // Should never happen + return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_4_SENS; + } + } } diff --git a/mission/devices/MGMHandlerLIS3MDL.h b/mission/devices/MGMHandlerLIS3MDL.h index 5d8364ee..1b7b9c9a 100644 --- a/mission/devices/MGMHandlerLIS3MDL.h +++ b/mission/devices/MGMHandlerLIS3MDL.h @@ -82,18 +82,16 @@ private: * e.g.: +- 4 gauss. See p.25 datasheet. * @return The ReturnValue does not contain the sign of the value */ - uint8_t getFullScale(uint8_t ctrlReg2); + MGMLIS3MDL::Sensitivies getSensitivity(uint8_t ctrlReg2); /** - * The 16 bit value needs to be divided by the full range of a 16bit value - * and then multiplied with the current scale of the MGM. - * This factor returns the factor required to achieve this with - * one multiplication. + * The 16 bit value needs to be multiplied with a sensitivity factor + * which depends on the sensitivity configuration * - * @param scale is the return value of the getFulscale Method + * @param sens Configured sensitivity of the LIS3 device * @return Multiplication factor to get the sensor value from raw data. */ - float getSensitivityFactor(uint8_t scale); + float getSensitivityFactor(MGMLIS3MDL::Sensitivies sens); /** * This Command detects the device ID diff --git a/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h b/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h index a0ebb33a..98d881cf 100644 --- a/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h +++ b/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h @@ -8,19 +8,29 @@ namespace MGMLIS3MDL { -enum set { +enum Set { ON, OFF }; -enum opMode { +enum OpMode { LOW, MEDIUM, HIGH, ULTRA }; +enum Sensitivies: uint8_t { + GAUSS_4 = 4, + GAUSS_8 = 8, + GAUSS_12 = 12, + GAUSS_16 = 16 +}; + /* Actually 15, we just round up a bit */ static constexpr size_t MAX_BUFFER_SIZE = 16; /* Field data register scaling */ static constexpr uint8_t GAUSS_TO_MICROTESLA_FACTOR = 100; -static constexpr uint16_t FIELD_LSB_PER_GAUSS = 27368; +static constexpr float FIELD_LSB_PER_GAUSS_4_SENS = 1.0 / 6842.0; +static constexpr float FIELD_LSB_PER_GAUSS_8_SENS = 1.0 / 3421.0; +static constexpr float FIELD_LSB_PER_GAUSS_12_SENS = 1.0 / 2281.0; +static constexpr float FIELD_LSB_PER_GAUSS_16_SENS = 1.0 / 1711.0; static const DeviceCommandId_t READ_CONFIG_AND_DATA = 0x00; static const DeviceCommandId_t SETUP_MGM = 0x01; -- 2.43.0 From 39acc24535a7d9c5036e1a8e8c45462042e3f0d6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 15 Sep 2021 13:41:13 +0200 Subject: [PATCH 051/102] testing ADIS handler --- linux/boardtest/SpiTestClass.cpp | 2 +- .../pollingSequenceFactory.cpp | 40 +++++++++---------- mission/devices/GyroADIS16507Handler.cpp | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index a5a773d1..21af4a2f 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -24,7 +24,7 @@ gpioIF(gpioIF) { if(gpioIF == nullptr) { sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl; } - testMode = TestModes::MGM_RM3100; + testMode = TestModes::MGM_LIS3MDL; spiTransferStruct.rx_buf = reinterpret_cast<__u64>(recvBuffer.data()); spiTransferStruct.tx_buf = reinterpret_cast<__u64>(sendBuffer.data()); } diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 5f7bfd35..5a12943a 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -436,16 +436,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); // - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); // // thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -469,16 +469,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); diff --git a/mission/devices/GyroADIS16507Handler.cpp b/mission/devices/GyroADIS16507Handler.cpp index c744ff51..6f6fe2a6 100644 --- a/mission/devices/GyroADIS16507Handler.cpp +++ b/mission/devices/GyroADIS16507Handler.cpp @@ -201,7 +201,7 @@ ReturnValue_t GyroADIS16507Handler::interpretDeviceReply(DeviceCommandId_t id, uint16_t readProdId = packet[10] << 8 | packet[11]; if (readProdId != ADIS16507::PROD_ID) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::debug << "GyroADIS16507Handler::interpretDeviceReply: Invalid product ID!" + sif::warning << "GyroADIS16507Handler::interpretDeviceReply: Invalid product ID!" << std::endl; #endif return HasReturnvaluesIF::RETURN_FAILED; -- 2.43.0 From c7d0a9551e12e06042437bdafd2a2823887af64a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 15 Sep 2021 17:26:23 +0200 Subject: [PATCH 052/102] small bugfix for rm3100 --- bsp_q7s/callbacks/rwSpiCallback.cpp | 2 +- bsp_q7s/core/ObjectFactory.cpp | 6 ++- fsfw | 2 +- linux/fsfwconfig/FSFWConfig.h.in | 1 + .../pollingSequenceFactory.cpp | 34 ++++++++--------- mission/devices/GyroADIS16507Handler.cpp | 2 +- mission/devices/MGMHandlerLIS3MDL.cpp | 16 ++++---- mission/devices/MGMHandlerRM3100.cpp | 38 ++++++++----------- .../MGMHandlerRM3100Definitions.h | 2 +- tmtc | 2 +- 10 files changed, 51 insertions(+), 54 deletions(-) diff --git a/bsp_q7s/callbacks/rwSpiCallback.cpp b/bsp_q7s/callbacks/rwSpiCallback.cpp index 70fa3ebe..73516fb4 100644 --- a/bsp_q7s/callbacks/rwSpiCallback.cpp +++ b/bsp_q7s/callbacks/rwSpiCallback.cpp @@ -212,7 +212,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen result = HasReturnvaluesIF::RETURN_OK; } - cookie->assignTransferSize(decodedFrameLen); + cookie->setTransferSize(decodedFrameLen); closeSpi(gpioId, gpioIF, mutex); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index e529fe09..e3a284fc 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -482,8 +482,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, - objects::SPI_COM_IF, spiCookie); + objects::SPI_COM_IF, spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); + //gyroL3gHandler->setGoNormalModeAtStartup(); // Gyro 2 Side B spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, @@ -495,8 +496,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, - objects::SPI_COM_IF, spiCookie); + objects::SPI_COM_IF, spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); + //gyroL3gHandler->setGoNormalModeAtStartup(); resetArgsGnss1.gnss1 = true; resetArgsGnss1.gpioComIF = gpioComIF; diff --git a/fsfw b/fsfw index 97494a84..bdd7d59d 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 97494a84dfd0acb9dc32770ae9d142f80d4bbcfa +Subproject commit bdd7d59d82a0b9290d77844fbcc5be61c61bcbcb diff --git a/linux/fsfwconfig/FSFWConfig.h.in b/linux/fsfwconfig/FSFWConfig.h.in index 7d1521dc..89d8b9a7 100644 --- a/linux/fsfwconfig/FSFWConfig.h.in +++ b/linux/fsfwconfig/FSFWConfig.h.in @@ -74,5 +74,6 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; #define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 #define FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV 0 +#define FSFW_HAL_L3GD20_GYRO_DEBUG 0 #endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 5a12943a..8342b3cb 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -446,7 +446,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // DeviceHandlerIF::SEND_READ); // thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); -// +//// // thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, @@ -469,28 +469,28 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, // DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, // DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, // DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.2, diff --git a/mission/devices/GyroADIS16507Handler.cpp b/mission/devices/GyroADIS16507Handler.cpp index 6f6fe2a6..793aad66 100644 --- a/mission/devices/GyroADIS16507Handler.cpp +++ b/mission/devices/GyroADIS16507Handler.cpp @@ -403,7 +403,7 @@ ReturnValue_t GyroADIS16507Handler::spiSendCallback(SpiComIF *comIf, SpiCookie * cookie->getSpiParameters(spiMode, spiSpeed, nullptr); comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); cookie->assignWriteBuffer(sendData); - cookie->assignTransferSize(2); + cookie->setTransferSize(2); gpioId_t gpioId = cookie->getChipSelectPin(); GpioIF* gpioIF = comIf->getGpioInterface(); diff --git a/mission/devices/MGMHandlerLIS3MDL.cpp b/mission/devices/MGMHandlerLIS3MDL.cpp index 0291d8b0..0e1da93e 100644 --- a/mission/devices/MGMHandlerLIS3MDL.cpp +++ b/mission/devices/MGMHandlerLIS3MDL.cpp @@ -292,14 +292,14 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::info << "MGMHandlerLIS3: Magnetic field strength in" " microtesla:" << std::endl; - sif::info << "X: " << mgmX << " \xC2\xB5T" << std::endl; - sif::info << "Y: " << mgmY << " \xC2\xB5T" << std::endl; - sif::info << "Z: " << mgmZ << " \xC2\xB5T" << std::endl; + sif::info << "X: " << mgmX << " uT" << std::endl; + sif::info << "Y: " << mgmY << " uT" << std::endl; + sif::info << "Z: " << mgmZ << " uT" << std::endl; #else sif::printInfo("MGMHandlerLIS3: Magnetic field strength in microtesla:\n"); - sif::printInfo("X: %f " "\xC2\xB5" "T\n", mgmX); - sif::printInfo("Y: %f " "\xC2\xB5" "T\n", mgmY); - sif::printInfo("Z: %f " "\xC2\xB5" "T\n", mgmZ); + sif::printInfo("X: %f uT\n", mgmX); + sif::printInfo("Y: %f uT\n", mgmY); + sif::printInfo("Z: %f uT\n", mgmZ); #endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ } #endif /* OBSW_VERBOSE_LEVEL >= 1 */ @@ -320,10 +320,10 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, if(debugDivider->check()) { /* Set terminal to utf-8 if there is an issue with micro printout. */ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " \xC2\xB0" << "C" << + sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " C" << std::endl; #else - sif::printInfo("MGMHandlerLIS3: Temperature: %f" "\xC2\xB0" "C\n"); + sif::printInfo("MGMHandlerLIS3: Temperature: %f C\n"); #endif } #endif diff --git a/mission/devices/MGMHandlerRM3100.cpp b/mission/devices/MGMHandlerRM3100.cpp index a4878b95..71c3e524 100644 --- a/mission/devices/MGMHandlerRM3100.cpp +++ b/mission/devices/MGMHandlerRM3100.cpp @@ -63,6 +63,7 @@ void MGMHandlerRM3100::doShutDown() { ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand( DeviceCommandId_t *id) { + size_t commandLen = 0; switch(internalState) { case(InternalState::NONE): case(InternalState::NORMAL): { @@ -77,6 +78,8 @@ ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand( break; } case(InternalState::STATE_CONFIGURE_TMRC): { + commandBuffer[0] = RM3100::TMRC_DEFAULT_VALUE; + commandLen = 1; *id = RM3100::CONFIGURE_TMRC; break; } @@ -85,18 +88,17 @@ ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand( break; } default: - /* Might be a configuration error. */ - sif::debug << "GyroHandler::buildTransitionDeviceCommand: Unknown internal state!" << + // Might be a configuration error + sif::warning << "MGMHandlerRM3100::buildTransitionDeviceCommand: Unknown internal state!" << std::endl; return HasReturnvaluesIF::RETURN_OK; } - return buildCommandFromCommand(*id, nullptr, 0); + return buildCommandFromCommand(*id, commandBuffer, commandLen); } -ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand( - DeviceCommandId_t deviceCommand, const uint8_t *commandData, - size_t commandDataLen) { +ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) { switch(deviceCommand) { case(RM3100::CONFIGURE_CMM): { commandBuffer[0] = RM3100::CMM_REGISTER; @@ -113,8 +115,7 @@ ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand( break; } case(RM3100::CONFIGURE_TMRC): { - return handleTmrcConfigCommand(deviceCommand, commandData, - commandDataLen); + return handleTmrcConfigCommand(deviceCommand, commandData, commandDataLen); } case(RM3100::READ_TMRC): { commandBuffer[0] = RM3100::TMRC_REGISTER | RM3100::READ_MASK; @@ -124,8 +125,7 @@ ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand( break; } case(RM3100::CONFIGURE_CYCLE_COUNT): { - return handleCycleCountConfigCommand(deviceCommand, commandData, - commandDataLen); + return handleCycleCountConfigCommand(deviceCommand, commandData, commandDataLen); } case(RM3100::READ_CYCLE_COUNT): { commandBuffer[0] = RM3100::CYCLE_COUNT_START_REGISTER | RM3100::READ_MASK; @@ -162,8 +162,7 @@ ReturnValue_t MGMHandlerRM3100::scanForReply(const uint8_t *start, return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t MGMHandlerRM3100::interpretDeviceReply( - DeviceCommandId_t id, const uint8_t *packet) { +ReturnValue_t MGMHandlerRM3100::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; switch(id) { case(RM3100::CONFIGURE_CMM): @@ -281,19 +280,14 @@ ReturnValue_t MGMHandlerRM3100::handleCycleCommand(bool oneCycleValue, return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t MGMHandlerRM3100::handleTmrcConfigCommand( - DeviceCommandId_t deviceCommand, const uint8_t *commandData, - size_t commandDataLen) { - if(commandData == nullptr) { - return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; - } - - if(commandDataLen != 1) { +ReturnValue_t MGMHandlerRM3100::handleTmrcConfigCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) { + if(commandData == nullptr or commandDataLen != 1) { return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; } commandBuffer[0] = RM3100::TMRC_REGISTER; - commandBuffer[1] = commandData[1]; + commandBuffer[1] = commandData[0]; rawPacketLen = 2; rawPacket = commandBuffer; return HasReturnvaluesIF::RETURN_OK; @@ -325,7 +319,7 @@ ReturnValue_t MGMHandlerRM3100::initializeLocalDataPool( } uint32_t MGMHandlerRM3100::getTransitionDelayMs(Mode_t from, Mode_t to) { - return 10000; + return 25000; } ReturnValue_t MGMHandlerRM3100::getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) { diff --git a/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h b/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h index 08f80dd9..4f00bba9 100644 --- a/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h +++ b/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h @@ -45,7 +45,7 @@ static constexpr uint8_t TMRC_75HZ_VALUE = 0x95; static constexpr uint8_t TMRC_DEFAULT_37HZ_VALUE = 0x96; static constexpr uint8_t TMRC_REGISTER = 0x0B; -static constexpr uint8_t TMRC_DEFAULT_VALUE = TMRC_DEFAULT_37HZ_VALUE; +static constexpr uint8_t TMRC_DEFAULT_VALUE = TMRC_75HZ_VALUE; static constexpr uint8_t MEASUREMENT_REG_START = 0x24; static constexpr uint8_t BIST_REGISTER = 0x33; diff --git a/tmtc b/tmtc index d9968031..dff569e9 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit d9968031d641249ca0ad62e7c1c19ed22390078c +Subproject commit dff569e93ff3cb5e62627c89cfa2229f464c76de -- 2.43.0 From df5b0a19de3c047a8c832e11071d5462d3bc4119 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 15 Sep 2021 17:38:26 +0200 Subject: [PATCH 053/102] improved preprocessor defines --- bsp_q7s/boardconfig/q7sConfig.h.in | 5 --- bsp_q7s/core/InitMission.cpp | 4 +- bsp_q7s/core/ObjectFactory.cpp | 6 +-- linux/boardtest/SpiTestClass.cpp | 2 +- linux/fsfwconfig/OBSWConfig.h.in | 4 +- .../pollingSequenceFactory.cpp | 40 +++++++++---------- 6 files changed, 29 insertions(+), 32 deletions(-) diff --git a/bsp_q7s/boardconfig/q7sConfig.h.in b/bsp_q7s/boardconfig/q7sConfig.h.in index 0eb4f759..40b5a510 100644 --- a/bsp_q7s/boardconfig/q7sConfig.h.in +++ b/bsp_q7s/boardconfig/q7sConfig.h.in @@ -30,11 +30,6 @@ #define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1 #define Q7S_ADD_RTD_DEVICES 0 -// Only one of those 2 should be enabled! -#if OBSW_ADD_ACS_BOARD == 0 -#define Q7S_ADD_SPI_TEST 0 -#endif - #define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0 namespace config { diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 49e9d8ca..5ddb6b9b 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -167,7 +167,7 @@ void initmission::createPstTasks(TaskFactory& factory, ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; #if BOARD_TE0720 == 0 /* Polling Sequence Table Default */ -#if Q7S_ADD_SPI_TEST == 0 +#if OBSW_ADD_SPI_TEST_CODE == 0 FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask( "PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc); @@ -297,7 +297,7 @@ void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFuncti initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK); } -#if Q7S_ADD_SPI_TEST == 1 +#if OBSW_ADD_SPI_TEST_CODE == 1 result = testTask->addComponent(objects::SPI_TEST); if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index e3a284fc..d8b34aac 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -229,9 +229,9 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF, new CspComIF(objects::CSP_COM_IF); new I2cComIF(objects::I2C_COM_IF); *uartComIF = new UartComIF(objects::UART_COM_IF); -#if Q7S_ADD_SPI_TEST == 0 +#if OBSW_ADD_SPI_TEST_CODE == 0 *spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF); -#endif /* Q7S_ADD_SPI_TEST == 0 */ +#endif /* Q7S_ADD_SPI_TEST_CODE == 0 */ #if BOARD_TE0720 == 0 /* Adding gpios for chip select decoding to the gpioComIf */ @@ -903,7 +903,7 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { plocSupervisor->setStartUpImmediately(); #endif -#if Q7S_ADD_SPI_TEST == 1 +#if OBSW_ADD_SPI_TEST_CODE == 1 new SpiTestClass(objects::SPI_TEST, gpioComIF); #endif diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 21af4a2f..a5a773d1 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -24,7 +24,7 @@ gpioIF(gpioIF) { if(gpioIF == nullptr) { sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl; } - testMode = TestModes::MGM_LIS3MDL; + testMode = TestModes::MGM_RM3100; spiTransferStruct.rx_buf = reinterpret_cast<__u64>(recvBuffer.data()); spiTransferStruct.tx_buf = reinterpret_cast<__u64>(sendBuffer.data()); } diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 5db0243c..dc397635 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -47,7 +47,9 @@ debugging. */ //! /* Can be used to switch device to NORMAL mode immediately */ #define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1 #define OBSW_PRINT_MISSED_DEADLINES 1 -#define OBSW_ADD_TEST_CODE 0 +// If this is enabled, all other SPI code should be disabled +#define OBSW_ADD_TEST_CODE 1 +#define OBSW_ADD_SPI_TEST_CODE 0 #define OBSW_ADD_TEST_PST 0 #define OBSW_ADD_TEST_TASK 0 #define OBSW_TEST_LIBGPIOD 0 diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 8342b3cb..0074ecec 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -458,16 +458,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); // -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -480,16 +480,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); -- 2.43.0 From 2630d7fae7e74a7c526b64676c6241436a998710 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 15 Sep 2021 17:49:15 +0200 Subject: [PATCH 054/102] tweak for rm3100 --- mission/devices/MGMHandlerRM3100.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/mission/devices/MGMHandlerRM3100.cpp b/mission/devices/MGMHandlerRM3100.cpp index 71c3e524..ccbf05c8 100644 --- a/mission/devices/MGMHandlerRM3100.cpp +++ b/mission/devices/MGMHandlerRM3100.cpp @@ -288,6 +288,7 @@ ReturnValue_t MGMHandlerRM3100::handleTmrcConfigCommand(DeviceCommandId_t device commandBuffer[0] = RM3100::TMRC_REGISTER; commandBuffer[1] = commandData[0]; + tmrcRegValue = commandData[0]; rawPacketLen = 2; rawPacket = commandBuffer; return HasReturnvaluesIF::RETURN_OK; -- 2.43.0 From bdd5a7dd2161fcfefd774e7a960c0899c8648c50 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 15 Sep 2021 18:50:23 +0200 Subject: [PATCH 055/102] more storage for events --- common/config/devConf.h | 4 +- fsfw | 2 +- linux/boardtest/SpiTestClass.cpp | 2 +- .../pollingSequenceFactory.cpp | 106 +++++++++--------- mission/core/GenericFactory.cpp | 8 +- tmtc | 2 +- 6 files changed, 62 insertions(+), 62 deletions(-) diff --git a/common/config/devConf.h b/common/config/devConf.h index 7f3094fa..41126fdd 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -11,13 +11,13 @@ namespace spi { /* Default values, changing them is not supported for now */ -static constexpr uint32_t DEFAULT_LIS3_SPEED = 3'900'000; +static constexpr uint32_t DEFAULT_LIS3_SPEED = 976'000; static constexpr spi::SpiModes DEFAULT_LIS3_MODE = spi::SpiModes::MODE_3; static constexpr uint32_t DEFAULT_RM3100_SPEED = 976'000; static constexpr spi::SpiModes DEFAULT_RM3100_MODE = spi::SpiModes::MODE_3; -static constexpr uint32_t DEFAULT_L3G_SPEED = 3'900'000; +static constexpr uint32_t DEFAULT_L3G_SPEED = 976'000; static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3; static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000; diff --git a/fsfw b/fsfw index bdd7d59d..bc6b29e6 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit bdd7d59d82a0b9290d77844fbcc5be61c61bcbcb +Subproject commit bc6b29e652a90f5a14bb32a1bcc2a956e410e678 diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index a5a773d1..08d7c14c 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -113,7 +113,7 @@ void SpiTestClass::performRm3100Test(uint8_t mgmId) { sif::info << "Cycle count Y: " << cycleCountY << std::endl; sif::info << "Cycle count z: " << cycleCountZ << std::endl; - writeRegister(fileDescriptor, currentGpioId, 0x0B, 0x95); + writeRegister(fileDescriptor, currentGpioId, 0x0B, 0x96); uint8_t tmrcReg = readRm3100Register(fileDescriptor, currentGpioId, 0x0B); sif::info << "SpiTestClass::performRm3100Test: TMRC register value: " << std::hex << "0x" << static_cast(tmrcReg) << std::dec << std::endl; diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 0074ecec..f45f5f32 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -425,39 +425,39 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); #if OBSW_ADD_ACS_BOARD == 1 -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); -// -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); -//// -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); -// + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, @@ -480,16 +480,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -502,16 +502,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); #endif /* OBSW_ADD_ACS_BOARD == 1 */ if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index cc1b88e5..4ee1ff70 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -36,22 +36,22 @@ void ObjectFactory::produceGenericObjects() { { PoolManager::LocalPoolConfig poolCfg = { - {100, 16}, {50, 32}, {25, 64}, {15, 128}, {10, 1024}, {5, 2048} + {300, 16}, {300, 32}, {200, 64}, {200, 128}, {100, 1024}, {10, 2048} }; new PoolManager(objects::TC_STORE, poolCfg); } { PoolManager::LocalPoolConfig poolCfg = { - {100, 16}, {50, 32}, {25, 64}, {15, 128}, {10, 1024}, {5, 2048} + {300, 16}, {300, 32}, {100, 64}, {100, 128}, {100, 1024}, {10, 2048} }; new PoolManager(objects::TM_STORE, poolCfg); } { PoolManager::LocalPoolConfig poolCfg = { - { 100, 16 }, { 100, 32 }, { 100, 64 }, - { 100, 128 }, { 50, 256 }, { 50, 512 }, { 50, 1024 }, { 10, 2048 } + { 300, 16 }, { 200, 32 }, { 150, 64 }, + { 150, 128 }, { 100, 256 }, { 50, 512 }, { 50, 1024 }, { 10, 2048 } }; new PoolManager(objects::IPC_STORE, poolCfg); } diff --git a/tmtc b/tmtc index dff569e9..b3bc1fe2 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit dff569e93ff3cb5e62627c89cfa2229f464c76de +Subproject commit b3bc1fe28c73d51f0b8319cf67705807596e5518 -- 2.43.0 From 8af3a91b5a5f588d30e0aff74b2bbae2ee06329b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 11:11:25 +0200 Subject: [PATCH 056/102] correct RW pin --- bsp_q7s/boardconfig/busConf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index 491930db..257883cd 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -80,7 +80,8 @@ static constexpr uint32_t GPIO_SOL_DEPL_SA_0_PIN = 4; static constexpr uint32_t GPIO_SOL_DEPL_SA_1_PIN = 2; static constexpr char GPIO_RW_SPI_MUX_CHIP[] = "gpiochip11"; -static constexpr uint32_t GPIO_RW_SPI_MUX_CS = 57; +// Uses EMIO interface to PL, starts at 54 +static constexpr uint32_t GPIO_RW_SPI_MUX_CS = 54; } -- 2.43.0 From 799e90f617a03b42fdc7be1ac33b22107c78e3be Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 11:15:14 +0200 Subject: [PATCH 057/102] reverted some change --- mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h b/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h index 4f00bba9..08f80dd9 100644 --- a/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h +++ b/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h @@ -45,7 +45,7 @@ static constexpr uint8_t TMRC_75HZ_VALUE = 0x95; static constexpr uint8_t TMRC_DEFAULT_37HZ_VALUE = 0x96; static constexpr uint8_t TMRC_REGISTER = 0x0B; -static constexpr uint8_t TMRC_DEFAULT_VALUE = TMRC_75HZ_VALUE; +static constexpr uint8_t TMRC_DEFAULT_VALUE = TMRC_DEFAULT_37HZ_VALUE; static constexpr uint8_t MEASUREMENT_REG_START = 0x24; static constexpr uint8_t BIST_REGISTER = 0x33; -- 2.43.0 From b8b6cd8872d55e708dcc4d567e2b54643423cc1c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 11:34:07 +0200 Subject: [PATCH 058/102] moved RM3100 handler to framework --- bsp_q7s/core/ObjectFactory.cpp | 6 +- fsfw | 2 +- mission/devices/CMakeLists.txt | 1 - mission/devices/MGMHandlerRM3100.cpp | 364 ------------------ mission/devices/MGMHandlerRM3100.h | 109 ------ .../MGMHandlerRM3100Definitions.h | 132 ------- 6 files changed, 4 insertions(+), 610 deletions(-) delete mode 100644 mission/devices/MGMHandlerRM3100.cpp delete mode 100644 mission/devices/MGMHandlerRM3100.h delete mode 100644 mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index d8b34aac..bdad3dac 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -37,7 +37,6 @@ #include "mission/devices/IMTQHandler.h" #include "mission/devices/SyrlinksHkHandler.h" #include "mission/devices/MGMHandlerLIS3MDL.h" -#include "mission/devices/MGMHandlerRM3100.h" #include "mission/devices/PlocMPSoCHandler.h" #include "mission/devices/RadiationSensorHandler.h" #include "mission/devices/RwHandler.h" @@ -55,6 +54,7 @@ #include "fsfw_hal/linux/uart/UartComIF.h" #include "fsfw_hal/linux/uart/UartCookie.h" #include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h" +#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h" #include "fsfw_hal/linux/i2c/I2cCookie.h" #include "fsfw_hal/linux/i2c/I2cComIF.h" #include "fsfw_hal/linux/spi/SpiCookie.h" @@ -454,7 +454,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); - auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER, + auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_A); mgmRm3100Handler->setStartUpImmediately(); @@ -466,7 +466,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); - mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_3_RM3100_HANDLER, + mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_B); mgmRm3100Handler->setStartUpImmediately(); diff --git a/fsfw b/fsfw index bc6b29e6..823c6ec5 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit bc6b29e652a90f5a14bb32a1bcc2a956e410e678 +Subproject commit 823c6ec5fc6357d342f4d0e3edc68d89ff492b87 diff --git a/mission/devices/CMakeLists.txt b/mission/devices/CMakeLists.txt index 4ed60dfd..b5a1e20f 100644 --- a/mission/devices/CMakeLists.txt +++ b/mission/devices/CMakeLists.txt @@ -1,7 +1,6 @@ target_sources(${TARGET_NAME} PUBLIC GPSHyperionHandler.cpp MGMHandlerLIS3MDL.cpp - MGMHandlerRM3100.cpp GomspaceDeviceHandler.cpp Tmp1075Handler.cpp PCDUHandler.cpp diff --git a/mission/devices/MGMHandlerRM3100.cpp b/mission/devices/MGMHandlerRM3100.cpp deleted file mode 100644 index ccbf05c8..00000000 --- a/mission/devices/MGMHandlerRM3100.cpp +++ /dev/null @@ -1,364 +0,0 @@ -#include "MGMHandlerRM3100.h" - -#include "fsfw/datapool/PoolReadGuard.h" -#include "fsfw/globalfunctions/bitutility.h" -#include "fsfw/devicehandlers/DeviceHandlerMessage.h" -#include "fsfw/objectmanager/SystemObjectIF.h" -#include "fsfw/returnvalues/HasReturnvaluesIF.h" - - -MGMHandlerRM3100::MGMHandlerRM3100(object_id_t objectId, - object_id_t deviceCommunication, CookieIF* comCookie, uint8_t switchId): - DeviceHandlerBase(objectId, deviceCommunication, comCookie), - primaryDataset(this), switchId(switchId) { -#if OBSW_VERBOSE_LEVEL >= 1 - debugDivider = new PeriodicOperationDivider(5); -#endif -} - -MGMHandlerRM3100::~MGMHandlerRM3100() {} - -void MGMHandlerRM3100::doStartUp() { - switch(internalState) { - case(InternalState::NONE): { - internalState = InternalState::CONFIGURE_CMM; - break; - } - case(InternalState::CONFIGURE_CMM): { - internalState = InternalState::READ_CMM; - break; - } - case(InternalState::READ_CMM): { - if(commandExecuted) { - internalState = InternalState::STATE_CONFIGURE_TMRC; - } - break; - } - case(InternalState::STATE_CONFIGURE_TMRC): { - if(commandExecuted) { - internalState = InternalState::STATE_READ_TMRC; - } - break; - } - case(InternalState::STATE_READ_TMRC): { - if(commandExecuted) { - internalState = InternalState::NORMAL; -#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1 - setMode(MODE_NORMAL); -#else - setMode(_MODE_TO_ON); -#endif - } - break; - } - default: { - break; - } - } -} - -void MGMHandlerRM3100::doShutDown() { - setMode(_MODE_POWER_DOWN); -} - -ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand( - DeviceCommandId_t *id) { - size_t commandLen = 0; - switch(internalState) { - case(InternalState::NONE): - case(InternalState::NORMAL): { - return HasReturnvaluesIF::RETURN_OK; - } - case(InternalState::CONFIGURE_CMM): { - *id = RM3100::CONFIGURE_CMM; - break; - } - case(InternalState::READ_CMM): { - *id = RM3100::READ_CMM; - break; - } - case(InternalState::STATE_CONFIGURE_TMRC): { - commandBuffer[0] = RM3100::TMRC_DEFAULT_VALUE; - commandLen = 1; - *id = RM3100::CONFIGURE_TMRC; - break; - } - case(InternalState::STATE_READ_TMRC): { - *id = RM3100::READ_TMRC; - break; - } - default: - // Might be a configuration error - sif::warning << "MGMHandlerRM3100::buildTransitionDeviceCommand: Unknown internal state!" << - std::endl; - return HasReturnvaluesIF::RETURN_OK; - } - - return buildCommandFromCommand(*id, commandBuffer, commandLen); -} - -ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand(DeviceCommandId_t deviceCommand, - const uint8_t *commandData, size_t commandDataLen) { - switch(deviceCommand) { - case(RM3100::CONFIGURE_CMM): { - commandBuffer[0] = RM3100::CMM_REGISTER; - commandBuffer[1] = RM3100::CMM_VALUE; - rawPacket = commandBuffer; - rawPacketLen = 2; - break; - } - case(RM3100::READ_CMM): { - commandBuffer[0] = RM3100::CMM_REGISTER | RM3100::READ_MASK; - commandBuffer[1] = 0; - rawPacket = commandBuffer; - rawPacketLen = 2; - break; - } - case(RM3100::CONFIGURE_TMRC): { - return handleTmrcConfigCommand(deviceCommand, commandData, commandDataLen); - } - case(RM3100::READ_TMRC): { - commandBuffer[0] = RM3100::TMRC_REGISTER | RM3100::READ_MASK; - commandBuffer[1] = 0; - rawPacket = commandBuffer; - rawPacketLen = 2; - break; - } - case(RM3100::CONFIGURE_CYCLE_COUNT): { - return handleCycleCountConfigCommand(deviceCommand, commandData, commandDataLen); - } - case(RM3100::READ_CYCLE_COUNT): { - commandBuffer[0] = RM3100::CYCLE_COUNT_START_REGISTER | RM3100::READ_MASK; - std::memset(commandBuffer + 1, 0, 6); - rawPacket = commandBuffer; - rawPacketLen = 7; - break; - } - case(RM3100::READ_DATA): { - commandBuffer[0] = RM3100::MEASUREMENT_REG_START | RM3100::READ_MASK; - std::memset(commandBuffer + 1, 0, 9); - rawPacketLen = 10; - break; - } - default: - return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; - } - return RETURN_OK; -} - -ReturnValue_t MGMHandlerRM3100::buildNormalDeviceCommand( - DeviceCommandId_t *id) { - *id = RM3100::READ_DATA; - return buildCommandFromCommand(*id, nullptr, 0); -} - -ReturnValue_t MGMHandlerRM3100::scanForReply(const uint8_t *start, - size_t len, DeviceCommandId_t *foundId, - size_t *foundLen) { - - /* For SPI, ID will always be the one of the last sent command. */ - *foundId = this->getPendingCommand(); - *foundLen = len; - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t MGMHandlerRM3100::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { - ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; - switch(id) { - case(RM3100::CONFIGURE_CMM): - case(RM3100::CONFIGURE_CYCLE_COUNT): - case(RM3100::CONFIGURE_TMRC): { - /* We can only check whether write was successful with read operation. */ - if(mode == _MODE_START_UP) { - commandExecuted = true; - } - break; - } - case(RM3100::READ_CMM): { - uint8_t cmmValue = packet[1]; - /* We clear the seventh bit in any case - * because this one is zero sometimes for some reason */ - bitutil::bitClear(&cmmValue, 6); - if(cmmValue == cmmRegValue and internalState == InternalState::READ_CMM) { - commandExecuted = true; - } - else { - /* Attempt reconfiguration. */ - internalState = InternalState::CONFIGURE_CMM; - return DeviceHandlerIF::DEVICE_REPLY_INVALID; - } - break; - } - case(RM3100::READ_TMRC): { - if(packet[1] == tmrcRegValue) { - commandExecuted = true; - /* Reading TMRC was commanded. Trigger event to inform ground. */ - if(mode != _MODE_START_UP) { - triggerEvent(tmrcSet, tmrcRegValue, 0); - } - } - else { - /* Attempt reconfiguration. */ - internalState = InternalState::STATE_CONFIGURE_TMRC; - return DeviceHandlerIF::DEVICE_REPLY_INVALID; - } - break; - } - case(RM3100::READ_CYCLE_COUNT): { - uint16_t cycleCountX = packet[1] << 8 | packet[2]; - uint16_t cycleCountY = packet[3] << 8 | packet[4]; - uint16_t cycleCountZ = packet[5] << 8 | packet[6]; - if(cycleCountX != cycleCountRegValueX or cycleCountY != cycleCountRegValueY or - cycleCountZ != cycleCountRegValueZ) { - return DeviceHandlerIF::DEVICE_REPLY_INVALID; - } - /* Reading TMRC was commanded. Trigger event to inform ground. */ - if(mode != _MODE_START_UP) { - uint32_t eventParam1 = (cycleCountX << 16) | cycleCountY; - triggerEvent(cycleCountersSet, eventParam1, cycleCountZ); - } - break; - } - case(RM3100::READ_DATA): { - result = handleDataReadout(packet); - break; - } - default: - return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY; - } - - return result; -} - -ReturnValue_t MGMHandlerRM3100::handleCycleCountConfigCommand(DeviceCommandId_t deviceCommand, - const uint8_t *commandData, size_t commandDataLen) { - if(commandData == nullptr) { - return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; - } - - // Set cycle count - if(commandDataLen == 2) { - handleCycleCommand(true, commandData, commandDataLen); - } - else if(commandDataLen == 6) { - handleCycleCommand(false, commandData, commandDataLen); - } - else { - return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; - } - - commandBuffer[0] = RM3100::CYCLE_COUNT_VALUE; - std::memcpy(commandBuffer + 1, &cycleCountRegValueX, 2); - std::memcpy(commandBuffer + 3, &cycleCountRegValueY, 2); - std::memcpy(commandBuffer + 5, &cycleCountRegValueZ, 2); - rawPacketLen = 7; - rawPacket = commandBuffer; - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t MGMHandlerRM3100::handleCycleCommand(bool oneCycleValue, - const uint8_t *commandData, size_t commandDataLen) { - RM3100::CycleCountCommand command(oneCycleValue); - ReturnValue_t result = command.deSerialize(&commandData, &commandDataLen, - SerializeIF::Endianness::BIG); - if(result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - - /* Data sheet p.30 "while noise limits the useful upper range to ~400 cycle counts." */ - if(command.cycleCountX > 450 ) { - return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; - } - - if(not oneCycleValue and (command.cycleCountY > 450 or command.cycleCountZ > 450)) { - return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; - } - - cycleCountRegValueX = command.cycleCountX; - cycleCountRegValueY = command.cycleCountY; - cycleCountRegValueZ = command.cycleCountZ; - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t MGMHandlerRM3100::handleTmrcConfigCommand(DeviceCommandId_t deviceCommand, - const uint8_t *commandData, size_t commandDataLen) { - if(commandData == nullptr or commandDataLen != 1) { - return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; - } - - commandBuffer[0] = RM3100::TMRC_REGISTER; - commandBuffer[1] = commandData[0]; - tmrcRegValue = commandData[0]; - rawPacketLen = 2; - rawPacket = commandBuffer; - return HasReturnvaluesIF::RETURN_OK; -} - -void MGMHandlerRM3100::fillCommandAndReplyMap() { - insertInCommandAndReplyMap(RM3100::CONFIGURE_CMM, 3); - insertInCommandAndReplyMap(RM3100::READ_CMM, 3); - - insertInCommandAndReplyMap(RM3100::CONFIGURE_TMRC, 3); - insertInCommandAndReplyMap(RM3100::READ_TMRC, 3); - - insertInCommandAndReplyMap(RM3100::CONFIGURE_CYCLE_COUNT, 3); - insertInCommandAndReplyMap(RM3100::READ_CYCLE_COUNT, 3); - - insertInCommandAndReplyMap(RM3100::READ_DATA, 3, &primaryDataset); -} - -void MGMHandlerRM3100::modeChanged(void) { - internalState = InternalState::NONE; -} - -ReturnValue_t MGMHandlerRM3100::initializeLocalDataPool( - localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { - localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_X, new PoolEntry({0.0})); - localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Y, new PoolEntry({0.0})); - localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Z, new PoolEntry({0.0})); - return HasReturnvaluesIF::RETURN_OK; -} - -uint32_t MGMHandlerRM3100::getTransitionDelayMs(Mode_t from, Mode_t to) { - return 25000; -} - -ReturnValue_t MGMHandlerRM3100::getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) { - *switches = &switchId; - *numberOfSwitches = 1; - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t MGMHandlerRM3100::handleDataReadout(const uint8_t *packet) { - /* Analyze data here. The sensor generates 24 bit signed values so we need to do some bitshift - * trickery here to calculate the raw values first */ - int32_t fieldStrengthRawX = ((packet[1] << 24) | (packet[2] << 16) | (packet[3] << 8)) >> 8; - int32_t fieldStrengthRawY = ((packet[4] << 24) | (packet[5] << 16) | (packet[6] << 8)) >> 8; - int32_t fieldStrengthRawZ = ((packet[7] << 24) | (packet[8] << 16) | (packet[3] << 8)) >> 8; - - /* Now scale to physical value in microtesla */ - float fieldStrengthX = fieldStrengthRawX * scaleFactorX; - float fieldStrengthY = fieldStrengthRawY * scaleFactorX; - float fieldStrengthZ = fieldStrengthRawZ * scaleFactorX; - -#if OBSW_VERBOSE_LEVEL >= 1 - if(debugDivider->checkAndIncrement()) { - sif::info << "MGMHandlerRM3100: Magnetic field strength in" - " microtesla:" << std::endl; - /* Set terminal to utf-8 if there is an issue with micro printout. */ - sif::info << "X: " << fieldStrengthX << " uT" << std::endl; - sif::info << "Y: " << fieldStrengthY << " uT" << std::endl; - sif::info << "Z: " << fieldStrengthZ << " uT" << std::endl; - } -#endif - - /* TODO: Sanity check on values */ - PoolReadGuard readGuard(&primaryDataset); - if(readGuard.getReadResult() == HasReturnvaluesIF::RETURN_OK) { - primaryDataset.fieldStrengthX = fieldStrengthX; - primaryDataset.fieldStrengthY = fieldStrengthY; - primaryDataset.fieldStrengthZ = fieldStrengthZ; - primaryDataset.setValidity(true, true); - } - return RETURN_OK; -} diff --git a/mission/devices/MGMHandlerRM3100.h b/mission/devices/MGMHandlerRM3100.h deleted file mode 100644 index a499c568..00000000 --- a/mission/devices/MGMHandlerRM3100.h +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef MISSION_DEVICES_MGMRM3100HANDLER_H_ -#define MISSION_DEVICES_MGMRM3100HANDLER_H_ - -#include "OBSWConfig.h" -#include "devices/powerSwitcherList.h" -#include "devicedefinitions/MGMHandlerRM3100Definitions.h" -#include "fsfw/devicehandlers/DeviceHandlerBase.h" - -#if OBSW_VERBOSE_LEVEL >= 1 -#include "fsfw/globalfunctions/PeriodicOperationDivider.h" -#endif - -/** - * @brief Device Handler for the RM3100 geomagnetic magnetometer sensor - * (https://www.pnicorp.com/rm3100/) - * @details - * Flight manual: - * https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/RM3100_MGM - */ -class MGMHandlerRM3100: public DeviceHandlerBase { -public: - static const uint8_t INTERFACE_ID = CLASS_ID::MGM_RM3100; - - //! [EXPORT] : [COMMENT] P1: TMRC value which was set, P2: 0 - static constexpr Event tmrcSet = event::makeEvent(SUBSYSTEM_ID::MGM_RM3100, - 0x00, severity::INFO); - - //! [EXPORT] : [COMMENT] Cycle counter set. P1: First two bytes new Cycle Count X - //! P1: Second two bytes new Cycle Count Y - //! P2: New cycle count Z - static constexpr Event cycleCountersSet = event::makeEvent( - SUBSYSTEM_ID::MGM_RM3100, 0x01, severity::INFO); - - MGMHandlerRM3100(object_id_t objectId, object_id_t deviceCommunication, - CookieIF* comCookie, uint8_t switchId); - virtual ~MGMHandlerRM3100(); - -protected: - - /* DeviceHandlerBase overrides */ - ReturnValue_t buildTransitionDeviceCommand( - DeviceCommandId_t *id) override; - void doStartUp() override; - void doShutDown() override; - ReturnValue_t buildNormalDeviceCommand( - DeviceCommandId_t *id) override; - ReturnValue_t buildCommandFromCommand( - DeviceCommandId_t deviceCommand, const uint8_t *commandData, - size_t commandDataLen) override; - ReturnValue_t scanForReply(const uint8_t *start, size_t len, - DeviceCommandId_t *foundId, size_t *foundLen) override; - ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, - const uint8_t *packet) override; - ReturnValue_t getSwitches(const uint8_t **switches, - uint8_t *numberOfSwitches) override; - - void fillCommandAndReplyMap() override; - void modeChanged(void) override; - uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; - ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, - LocalDataPoolManager &poolManager) override; - -private: - - enum class InternalState { - NONE, - CONFIGURE_CMM, - READ_CMM, - // The cycle count states are propably not going to be used because - // the default cycle count will be used. - STATE_CONFIGURE_CYCLE_COUNT, - STATE_READ_CYCLE_COUNT, - STATE_CONFIGURE_TMRC, - STATE_READ_TMRC, - NORMAL - }; - InternalState internalState = InternalState::NONE; - bool commandExecuted = false; - RM3100::Rm3100PrimaryDataset primaryDataset; - - uint8_t commandBuffer[10]; - uint8_t commandBufferLen = 0; - - uint8_t cmmRegValue = RM3100::CMM_VALUE; - uint8_t tmrcRegValue = RM3100::TMRC_DEFAULT_VALUE; - uint16_t cycleCountRegValueX = RM3100::CYCLE_COUNT_VALUE; - uint16_t cycleCountRegValueY = RM3100::CYCLE_COUNT_VALUE; - uint16_t cycleCountRegValueZ = RM3100::CYCLE_COUNT_VALUE; - float scaleFactorX = 1 / RM3100::DEFAULT_GAIN; - float scaleFactorY = 1 / RM3100::DEFAULT_GAIN; - float scaleFactorZ = 1 / RM3100::DEFAULT_GAIN; - - uint8_t switchId; - - ReturnValue_t handleCycleCountConfigCommand(DeviceCommandId_t deviceCommand, - const uint8_t *commandData,size_t commandDataLen); - ReturnValue_t handleCycleCommand(bool oneCycleValue, - const uint8_t *commandData, size_t commandDataLen); - - ReturnValue_t handleTmrcConfigCommand(DeviceCommandId_t deviceCommand, - const uint8_t *commandData,size_t commandDataLen); - - ReturnValue_t handleDataReadout(const uint8_t* packet); -#if OBSW_VERBOSE_LEVEL >= 1 - PeriodicOperationDivider* debugDivider; -#endif -}; - -#endif /* MISSION_DEVICEHANDLING_MGMRM3100HANDLER_H_ */ diff --git a/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h b/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h deleted file mode 100644 index 08f80dd9..00000000 --- a/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERRM3100DEFINITIONS_H_ -#define MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERRM3100DEFINITIONS_H_ - -#include -#include -#include -#include -#include - -namespace RM3100 { - -/* Actually 10, we round up a little bit */ -static constexpr size_t MAX_BUFFER_SIZE = 12; - -static constexpr uint8_t READ_MASK = 0x80; - -/*----------------------------------------------------------------------------*/ -/* CMM Register */ -/*----------------------------------------------------------------------------*/ -static constexpr uint8_t SET_CMM_CMZ = 1 << 6; -static constexpr uint8_t SET_CMM_CMY = 1 << 5; -static constexpr uint8_t SET_CMM_CMX = 1 << 4; -static constexpr uint8_t SET_CMM_DRDM = 1 << 2; -static constexpr uint8_t SET_CMM_START = 1; -static constexpr uint8_t CMM_REGISTER = 0x01; - -static constexpr uint8_t CMM_VALUE = SET_CMM_CMZ | SET_CMM_CMY | SET_CMM_CMX | - SET_CMM_DRDM | SET_CMM_START; - -/*----------------------------------------------------------------------------*/ -/* Cycle count register */ -/*----------------------------------------------------------------------------*/ -// Default value (200) -static constexpr uint8_t CYCLE_COUNT_VALUE = 0xC8; - -static constexpr float DEFAULT_GAIN = static_cast(CYCLE_COUNT_VALUE) / - 100 * 38; -static constexpr uint8_t CYCLE_COUNT_START_REGISTER = 0x04; - -/*----------------------------------------------------------------------------*/ -/* TMRC register */ -/*----------------------------------------------------------------------------*/ -static constexpr uint8_t TMRC_150HZ_VALUE = 0x94; -static constexpr uint8_t TMRC_75HZ_VALUE = 0x95; -static constexpr uint8_t TMRC_DEFAULT_37HZ_VALUE = 0x96; - -static constexpr uint8_t TMRC_REGISTER = 0x0B; -static constexpr uint8_t TMRC_DEFAULT_VALUE = TMRC_DEFAULT_37HZ_VALUE; - -static constexpr uint8_t MEASUREMENT_REG_START = 0x24; -static constexpr uint8_t BIST_REGISTER = 0x33; -static constexpr uint8_t DATA_READY_VAL = 0b1000'0000; -static constexpr uint8_t STATUS_REGISTER = 0x34; -static constexpr uint8_t REVID_REGISTER = 0x36; - -// Range in Microtesla. 1 T equals 10000 Gauss (for comparison with LIS3 MGM) -static constexpr uint16_t RANGE = 800; - -static constexpr DeviceCommandId_t READ_DATA = 0; - -static constexpr DeviceCommandId_t CONFIGURE_CMM = 1; -static constexpr DeviceCommandId_t READ_CMM = 2; - -static constexpr DeviceCommandId_t CONFIGURE_TMRC = 3; -static constexpr DeviceCommandId_t READ_TMRC = 4; - -static constexpr DeviceCommandId_t CONFIGURE_CYCLE_COUNT = 5; -static constexpr DeviceCommandId_t READ_CYCLE_COUNT = 6; - -class CycleCountCommand: public SerialLinkedListAdapter { -public: - CycleCountCommand(bool oneCycleCount = true): oneCycleCount(oneCycleCount) { - setLinks(oneCycleCount); - } - - ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, - Endianness streamEndianness) override { - ReturnValue_t result = SerialLinkedListAdapter::deSerialize(buffer, - size, streamEndianness); - if(oneCycleCount) { - cycleCountY = cycleCountX; - cycleCountZ = cycleCountX; - } - return result; - } - - SerializeElement cycleCountX; - SerializeElement cycleCountY; - SerializeElement cycleCountZ; - -private: - void setLinks(bool oneCycleCount) { - setStart(&cycleCountX); - if(not oneCycleCount) { - cycleCountX.setNext(&cycleCountY); - cycleCountY.setNext(&cycleCountZ); - } - } - - bool oneCycleCount; -}; - -static constexpr uint32_t MGM_DATASET_ID = READ_DATA; - -enum MgmPoolIds: lp_id_t { - FIELD_STRENGTH_X, - FIELD_STRENGTH_Y, - FIELD_STRENGTH_Z, -}; - -class Rm3100PrimaryDataset: public StaticLocalDataSet<3 * sizeof(float)> { -public: - Rm3100PrimaryDataset(HasLocalDataPoolIF* hkOwner): - StaticLocalDataSet(hkOwner, MGM_DATASET_ID) {} - - Rm3100PrimaryDataset(object_id_t mgmId): - StaticLocalDataSet(sid_t(mgmId, MGM_DATASET_ID)) {} - - // Field strengths in micro Tesla. - lp_var_t fieldStrengthX = lp_var_t(sid.objectId, - FIELD_STRENGTH_X, this); - lp_var_t fieldStrengthY = lp_var_t(sid.objectId, - FIELD_STRENGTH_Y, this); - lp_var_t fieldStrengthZ = lp_var_t(sid.objectId, - FIELD_STRENGTH_Z, this); -}; - -} - - - -#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERRM3100DEFINITIONS_H_ */ -- 2.43.0 From ad052462c1b8c28db86945c1c83fa1e2143596ee Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 11:36:40 +0200 Subject: [PATCH 059/102] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 823c6ec5..0df8d358 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 823c6ec5fc6357d342f4d0e3edc68d89ff492b87 +Subproject commit 0df8d358020be603d0224104882951813656233a -- 2.43.0 From 260082c425742227bedd936cf3a2f2c2eec70fd9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 11:46:34 +0200 Subject: [PATCH 060/102] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index bc6b29e6..8f3edc90 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit bc6b29e652a90f5a14bb32a1bcc2a956e410e678 +Subproject commit 8f3edc90ba844b9a4551bb77a71e6dcbdae6e9ee -- 2.43.0 From 086d0762625a925952295a83308764f317267fb2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 11:46:55 +0200 Subject: [PATCH 061/102] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 0df8d358..8f3edc90 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 0df8d358020be603d0224104882951813656233a +Subproject commit 8f3edc90ba844b9a4551bb77a71e6dcbdae6e9ee -- 2.43.0 From adb0147ea994d4ab88fda3cf46014df1cb74545c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 11:52:03 +0200 Subject: [PATCH 062/102] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index b3bc1fe2..9d1cae08 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b3bc1fe28c73d51f0b8319cf67705807596e5518 +Subproject commit 9d1cae0809a7784f0dceb01359f723975a5903e7 -- 2.43.0 From 00711c148a362e9cf3a33a6d4d4037d59451a427 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 13:40:29 +0200 Subject: [PATCH 063/102] rm3100 changes --- bsp_q7s/core/ObjectFactory.cpp | 2 ++ linux/fsfwconfig/FSFWConfig.h.in | 1 + 2 files changed, 3 insertions(+) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index bdad3dac..de34ab7a 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -457,6 +457,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_A); mgmRm3100Handler->setStartUpImmediately(); + mgmRm3100Handler->setToGoToNormalMode(true); spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); @@ -469,6 +470,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_B); mgmRm3100Handler->setStartUpImmediately(); + mgmRm3100Handler->setToGoToNormalMode(true); // Commented until ACS board V2 in in clean room again // Gyro 0 Side A diff --git a/linux/fsfwconfig/FSFWConfig.h.in b/linux/fsfwconfig/FSFWConfig.h.in index 89d8b9a7..32474f21 100644 --- a/linux/fsfwconfig/FSFWConfig.h.in +++ b/linux/fsfwconfig/FSFWConfig.h.in @@ -75,5 +75,6 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; #define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 #define FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV 0 #define FSFW_HAL_L3GD20_GYRO_DEBUG 0 +#define FSFW_HAL_RM3100_MGM_DEBUG 0 #endif /* CONFIG_FSFWCONFIG_H_ */ -- 2.43.0 From 2aa76766af50cfc24265bd2f86afaa2494504901 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 14:51:14 +0200 Subject: [PATCH 064/102] added print commands for PCDU --- bsp_linux_board/ObjectFactory.cpp | 3 +- bsp_q7s/core/ObjectFactory.cpp | 6 +- mission/devices/CMakeLists.txt | 2 +- ...ndlerLIS3MDL.cpp => MgmLIS3MDLHandler.cpp} | 7 +- ...GMHandlerLIS3MDL.h => MgmLIS3MDLHandler.h} | 62 ++++++++-------- mission/devices/PDU2Handler.cpp | 74 +++++++++++++++++++ mission/devices/PDU2Handler.h | 3 + .../devicedefinitions/GomspaceDefinitions.h | 6 +- 8 files changed, 121 insertions(+), 42 deletions(-) rename mission/devices/{MGMHandlerLIS3MDL.cpp => MgmLIS3MDLHandler.cpp} (98%) rename mission/devices/{MGMHandlerLIS3MDL.h => MgmLIS3MDLHandler.h} (98%) diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 372fbf25..60ca5b6e 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -14,7 +14,8 @@ #include "mission/core/GenericFactory.h" #include "mission/utility/TmFunnel.h" #include -#include "mission/devices/MGMHandlerLIS3MDL.h" +#include + #include "mission/devices/MGMHandlerRM3100.h" #include "mission/devices/GyroADIS16507Handler.h" diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index de34ab7a..8f88a1c7 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -1,3 +1,4 @@ +#include #include "ObjectFactory.h" #include "OBSWConfig.h" #include "devConf.h" @@ -36,7 +37,6 @@ #include "mission/devices/GyroADIS16507Handler.h" #include "mission/devices/IMTQHandler.h" #include "mission/devices/SyrlinksHkHandler.h" -#include "mission/devices/MGMHandlerLIS3MDL.h" #include "mission/devices/PlocMPSoCHandler.h" #include "mission/devices/RadiationSensorHandler.h" #include "mission/devices/RwHandler.h" @@ -449,7 +449,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, - objects::SPI_COM_IF, spiCookie); + objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler->setStartUpImmediately(); spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, @@ -462,7 +462,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); auto mgmLis3Handler2 = new MGMHandlerLIS3MDL(objects::MGM_2_LIS3_HANDLER, - objects::SPI_COM_IF, spiCookie); + objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler2->setStartUpImmediately(); spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, diff --git a/mission/devices/CMakeLists.txt b/mission/devices/CMakeLists.txt index b5a1e20f..356115d3 100644 --- a/mission/devices/CMakeLists.txt +++ b/mission/devices/CMakeLists.txt @@ -1,6 +1,6 @@ target_sources(${TARGET_NAME} PUBLIC GPSHyperionHandler.cpp - MGMHandlerLIS3MDL.cpp + MgmLIS3MDLHandler.cpp GomspaceDeviceHandler.cpp Tmp1075Handler.cpp PCDUHandler.cpp diff --git a/mission/devices/MGMHandlerLIS3MDL.cpp b/mission/devices/MgmLIS3MDLHandler.cpp similarity index 98% rename from mission/devices/MGMHandlerLIS3MDL.cpp rename to mission/devices/MgmLIS3MDLHandler.cpp index 0e1da93e..b5701e1e 100644 --- a/mission/devices/MGMHandlerLIS3MDL.cpp +++ b/mission/devices/MgmLIS3MDLHandler.cpp @@ -1,12 +1,11 @@ -#include "MGMHandlerLIS3MDL.h" - +#include #include "fsfw/datapool/PoolReadGuard.h" #if OBSW_VERBOSE_LEVEL >= 1 #include "fsfw/globalfunctions/PeriodicOperationDivider.h" #endif -MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId, - object_id_t deviceCommunication, CookieIF* comCookie): +MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId, object_id_t deviceCommunication, + CookieIF* comCookie, uint8_t switchId, uint32_t transitionDelay): DeviceHandlerBase(objectId, deviceCommunication, comCookie), dataset(this) { #if OBSW_VERBOSE_LEVEL >= 1 diff --git a/mission/devices/MGMHandlerLIS3MDL.h b/mission/devices/MgmLIS3MDLHandler.h similarity index 98% rename from mission/devices/MGMHandlerLIS3MDL.h rename to mission/devices/MgmLIS3MDLHandler.h index 1b7b9c9a..0e36b9d3 100644 --- a/mission/devices/MGMHandlerLIS3MDL.h +++ b/mission/devices/MgmLIS3MDLHandler.h @@ -30,8 +30,8 @@ public: //Notifies a command to change the setup parameters static const Event CHANGE_OF_SETUP_PARAMETER = MAKE_EVENT(0, severity::LOW); - MGMHandlerLIS3MDL(uint32_t objectId, object_id_t deviceCommunication, - CookieIF* comCookie); + MGMHandlerLIS3MDL(uint32_t objectId, object_id_t deviceCommunication, CookieIF* comCookie, + uint8_t switchId, uint32_t transitionDelay = 10000); virtual ~MGMHandlerLIS3MDL(); protected: @@ -59,6 +59,34 @@ protected: private: MGMLIS3MDL::MgmPrimaryDataset dataset; + //Length a sindgle command SPI answer + static const uint8_t SINGLE_COMMAND_ANSWER_LEN = 2; + + //Single SPIcommand has 2 bytes, first for adress, second for content + size_t singleComandSize = 2; + //has the size for all adresses of the lis3mdl + the continous write bit + uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1]; + + /** + * We want to save the registers we set, so we dont have to read the + * registers when we want to change something. + * --> everytime we change set a register we have to save it + */ + uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS]; + + uint8_t statusRegister = 0; + + enum class InternalState { + STATE_NONE, + STATE_FIRST_CONTACT, + STATE_SETUP, + STATE_CHECK_REGISTERS, + STATE_NORMAL + }; + + InternalState internalState = InternalState::STATE_NONE; + CommunicationStep communicationStep = CommunicationStep::DATA; + bool commandExecuted = false; /*------------------------------------------------------------------------*/ /* Device specific commands and variables */ @@ -119,24 +147,6 @@ private: virtual ReturnValue_t setOperatingMode(const uint8_t *commandData, size_t commandDataLen); - - //Length a sindgle command SPI answer - static const uint8_t SINGLE_COMMAND_ANSWER_LEN = 2; - - //Single SPIcommand has 2 bytes, first for adress, second for content - size_t singleComandSize = 2; - //has the size for all adresses of the lis3mdl + the continous write bit - uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1]; - - /** - * We want to save the registers we set, so we dont have to read the - * registers when we want to change something. - * --> everytime we change set a register we have to save it - */ - uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS]; - - uint8_t statusRegister = 0; - /** * We always update all registers together, so this method updates * the rawpacket and rawpacketLen, so we just manipulate the local @@ -145,18 +155,6 @@ private: */ ReturnValue_t prepareCtrlRegisterWrite(); - enum class InternalState { - STATE_NONE, - STATE_FIRST_CONTACT, - STATE_SETUP, - STATE_CHECK_REGISTERS, - STATE_NORMAL - }; - - InternalState internalState = InternalState::STATE_NONE; - CommunicationStep communicationStep = CommunicationStep::DATA; - bool commandExecuted = false; - #if OBSW_VERBOSE_LEVEL >= 1 PeriodicOperationDivider* debugDivider; #endif diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 8789695e..bd760d77 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -312,6 +312,18 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool( ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { switch(cmd) { + case(GOMSPACE::PRINT_ALL): { + PoolReadGuard pg(&pdu2HkTableDataset); + ReturnValue_t readResult = pg.getReadResult(); + if(readResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading PDU2 HK table failed!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + printOutputSwitchStates(); + printOutputCurrents(); + printOutputVoltages(); + return HasReturnvaluesIF::RETURN_OK; + } case(GOMSPACE::PRINT_OUT_ENB_STATUS): { PoolReadGuard pg(&pdu2HkTableDataset); ReturnValue_t readResult = pg.getReadResult(); @@ -322,6 +334,26 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { printOutputSwitchStates(); return HasReturnvaluesIF::RETURN_OK; } + case(GOMSPACE::PRINT_OUT_CURRENTS): { + PoolReadGuard pg(&pdu2HkTableDataset); + ReturnValue_t readResult = pg.getReadResult(); + if(readResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading PDU2 HK table failed!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + printOutputCurrents(); + return HasReturnvaluesIF::RETURN_OK; + } + case(GOMSPACE::PRINT_OUT_VOLTAGES): { + PoolReadGuard pg(&pdu2HkTableDataset); + ReturnValue_t readResult = pg.getReadResult(); + if(readResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading PDU2 HK table failed!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + printOutputVoltages(); + return HasReturnvaluesIF::RETURN_OK; + } default: { return HasReturnvaluesIF::RETURN_FAILED; } @@ -348,3 +380,45 @@ void PDU2Handler::printOutputSwitchStates() { sif::info << "PDU2 payload camera enable state: " << unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << std::endl; } + +void PDU2Handler::printOutputCurrents() { + sif::info << "PDU2 Q7S current: " << + pdu2HkTableDataset.currentOutQ7S.value << std::endl; + sif::info << "PDU2 Payload PCDU current: " << + pdu2HkTableDataset.currentOutPayloadPCDUCh1.value << std::endl; + sif::info << "PDU2 RW currents: " << + pdu2HkTableDataset.currentOutReactionWheels.value << std::endl; + sif::info << "PDU2 TCS Board Heater In Current: " << + pdu2HkTableDataset.currentOutTCSBoardHeaterIn.value << std::endl; + sif::info << "PDU2 SuS Redundant current: " << + pdu2HkTableDataset.currentOutSUSRedundant.value << std::endl; + sif::info << "PDU2 Depl-Mechanism current: " << + pdu2HkTableDataset.currentOutDeplMechanism.value << std::endl; + sif::info << "PDU2 Payload PCDU current: " << + pdu2HkTableDataset.currentOutPayloadPCDUCh6.value << std::endl; + sif::info << "PDU2 ACS Board current: " << + pdu2HkTableDataset.currentOutACSBoardSideB.value << std::endl; + sif::info << "PDU2 Payload Camera current: " << + pdu2HkTableDataset.currentOutPayloadCamera.value << std::endl; +} + +void PDU2Handler::printOutputVoltages() { + sif::info << "PDU2 Q7S voltage: " << + pdu2HkTableDataset.voltageOutQ7S.value << std::endl; + sif::info << "PDU2 Payload PCDU voltage: " << + pdu2HkTableDataset.voltageOutPayloadPCDUCh1.value << std::endl; + sif::info << "PDU2 RW voltage: " << + pdu2HkTableDataset.voltageOutReactionWheels.value << std::endl; + sif::info << "PDU2 TCS Board Heater In voltage: " << + pdu2HkTableDataset.voltageOutTCSBoardHeaterIn.value << std::endl; + sif::info << "PDU2 SuS Redundant voltage: " << + pdu2HkTableDataset.voltageOutSUSRedundant.value << std::endl; + sif::info << "PDU2 Depl-Mechanism voltage: " << + pdu2HkTableDataset.voltageOutDeplMechanism.value << std::endl; + sif::info << "PDU2 Payload PCDU voltage: " << + pdu2HkTableDataset.voltageOutPayloadPCDUCh6.value << std::endl; + sif::info << "PDU2 ACS Board voltage: " << + pdu2HkTableDataset.voltageOutACSBoardSideB.value << std::endl; + sif::info << "PDU2 Payload Camera voltage: " << + pdu2HkTableDataset.voltageOutPayloadCamera.value << std::endl; +} diff --git a/mission/devices/PDU2Handler.h b/mission/devices/PDU2Handler.h index 0aa7f0b5..93f9200e 100644 --- a/mission/devices/PDU2Handler.h +++ b/mission/devices/PDU2Handler.h @@ -40,6 +40,9 @@ private: PDU2::PDU2HkTableDataset pdu2HkTableDataset; void printOutputSwitchStates(); + void printOutputCurrents(); + void printOutputVoltages(); + void parseHkTableReply(const uint8_t *packet); }; diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index f4e50466..5f067bed 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -33,7 +33,11 @@ static const DeviceCommandId_t GNDWDT_RESET = 9; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PRINT_OUT_ENB_STATUS = 17; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t PRINT_ALL = 32; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t PRINT_OUT_ENB_STATUS = 33; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t PRINT_OUT_CURRENTS = 34; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t PRINT_OUT_VOLTAGES = 35; //!< [EXPORT] : [COMMAND] + } -- 2.43.0 From 0f57fc33c8973ecb150a860ebab1190893b27192 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 14:51:51 +0200 Subject: [PATCH 065/102] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 9d1cae08..6da94c73 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 9d1cae0809a7784f0dceb01359f723975a5903e7 +Subproject commit 6da94c73d0568c64e41d6c4b803539e09409c942 -- 2.43.0 From 536c0cb0feb9035c4da08d97b12dcc86d61deed4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 15:00:31 +0200 Subject: [PATCH 066/102] new commands now working --- mission/devices/GomspaceDeviceHandler.cpp | 12 +++++-- mission/devices/PDU2Handler.cpp | 38 ++++++++++++----------- tmtc | 2 +- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index c7de02bb..72c2766e 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -7,11 +7,11 @@ GomspaceDeviceHandler::GomspaceDeviceHandler(object_id_t objectId, object_id_t c DeviceHandlerBase(objectId, comIF, comCookie), maxConfigTableAddress(maxConfigTableAddress), maxHkTableAddress(maxHkTableAddress), hkTableReplySize(hkTableReplySize), hkTableDataset(hkTableDataset) { - if (comCookie == NULL) { + if (comCookie == nullptr) { sif::error << "GomspaceDeviceHandler::GomspaceDeviceHandler: Invalid com cookie" << std::endl; } - if (hkTableDataset == NULL) { + if (hkTableDataset == nullptr) { sif::error << "GomspaceDeviceHandler::GomspaceDeviceHandler: Invalid hk table data set" << std::endl; } @@ -75,7 +75,10 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand( } break; } - case(GOMSPACE::PRINT_OUT_ENB_STATUS): { + case(GOMSPACE::PRINT_OUT_ENB_STATUS): + case(GOMSPACE::PRINT_ALL): + case(GOMSPACE::PRINT_OUT_CURRENTS): + case(GOMSPACE::PRINT_OUT_VOLTAGES): { result = printStatus(deviceCommand); break; } @@ -99,7 +102,10 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap(){ this->insertInCommandAndReplyMap(GOMSPACE::PARAM_GET, 3); this->insertInCommandAndReplyMap(GOMSPACE::REQUEST_HK_TABLE, 3); this->insertInCommandMap(GOMSPACE::GNDWDT_RESET); + this->insertInCommandMap(GOMSPACE::PRINT_ALL); this->insertInCommandMap(GOMSPACE::PRINT_OUT_ENB_STATUS); + this->insertInCommandMap(GOMSPACE::PRINT_OUT_VOLTAGES); + this->insertInCommandMap(GOMSPACE::PRINT_OUT_CURRENTS); } ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t *start, diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index bd760d77..06e60002 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -382,43 +382,45 @@ void PDU2Handler::printOutputSwitchStates() { } void PDU2Handler::printOutputCurrents() { - sif::info << "PDU2 Q7S current: " << + sif::info << "Printing PDU2 currents [mA]: " << std::endl; + sif::info << "PDU2 Q7S:" << pdu2HkTableDataset.currentOutQ7S.value << std::endl; - sif::info << "PDU2 Payload PCDU current: " << + sif::info << "PDU2 Payload PCDU:" << pdu2HkTableDataset.currentOutPayloadPCDUCh1.value << std::endl; - sif::info << "PDU2 RW currents: " << + sif::info << "PDU2 RW:" << pdu2HkTableDataset.currentOutReactionWheels.value << std::endl; - sif::info << "PDU2 TCS Board Heater In Current: " << + sif::info << "PDU2 TCS Board Heater In:" << pdu2HkTableDataset.currentOutTCSBoardHeaterIn.value << std::endl; - sif::info << "PDU2 SuS Redundant current: " << + sif::info << "PDU2 SuS Redundant:" << pdu2HkTableDataset.currentOutSUSRedundant.value << std::endl; - sif::info << "PDU2 Depl-Mechanism current: " << + sif::info << "PDU2 Depl-Mechanism:" << pdu2HkTableDataset.currentOutDeplMechanism.value << std::endl; - sif::info << "PDU2 Payload PCDU current: " << + sif::info << "PDU2 Payload PCDU:" << pdu2HkTableDataset.currentOutPayloadPCDUCh6.value << std::endl; - sif::info << "PDU2 ACS Board current: " << + sif::info << "PDU2 ACS Board:" << pdu2HkTableDataset.currentOutACSBoardSideB.value << std::endl; - sif::info << "PDU2 Payload Camera current: " << + sif::info << "PDU2 Payload Camera:" << pdu2HkTableDataset.currentOutPayloadCamera.value << std::endl; } void PDU2Handler::printOutputVoltages() { - sif::info << "PDU2 Q7S voltage: " << + sif::info << "Printing PDU2 voltages [mV]: " << std::endl; + sif::info << "PDU2 Q7S:" << pdu2HkTableDataset.voltageOutQ7S.value << std::endl; - sif::info << "PDU2 Payload PCDU voltage: " << + sif::info << "PDU2 Payload PCDU:" << pdu2HkTableDataset.voltageOutPayloadPCDUCh1.value << std::endl; - sif::info << "PDU2 RW voltage: " << + sif::info << "PDU2 RW:" << pdu2HkTableDataset.voltageOutReactionWheels.value << std::endl; - sif::info << "PDU2 TCS Board Heater In voltage: " << + sif::info << "PDU2 TCS Board Heater In:" << pdu2HkTableDataset.voltageOutTCSBoardHeaterIn.value << std::endl; - sif::info << "PDU2 SuS Redundant voltage: " << + sif::info << "PDU2 SuS Redundant:" << pdu2HkTableDataset.voltageOutSUSRedundant.value << std::endl; - sif::info << "PDU2 Depl-Mechanism voltage: " << + sif::info << "PDU2 Depl-Mechanism:" << pdu2HkTableDataset.voltageOutDeplMechanism.value << std::endl; - sif::info << "PDU2 Payload PCDU voltage: " << + sif::info << "PDU2 Payload PCDU:" << pdu2HkTableDataset.voltageOutPayloadPCDUCh6.value << std::endl; - sif::info << "PDU2 ACS Board voltage: " << + sif::info << "PDU2 ACS Board voltage:" << pdu2HkTableDataset.voltageOutACSBoardSideB.value << std::endl; - sif::info << "PDU2 Payload Camera voltage: " << + sif::info << "PDU2 Payload Camera voltage:" << pdu2HkTableDataset.voltageOutPayloadCamera.value << std::endl; } diff --git a/tmtc b/tmtc index 6da94c73..5c65390a 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 6da94c73d0568c64e41d6c4b803539e09409c942 +Subproject commit 5c65390a8b0344c41728d276729cae0a2cc1d9d1 -- 2.43.0 From 00bafd98fe2711c261151c8dbaedc6c867e5413e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 17:24:34 +0200 Subject: [PATCH 067/102] obsw config, gps update --- bsp_q7s/core/ObjectFactory.cpp | 12 ++++++++---- common/config/devConf.h | 4 ++-- linux/fsfwconfig/OBSWConfig.h.in | 1 + mission/devices/GPSHyperionHandler.cpp | 12 ++++++++++-- mission/devices/GPSHyperionHandler.h | 6 +++++- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 8f88a1c7..7b5247f8 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -457,7 +457,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_A); mgmRm3100Handler->setStartUpImmediately(); - mgmRm3100Handler->setToGoToNormalMode(true); + //mgmRm3100Handler->setToGoToNormalMode(true); spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); @@ -470,7 +470,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_B); mgmRm3100Handler->setStartUpImmediately(); - mgmRm3100Handler->setToGoToNormalMode(true); + //mgmRm3100Handler->setToGoToNormalMode(true); // Commented until ACS board V2 in in clean room again // Gyro 0 Side A @@ -502,6 +502,10 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI gyroL3gHandler->setStartUpImmediately(); //gyroL3gHandler->setGoNormalModeAtStartup(); + bool debugGps = false; +#if OBSW_DEBUG_GPS == 1 + debugGps = true; +#endif resetArgsGnss1.gnss1 = true; resetArgsGnss1.gpioComIF = gpioComIF; resetArgsGnss1.waitPeriodMs = 100; @@ -517,11 +521,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI uartCookieGps1->setToFlushInput(true); uartCookieGps1->setReadCycles(6); auto gpsHandler0 = new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, - uartCookieGps0, true); + uartCookieGps0, debugGps); gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0); gpsHandler0->setStartUpImmediately(); auto gpsHandler1 = new GPSHyperionHandler(objects::GPS1_HANDLER, objects::UART_COM_IF, - uartCookieGps1, true); + uartCookieGps1, debugGps); gpsHandler1->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss1); gpsHandler1->setStartUpImmediately(); } diff --git a/common/config/devConf.h b/common/config/devConf.h index 41126fdd..e1d95b5e 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -26,10 +26,10 @@ static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3; static constexpr uint32_t DEFAULT_ADIS16507_SPEED = 976'000; static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3; -static constexpr uint32_t RW_SPEED = 300000; +static constexpr uint32_t RW_SPEED = 300'000; static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0; -static constexpr uint32_t RTD_SPEED = 2000000; +static constexpr uint32_t RTD_SPEED = 2'000'000; } diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index dc397635..32f29a09 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -63,6 +63,7 @@ debugging. */ #define OBSW_DEBUG_P60DOCK 0 #define OBSW_DEBUG_PDU1 0 #define OBSW_DEBUG_PDU2 0 +#define OBSW_DEBUG_GPS 0 #define OBSW_DEBUG_ACU 0 #define OBSW_DEBUG_SYRLINKS 0 #define OBSW_DEBUG_IMQT 0 diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 5e44f89c..26b86a76 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -23,7 +23,6 @@ GPSHyperionHandler::~GPSHyperionHandler() {} void GPSHyperionHandler::doStartUp() { if(internalState == InternalStates::NONE) { commandExecuted = false; - updatePeriodicReply(true, GpsHyperion::GPS_REPLY); internalState = InternalStates::WAIT_FIRST_MESSAGE; } @@ -76,7 +75,7 @@ ReturnValue_t GPSHyperionHandler::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, size_t *foundLen) { // Pass data to GPS library if(len > 0) { - sif::debug << "GPSHandler::scanForReply: Received " << len << " bytes" << std::endl; + // sif::debug << "GPSHandler::scanForReply: Received " << len << " bytes" << std::endl; if (internalState == InternalStates::WAIT_FIRST_MESSAGE) { // TODO: Check whether data is valid by checking whether NMEA start string is valid? commandExecuted = true; @@ -202,3 +201,12 @@ void GPSHyperionHandler::setResetPinTriggerFunction(gpioResetFunction_t resetCal void GPSHyperionHandler::debugInterface(uint8_t positionTracker, object_id_t objectId, uint32_t parameter) { } + +ReturnValue_t GPSHyperionHandler::initialize() { + ReturnValue_t result = DeviceHandlerBase::initialize(); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + // Enable reply immediately for now + return updatePeriodicReply(true, GpsHyperion::GPS_REPLY); +} diff --git a/mission/devices/GPSHyperionHandler.h b/mission/devices/GPSHyperionHandler.h index 03c572a3..13591b44 100644 --- a/mission/devices/GPSHyperionHandler.h +++ b/mission/devices/GPSHyperionHandler.h @@ -14,12 +14,16 @@ */ class GPSHyperionHandler: public DeviceHandlerBase { public: - using gpioResetFunction_t = ReturnValue_t (*) (void* args); + GPSHyperionHandler(object_id_t objectId, object_id_t deviceCommunication, CookieIF* comCookie, bool debugHyperionGps = false); virtual ~GPSHyperionHandler(); + using gpioResetFunction_t = ReturnValue_t (*) (void* args); + void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void*args); + + ReturnValue_t initialize() override; protected: gpioResetFunction_t resetCallback = nullptr; -- 2.43.0 From 2cb562cdee3f9a3cb8f0a95e06696b7ac8fa0415 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 17:25:16 +0200 Subject: [PATCH 068/102] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 5c65390a..a5d9fedc 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 5c65390a8b0344c41728d276729cae0a2cc1d9d1 +Subproject commit a5d9fedc649966c901a7ede9bbbe915df9ed9446 -- 2.43.0 From 8dcd2f0c9569e292134b317e6617e1bf35759403 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 17:33:47 +0200 Subject: [PATCH 069/102] some cfg improvements --- CMakeLists.txt | 1 - bsp_q7s/core/ObjectFactory.cpp | 16 ++++++++++++---- fsfw | 2 +- linux/fsfwconfig/FSFWConfig.h.in | 1 + linux/fsfwconfig/OBSWConfig.h.in | 1 - 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f366b744..e9b1b68c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,6 @@ include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake) pre_source_hw_os_config() if(TGT_BSP) - message(STATUS ${TGT_BSP}) if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack" ) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 7b5247f8..49e036d6 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -457,7 +457,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_A); mgmRm3100Handler->setStartUpImmediately(); - //mgmRm3100Handler->setToGoToNormalMode(true); +#if FSFW_HAL_RM3100_MGM_DEBUG == 1 + mgmRm3100Handler->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); @@ -470,7 +472,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_B); mgmRm3100Handler->setStartUpImmediately(); - //mgmRm3100Handler->setToGoToNormalMode(true); +#if FSFW_HAL_RM3100_MGM_DEBUG == 1 + mgmRm3100Handler->setToGoToNormalMode(true); +#endif // Commented until ACS board V2 in in clean room again // Gyro 0 Side A @@ -486,7 +490,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); - //gyroL3gHandler->setGoNormalModeAtStartup(); +#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 + gyroL3gHandler->setGoNormalModeAtStartup(); +#endif // Gyro 2 Side B spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, @@ -500,7 +506,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); - //gyroL3gHandler->setGoNormalModeAtStartup(); +#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 + gyroL3gHandler->setGoNormalModeAtStartup(); +#endif bool debugGps = false; #if OBSW_DEBUG_GPS == 1 diff --git a/fsfw b/fsfw index 8f3edc90..6d0d04ac 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 8f3edc90ba844b9a4551bb77a71e6dcbdae6e9ee +Subproject commit 6d0d04ac230962024580ef3769cc8ec063db4093 diff --git a/linux/fsfwconfig/FSFWConfig.h.in b/linux/fsfwconfig/FSFWConfig.h.in index 32474f21..4f278cef 100644 --- a/linux/fsfwconfig/FSFWConfig.h.in +++ b/linux/fsfwconfig/FSFWConfig.h.in @@ -74,6 +74,7 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; #define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 #define FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV 0 + #define FSFW_HAL_L3GD20_GYRO_DEBUG 0 #define FSFW_HAL_RM3100_MGM_DEBUG 0 diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 32f29a09..58797c2d 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -68,7 +68,6 @@ debugging. */ #define OBSW_DEBUG_SYRLINKS 0 #define OBSW_DEBUG_IMQT 0 #define OBSW_DEBUG_ADIS16507 0 -#define OBSW_DEBUG_L3GD20_GYRO 0 #define OBSW_DEBUG_RAD_SENSOR 0 #define OBSW_DEBUG_SUS 0 #define OBSW_DEBUG_RTD 0 -- 2.43.0 From 48a8a52b1c867c01ee2f946057954cb425b34761 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 16 Sep 2021 18:51:06 +0200 Subject: [PATCH 070/102] moved lis3mdl to fsfw --- bsp_q7s/core/ObjectFactory.cpp | 12 +- fsfw | 2 +- linux/fsfwconfig/FSFWConfig.h.in | 1 + .../pollingSequenceFactory.cpp | 102 ++-- mission/devices/CMakeLists.txt | 1 - mission/devices/MgmLIS3MDLHandler.cpp | 497 ------------------ mission/devices/MgmLIS3MDLHandler.h | 163 ------ .../MGMHandlerLIS3Definitions.h | 178 ------- 8 files changed, 62 insertions(+), 894 deletions(-) delete mode 100644 mission/devices/MgmLIS3MDLHandler.cpp delete mode 100644 mission/devices/MgmLIS3MDLHandler.h delete mode 100644 mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 49e036d6..26c4df6d 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -1,4 +1,3 @@ -#include #include "ObjectFactory.h" #include "OBSWConfig.h" #include "devConf.h" @@ -53,6 +52,7 @@ #include "fsfw_hal/linux/uart/UartComIF.h" #include "fsfw_hal/linux/uart/UartCookie.h" +#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h" #include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h" #include "fsfw_hal/devicehandlers/MgmRM3100Handler.h" #include "fsfw_hal/linux/i2c/I2cCookie.h" @@ -448,9 +448,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI std::string spiDev = q7s::SPI_DEFAULT_DEV; SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); - auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, + auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler->setStartUpImmediately(); +#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 + mgmLis3Handler->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); @@ -463,9 +466,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); - auto mgmLis3Handler2 = new MGMHandlerLIS3MDL(objects::MGM_2_LIS3_HANDLER, + auto mgmLis3Handler2 = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler2->setStartUpImmediately(); +#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 + mgmLis3Handler2->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); diff --git a/fsfw b/fsfw index 6d0d04ac..b1a56a71 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 6d0d04ac230962024580ef3769cc8ec063db4093 +Subproject commit b1a56a71cdba538e82b4052413e1663b34cfee90 diff --git a/linux/fsfwconfig/FSFWConfig.h.in b/linux/fsfwconfig/FSFWConfig.h.in index 4f278cef..7314b275 100644 --- a/linux/fsfwconfig/FSFWConfig.h.in +++ b/linux/fsfwconfig/FSFWConfig.h.in @@ -77,5 +77,6 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; #define FSFW_HAL_L3GD20_GYRO_DEBUG 0 #define FSFW_HAL_RM3100_MGM_DEBUG 0 +#define FSFW_HAL_LIS3MDL_MGM_DEBUG 0 #endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index f45f5f32..a0064fc5 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -425,16 +425,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); #if OBSW_ADD_ACS_BOARD == 1 - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -447,27 +447,27 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); +// +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -480,16 +480,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -502,16 +502,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); #endif /* OBSW_ADD_ACS_BOARD == 1 */ if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { diff --git a/mission/devices/CMakeLists.txt b/mission/devices/CMakeLists.txt index 356115d3..dd17728c 100644 --- a/mission/devices/CMakeLists.txt +++ b/mission/devices/CMakeLists.txt @@ -1,6 +1,5 @@ target_sources(${TARGET_NAME} PUBLIC GPSHyperionHandler.cpp - MgmLIS3MDLHandler.cpp GomspaceDeviceHandler.cpp Tmp1075Handler.cpp PCDUHandler.cpp diff --git a/mission/devices/MgmLIS3MDLHandler.cpp b/mission/devices/MgmLIS3MDLHandler.cpp deleted file mode 100644 index b5701e1e..00000000 --- a/mission/devices/MgmLIS3MDLHandler.cpp +++ /dev/null @@ -1,497 +0,0 @@ -#include -#include "fsfw/datapool/PoolReadGuard.h" -#if OBSW_VERBOSE_LEVEL >= 1 -#include "fsfw/globalfunctions/PeriodicOperationDivider.h" -#endif - -MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId, object_id_t deviceCommunication, - CookieIF* comCookie, uint8_t switchId, uint32_t transitionDelay): - DeviceHandlerBase(objectId, deviceCommunication, comCookie), - dataset(this) { -#if OBSW_VERBOSE_LEVEL >= 1 - debugDivider = new PeriodicOperationDivider(5); -#endif - /* Set to default values right away. */ - registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT; - registers[1] = MGMLIS3MDL::CTRL_REG2_DEFAULT; - registers[2] = MGMLIS3MDL::CTRL_REG3_DEFAULT; - registers[3] = MGMLIS3MDL::CTRL_REG4_DEFAULT; - registers[4] = MGMLIS3MDL::CTRL_REG5_DEFAULT; - -} - -MGMHandlerLIS3MDL::~MGMHandlerLIS3MDL() { -} - - -void MGMHandlerLIS3MDL::doStartUp() { - switch (internalState) { - case(InternalState::STATE_NONE): { - internalState = InternalState::STATE_FIRST_CONTACT; - break; - } - case(InternalState::STATE_FIRST_CONTACT): { - /* Will be set by checking device ID (WHO AM I register) */ - if(commandExecuted) { - commandExecuted = false; - internalState = InternalState::STATE_SETUP; - } - break; - } - case(InternalState::STATE_SETUP): { - internalState = InternalState::STATE_CHECK_REGISTERS; - break; - } - case(InternalState::STATE_CHECK_REGISTERS): { - /* Set up cached registers which will be used to configure the MGM. */ - if(commandExecuted) { - commandExecuted = false; -#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1 - setMode(MODE_NORMAL); -#else - setMode(_MODE_TO_ON); -#endif - } - break; - } - default: - break; - } - -} - -void MGMHandlerLIS3MDL::doShutDown() { - setMode(_MODE_POWER_DOWN); -} - -ReturnValue_t MGMHandlerLIS3MDL::buildTransitionDeviceCommand( - DeviceCommandId_t *id) { - switch (internalState) { - case(InternalState::STATE_NONE): - case(InternalState::STATE_NORMAL): { - return HasReturnvaluesIF::RETURN_OK; - } - case(InternalState::STATE_FIRST_CONTACT): { - *id = MGMLIS3MDL::IDENTIFY_DEVICE; - break; - } - case(InternalState::STATE_SETUP): { - *id = MGMLIS3MDL::SETUP_MGM; - break; - } - case(InternalState::STATE_CHECK_REGISTERS): { - *id = MGMLIS3MDL::READ_CONFIG_AND_DATA; - break; - } - default: { - /* might be a configuration error. */ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "GyroHandler::buildTransitionDeviceCommand: Unknown internal state!" << - std::endl; -#else - sif::printWarning("GyroHandler::buildTransitionDeviceCommand: Unknown internal state!\n"); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ - return HasReturnvaluesIF::RETURN_OK; - } - - } - return buildCommandFromCommand(*id, NULL, 0); -} - -uint8_t MGMHandlerLIS3MDL::readCommand(uint8_t command, bool continuousCom) { - command |= (1 << MGMLIS3MDL::RW_BIT); - if (continuousCom == true) { - command |= (1 << MGMLIS3MDL::MS_BIT); - } - return command; -} - -uint8_t MGMHandlerLIS3MDL::writeCommand(uint8_t command, bool continuousCom) { - command &= ~(1 << MGMLIS3MDL::RW_BIT); - if (continuousCom == true) { - command |= (1 << MGMLIS3MDL::MS_BIT); - } - return command; -} - -void MGMHandlerLIS3MDL::setupMgm() { - - registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT; - registers[1] = MGMLIS3MDL::CTRL_REG2_DEFAULT; - registers[2] = MGMLIS3MDL::CTRL_REG3_DEFAULT; - registers[3] = MGMLIS3MDL::CTRL_REG4_DEFAULT; - registers[4] = MGMLIS3MDL::CTRL_REG5_DEFAULT; - - prepareCtrlRegisterWrite(); -} - -ReturnValue_t MGMHandlerLIS3MDL::buildNormalDeviceCommand( - DeviceCommandId_t *id) { - // Data/config register will be read in an alternating manner. - if(communicationStep == CommunicationStep::DATA) { - *id = MGMLIS3MDL::READ_CONFIG_AND_DATA; - communicationStep = CommunicationStep::TEMPERATURE; - return buildCommandFromCommand(*id, NULL, 0); - } - else { - *id = MGMLIS3MDL::READ_TEMPERATURE; - communicationStep = CommunicationStep::DATA; - return buildCommandFromCommand(*id, NULL, 0); - } - -} - -ReturnValue_t MGMHandlerLIS3MDL::buildCommandFromCommand( - DeviceCommandId_t deviceCommand, const uint8_t *commandData, - size_t commandDataLen) { - switch(deviceCommand) { - case(MGMLIS3MDL::READ_CONFIG_AND_DATA): { - std::memset(commandBuffer, 0, sizeof(commandBuffer)); - commandBuffer[0] = readCommand(MGMLIS3MDL::CTRL_REG1, true); - - rawPacket = commandBuffer; - rawPacketLen = MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1; - return RETURN_OK; - } - case(MGMLIS3MDL::READ_TEMPERATURE): { - std::memset(commandBuffer, 0, 3); - commandBuffer[0] = readCommand(MGMLIS3MDL::TEMP_LOWBYTE, true); - - rawPacket = commandBuffer; - rawPacketLen = 3; - return RETURN_OK; - } - case(MGMLIS3MDL::IDENTIFY_DEVICE): { - return identifyDevice(); - } - case(MGMLIS3MDL::TEMP_SENSOR_ENABLE): { - return enableTemperatureSensor(commandData, commandDataLen); - } - case(MGMLIS3MDL::SETUP_MGM): { - setupMgm(); - return HasReturnvaluesIF::RETURN_OK; - } - case(MGMLIS3MDL::ACCURACY_OP_MODE_SET): { - return setOperatingMode(commandData, commandDataLen); - } - default: - return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; - } - return HasReturnvaluesIF::RETURN_FAILED; -} - -ReturnValue_t MGMHandlerLIS3MDL::identifyDevice() { - uint32_t size = 2; - commandBuffer[0] = readCommand(MGMLIS3MDL::IDENTIFY_DEVICE_REG_ADDR); - commandBuffer[1] = 0x00; - - rawPacket = commandBuffer; - rawPacketLen = size; - - return RETURN_OK; -} - -ReturnValue_t MGMHandlerLIS3MDL::scanForReply(const uint8_t *start, - size_t len, DeviceCommandId_t *foundId, size_t *foundLen) { - *foundLen = len; - if (len == MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1) { - *foundLen = len; - *foundId = MGMLIS3MDL::READ_CONFIG_AND_DATA; - // Check validity by checking config registers - if (start[1] != registers[0] or start[2] != registers[1] or - start[3] != registers[2] or start[4] != registers[3] or - start[5] != registers[4]) { -#if OBSW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "MGMHandlerLIS3MDL::scanForReply: Invalid registers!" << std::endl; -#else - sif::printWarning("MGMHandlerLIS3MDL::scanForReply: Invalid registers!\n"); -#endif -#endif - return DeviceHandlerIF::INVALID_DATA; - } - if(mode == _MODE_START_UP) { - commandExecuted = true; - } - - } - else if(len == MGMLIS3MDL::TEMPERATURE_REPLY_LEN) { - *foundLen = len; - *foundId = MGMLIS3MDL::READ_TEMPERATURE; - } - else if (len == MGMLIS3MDL::SETUP_REPLY_LEN) { - *foundLen = len; - *foundId = MGMLIS3MDL::SETUP_MGM; - } - else if (len == SINGLE_COMMAND_ANSWER_LEN) { - *foundLen = len; - *foundId = getPendingCommand(); - if(*foundId == MGMLIS3MDL::IDENTIFY_DEVICE) { - if(start[1] != MGMLIS3MDL::DEVICE_ID) { -#if OBSW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "MGMHandlerLIS3MDL::scanForReply: Invalid registers!" << std::endl; -#else - sif::printWarning("MGMHandlerLIS3MDL::scanForReply: Invalid registers!\n"); -#endif -#endif - return DeviceHandlerIF::INVALID_DATA; - } - - if(mode == _MODE_START_UP) { - commandExecuted = true; - } - } - } - else { - return DeviceHandlerIF::INVALID_DATA; - } - - /* Data with SPI Interface always has this answer */ - if (start[0] == 0b11111111) { - return RETURN_OK; - } - else { - return DeviceHandlerIF::INVALID_DATA; - } - -} -ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, - const uint8_t *packet) { - - switch (id) { - case MGMLIS3MDL::IDENTIFY_DEVICE: { - break; - } - case MGMLIS3MDL::SETUP_MGM: { - break; - } - case MGMLIS3MDL::READ_CONFIG_AND_DATA: { - // TODO: Store configuration in new local datasets. - float sensitivityFactor = getSensitivityFactor(getSensitivity(registers[2])); - - int16_t mgmMeasurementRawX = packet[MGMLIS3MDL::X_HIGHBYTE_IDX] << 8 - | packet[MGMLIS3MDL::X_LOWBYTE_IDX] ; - int16_t mgmMeasurementRawY = packet[MGMLIS3MDL::Y_HIGHBYTE_IDX] << 8 - | packet[MGMLIS3MDL::Y_LOWBYTE_IDX] ; - int16_t mgmMeasurementRawZ = packet[MGMLIS3MDL::Z_HIGHBYTE_IDX] << 8 - | packet[MGMLIS3MDL::Z_LOWBYTE_IDX] ; - - /* Target value in microtesla */ - float mgmX = static_cast(mgmMeasurementRawX) * sensitivityFactor - * MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR; - float mgmY = static_cast(mgmMeasurementRawY) * sensitivityFactor - * MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR; - float mgmZ = static_cast(mgmMeasurementRawZ) * sensitivityFactor - * MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR; - -#if OBSW_VERBOSE_LEVEL >= 1 - if(debugDivider->checkAndIncrement()) { - /* Set terminal to utf-8 if there is an issue with micro printout. */ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "MGMHandlerLIS3: Magnetic field strength in" - " microtesla:" << std::endl; - sif::info << "X: " << mgmX << " uT" << std::endl; - sif::info << "Y: " << mgmY << " uT" << std::endl; - sif::info << "Z: " << mgmZ << " uT" << std::endl; -#else - sif::printInfo("MGMHandlerLIS3: Magnetic field strength in microtesla:\n"); - sif::printInfo("X: %f uT\n", mgmX); - sif::printInfo("Y: %f uT\n", mgmY); - sif::printInfo("Z: %f uT\n", mgmZ); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ - } -#endif /* OBSW_VERBOSE_LEVEL >= 1 */ - PoolReadGuard readHelper(&dataset); - if(readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) { - dataset.fieldStrengthX = mgmX; - dataset.fieldStrengthY = mgmY; - dataset.fieldStrengthZ = mgmZ; - dataset.setValidity(true, true); - } - break; - } - - case MGMLIS3MDL::READ_TEMPERATURE: { - int16_t tempValueRaw = packet[2] << 8 | packet[1]; - float tempValue = 25.0 + ((static_cast(tempValueRaw)) / 8.0); -#if OBSW_VERBOSE_LEVEL >= 1 - if(debugDivider->check()) { - /* Set terminal to utf-8 if there is an issue with micro printout. */ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " C" << - std::endl; -#else - sif::printInfo("MGMHandlerLIS3: Temperature: %f C\n"); -#endif - } -#endif - ReturnValue_t result = dataset.read(); - if(result == HasReturnvaluesIF::RETURN_OK) { - dataset.temperature = tempValue; - dataset.commit(); - } - break; - } - - default: { - return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY; - } - - } - return RETURN_OK; -} - -MGMLIS3MDL::Sensitivies MGMHandlerLIS3MDL::getSensitivity(uint8_t ctrlRegister2) { - bool fs0Set = ctrlRegister2 & (1 << MGMLIS3MDL::FSO); // Checks if FS0 bit is set - bool fs1Set = ctrlRegister2 & (1 << MGMLIS3MDL::FS1); // Checks if FS1 bit is set - - if (fs0Set && fs1Set) - return MGMLIS3MDL::Sensitivies::GAUSS_16; - else if (!fs0Set && fs1Set) - return MGMLIS3MDL::Sensitivies::GAUSS_12; - else if (fs0Set && !fs1Set) - return MGMLIS3MDL::Sensitivies::GAUSS_8; - else - return MGMLIS3MDL::Sensitivies::GAUSS_4; -} - -float MGMHandlerLIS3MDL::getSensitivityFactor(MGMLIS3MDL::Sensitivies sens) { - switch(sens) { - case(MGMLIS3MDL::GAUSS_4): { - return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_4_SENS; - } - case(MGMLIS3MDL::GAUSS_8): { - return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_8_SENS; - } - case(MGMLIS3MDL::GAUSS_12): { - return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_12_SENS; - } - case(MGMLIS3MDL::GAUSS_16): { - return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_16_SENS; - } - default: { - // Should never happen - return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_4_SENS; - } - } -} - - -ReturnValue_t MGMHandlerLIS3MDL::enableTemperatureSensor( - const uint8_t *commandData, size_t commandDataLen) { - triggerEvent(CHANGE_OF_SETUP_PARAMETER); - uint32_t size = 2; - commandBuffer[0] = writeCommand(MGMLIS3MDL::CTRL_REG1); - if (commandDataLen > 1) { - return INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS; - } - switch (*commandData) { - case (MGMLIS3MDL::ON): { - commandBuffer[1] = registers[0] | (1 << 7); - break; - } - case (MGMLIS3MDL::OFF): { - commandBuffer[1] = registers[0] & ~(1 << 7); - break; - } - default: - return INVALID_COMMAND_PARAMETER; - } - registers[0] = commandBuffer[1]; - - rawPacket = commandBuffer; - rawPacketLen = size; - - return RETURN_OK; -} - -ReturnValue_t MGMHandlerLIS3MDL::setOperatingMode(const uint8_t *commandData, - size_t commandDataLen) { - triggerEvent(CHANGE_OF_SETUP_PARAMETER); - if (commandDataLen != 1) { - return INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS; - } - - switch (commandData[0]) { - case MGMLIS3MDL::LOW: - registers[0] = (registers[0] & (~(1 << MGMLIS3MDL::OM1))) & (~(1 << MGMLIS3MDL::OM0)); - registers[3] = (registers[3] & (~(1 << MGMLIS3MDL::OMZ1))) & (~(1 << MGMLIS3MDL::OMZ0)); - break; - case MGMLIS3MDL::MEDIUM: - registers[0] = (registers[0] & (~(1 << MGMLIS3MDL::OM1))) | (1 << MGMLIS3MDL::OM0); - registers[3] = (registers[3] & (~(1 << MGMLIS3MDL::OMZ1))) | (1 << MGMLIS3MDL::OMZ0); - break; - - case MGMLIS3MDL::HIGH: - registers[0] = (registers[0] | (1 << MGMLIS3MDL::OM1)) & (~(1 << MGMLIS3MDL::OM0)); - registers[3] = (registers[3] | (1 << MGMLIS3MDL::OMZ1)) & (~(1 << MGMLIS3MDL::OMZ0)); - break; - - case MGMLIS3MDL::ULTRA: - registers[0] = (registers[0] | (1 << MGMLIS3MDL::OM1)) | (1 << MGMLIS3MDL::OM0); - registers[3] = (registers[3] | (1 << MGMLIS3MDL::OMZ1)) | (1 << MGMLIS3MDL::OMZ0); - break; - default: - break; - } - - return prepareCtrlRegisterWrite(); -} - -void MGMHandlerLIS3MDL::fillCommandAndReplyMap() { - /* - * Regarding ArduinoBoard: - * Actually SPI answers directly, but as commanding ArduinoBoard the - * communication could be delayed - * SPI always has to be triggered, so there could be no periodic answer of - * the device, the device has to asked with a command, so periodic is zero. - * - * We dont read single registers, we just expect special - * reply from he Readall_MGM - */ - insertInCommandAndReplyMap(MGMLIS3MDL::READ_CONFIG_AND_DATA, 1, &dataset); - insertInCommandAndReplyMap(MGMLIS3MDL::READ_TEMPERATURE, 1); - insertInCommandAndReplyMap(MGMLIS3MDL::SETUP_MGM, 1); - insertInCommandAndReplyMap(MGMLIS3MDL::IDENTIFY_DEVICE, 1); - insertInCommandAndReplyMap(MGMLIS3MDL::TEMP_SENSOR_ENABLE, 1); - insertInCommandAndReplyMap(MGMLIS3MDL::ACCURACY_OP_MODE_SET, 1); -} - -ReturnValue_t MGMHandlerLIS3MDL::prepareCtrlRegisterWrite() { - commandBuffer[0] = writeCommand(MGMLIS3MDL::CTRL_REG1, true); - - for (size_t i = 0; i < MGMLIS3MDL::NR_OF_CTRL_REGISTERS; i++) { - commandBuffer[i + 1] = registers[i]; - } - rawPacket = commandBuffer; - rawPacketLen = MGMLIS3MDL::NR_OF_CTRL_REGISTERS + 1; - - /* We dont have to check if this is working because we just did it */ - return RETURN_OK; -} - -void MGMHandlerLIS3MDL::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { - -} - -uint32_t MGMHandlerLIS3MDL::getTransitionDelayMs(Mode_t from, Mode_t to) { - return 20000; -} - -void MGMHandlerLIS3MDL::modeChanged(void) { - internalState = InternalState::STATE_NONE; -} - -ReturnValue_t MGMHandlerLIS3MDL::initializeLocalDataPool( - localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { - localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_X, - new PoolEntry({0.0})); - localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_Y, - new PoolEntry({0.0})); - localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_Z, - new PoolEntry({0.0})); - localDataPoolMap.emplace(MGMLIS3MDL::TEMPERATURE_CELCIUS, - new PoolEntry({0.0})); - return HasReturnvaluesIF::RETURN_OK; -} diff --git a/mission/devices/MgmLIS3MDLHandler.h b/mission/devices/MgmLIS3MDLHandler.h deleted file mode 100644 index 0e36b9d3..00000000 --- a/mission/devices/MgmLIS3MDLHandler.h +++ /dev/null @@ -1,163 +0,0 @@ -#ifndef MISSION_DEVICES_MGMLIS3MDLHANDLER_H_ -#define MISSION_DEVICES_MGMLIS3MDLHANDLER_H_ - -#include "OBSWConfig.h" -#include "devicedefinitions/MGMHandlerLIS3Definitions.h" -#include "events/subsystemIdRanges.h" - -#include "fsfw/devicehandlers/DeviceHandlerBase.h" - -class PeriodicOperationDivider; - -/** - * @brief Device handler object for the LIS3MDL 3-axis magnetometer - * by STMicroeletronics - * @details - * Datasheet can be found online by googling LIS3MDL. - * Flight manual: - * https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/LIS3MDL_MGM - * @author L. Loidold, R. Mueller - */ -class MGMHandlerLIS3MDL: public DeviceHandlerBase { -public: - enum class CommunicationStep { - DATA, - TEMPERATURE - }; - - static const uint8_t INTERFACE_ID = CLASS_ID::MGM_LIS3MDL; - static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::MGM_LIS3MDL; - //Notifies a command to change the setup parameters - static const Event CHANGE_OF_SETUP_PARAMETER = MAKE_EVENT(0, severity::LOW); - - MGMHandlerLIS3MDL(uint32_t objectId, object_id_t deviceCommunication, CookieIF* comCookie, - uint8_t switchId, uint32_t transitionDelay = 10000); - virtual ~MGMHandlerLIS3MDL(); - -protected: - - /** DeviceHandlerBase overrides */ - void doShutDown() override; - void doStartUp() override; - void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override; - uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; - ReturnValue_t buildCommandFromCommand( - DeviceCommandId_t deviceCommand, const uint8_t *commandData, - size_t commandDataLen) override; - ReturnValue_t buildTransitionDeviceCommand( - DeviceCommandId_t *id) override; - ReturnValue_t buildNormalDeviceCommand( - DeviceCommandId_t *id) override; - ReturnValue_t scanForReply(const uint8_t *start, size_t len, - DeviceCommandId_t *foundId, size_t *foundLen) override; - ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, - const uint8_t *packet) override; - void fillCommandAndReplyMap() override; - void modeChanged(void) override; - ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, - LocalDataPoolManager &poolManager) override; - -private: - MGMLIS3MDL::MgmPrimaryDataset dataset; - //Length a sindgle command SPI answer - static const uint8_t SINGLE_COMMAND_ANSWER_LEN = 2; - - //Single SPIcommand has 2 bytes, first for adress, second for content - size_t singleComandSize = 2; - //has the size for all adresses of the lis3mdl + the continous write bit - uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1]; - - /** - * We want to save the registers we set, so we dont have to read the - * registers when we want to change something. - * --> everytime we change set a register we have to save it - */ - uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS]; - - uint8_t statusRegister = 0; - - enum class InternalState { - STATE_NONE, - STATE_FIRST_CONTACT, - STATE_SETUP, - STATE_CHECK_REGISTERS, - STATE_NORMAL - }; - - InternalState internalState = InternalState::STATE_NONE; - CommunicationStep communicationStep = CommunicationStep::DATA; - bool commandExecuted = false; - - /*------------------------------------------------------------------------*/ - /* Device specific commands and variables */ - /*------------------------------------------------------------------------*/ - /** - * Sets the read bit for the command - * @param single command to set the read-bit at - * @param boolean to select a continuous read bit, default = false - */ - uint8_t readCommand(uint8_t command, bool continuousCom = false); - - /** - * Sets the write bit for the command - * @param single command to set the write-bit at - * @param boolean to select a continuous write bit, default = false - */ - uint8_t writeCommand(uint8_t command, bool continuousCom = false); - - /** - * This Method gets the full scale for the measurement range - * e.g.: +- 4 gauss. See p.25 datasheet. - * @return The ReturnValue does not contain the sign of the value - */ - MGMLIS3MDL::Sensitivies getSensitivity(uint8_t ctrlReg2); - - /** - * The 16 bit value needs to be multiplied with a sensitivity factor - * which depends on the sensitivity configuration - * - * @param sens Configured sensitivity of the LIS3 device - * @return Multiplication factor to get the sensor value from raw data. - */ - float getSensitivityFactor(MGMLIS3MDL::Sensitivies sens); - - /** - * This Command detects the device ID - */ - ReturnValue_t identifyDevice(); - - virtual void setupMgm(); - - /*------------------------------------------------------------------------*/ - /* Non normal commands */ - /*------------------------------------------------------------------------*/ - /** - * Enables/Disables the integrated Temperaturesensor - * @param commandData On or Off - * @param length of the commandData: has to be 1 - */ - virtual ReturnValue_t enableTemperatureSensor(const uint8_t *commandData, - size_t commandDataLen); - - /** - * Sets the accuracy of the measurement of the axis. The noise is changing. - * @param commandData LOW, MEDIUM, HIGH, ULTRA - * @param length of the command, has to be 1 - */ - virtual ReturnValue_t setOperatingMode(const uint8_t *commandData, - size_t commandDataLen); - - /** - * We always update all registers together, so this method updates - * the rawpacket and rawpacketLen, so we just manipulate the local - * saved register - * - */ - ReturnValue_t prepareCtrlRegisterWrite(); - -#if OBSW_VERBOSE_LEVEL >= 1 - PeriodicOperationDivider* debugDivider; -#endif -}; - -#endif /* MISSION_DEVICES_MGMLIS3MDLHANDLER_H_ */ diff --git a/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h b/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h deleted file mode 100644 index 98d881cf..00000000 --- a/mission/devices/devicedefinitions/MGMHandlerLIS3Definitions.h +++ /dev/null @@ -1,178 +0,0 @@ -#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERLIS3DEFINITIONS_H_ -#define MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERLIS3DEFINITIONS_H_ - -#include -#include -#include -#include - -namespace MGMLIS3MDL { - -enum Set { - ON, OFF -}; -enum OpMode { - LOW, MEDIUM, HIGH, ULTRA -}; - -enum Sensitivies: uint8_t { - GAUSS_4 = 4, - GAUSS_8 = 8, - GAUSS_12 = 12, - GAUSS_16 = 16 -}; - -/* Actually 15, we just round up a bit */ -static constexpr size_t MAX_BUFFER_SIZE = 16; - -/* Field data register scaling */ -static constexpr uint8_t GAUSS_TO_MICROTESLA_FACTOR = 100; -static constexpr float FIELD_LSB_PER_GAUSS_4_SENS = 1.0 / 6842.0; -static constexpr float FIELD_LSB_PER_GAUSS_8_SENS = 1.0 / 3421.0; -static constexpr float FIELD_LSB_PER_GAUSS_12_SENS = 1.0 / 2281.0; -static constexpr float FIELD_LSB_PER_GAUSS_16_SENS = 1.0 / 1711.0; - -static const DeviceCommandId_t READ_CONFIG_AND_DATA = 0x00; -static const DeviceCommandId_t SETUP_MGM = 0x01; -static const DeviceCommandId_t READ_TEMPERATURE = 0x02; -static const DeviceCommandId_t IDENTIFY_DEVICE = 0x03; -static const DeviceCommandId_t TEMP_SENSOR_ENABLE = 0x04; -static const DeviceCommandId_t ACCURACY_OP_MODE_SET = 0x05; - -/* Number of all control registers */ -static const uint8_t NR_OF_CTRL_REGISTERS = 5; -/* Number of registers in the MGM */ -static const uint8_t NR_OF_REGISTERS = 19; -/* Total number of adresses for all registers */ -static const uint8_t TOTAL_NR_OF_ADRESSES = 52; -static const uint8_t NR_OF_DATA_AND_CFG_REGISTERS = 14; -static const uint8_t TEMPERATURE_REPLY_LEN = 3; -static const uint8_t SETUP_REPLY_LEN = 6; - -/*------------------------------------------------------------------------*/ -/* Register adresses */ -/*------------------------------------------------------------------------*/ -/* Register adress returns identifier of device with default 0b00111101 */ -static const uint8_t IDENTIFY_DEVICE_REG_ADDR = 0b00001111; -static const uint8_t DEVICE_ID = 0b00111101; // Identifier for Device - -/* Register adress to access register 1 */ -static const uint8_t CTRL_REG1 = 0b00100000; -/* Register adress to access register 2 */ -static const uint8_t CTRL_REG2 = 0b00100001; -/* Register adress to access register 3 */ -static const uint8_t CTRL_REG3 = 0b00100010; -/* Register adress to access register 4 */ -static const uint8_t CTRL_REG4 = 0b00100011; -/* Register adress to access register 5 */ -static const uint8_t CTRL_REG5 = 0b00100100; - -/* Register adress to access status register */ -static const uint8_t STATUS_REG_IDX = 8; -static const uint8_t STATUS_REG = 0b00100111; - -/* Register adress to access low byte of x-axis */ -static const uint8_t X_LOWBYTE_IDX = 9; -static const uint8_t X_LOWBYTE = 0b00101000; -/* Register adress to access high byte of x-axis */ -static const uint8_t X_HIGHBYTE_IDX = 10; -static const uint8_t X_HIGHBYTE = 0b00101001; -/* Register adress to access low byte of y-axis */ -static const uint8_t Y_LOWBYTE_IDX = 11; -static const uint8_t Y_LOWBYTE = 0b00101010; -/* Register adress to access high byte of y-axis */ -static const uint8_t Y_HIGHBYTE_IDX = 12; -static const uint8_t Y_HIGHBYTE = 0b00101011; -/* Register adress to access low byte of z-axis */ -static const uint8_t Z_LOWBYTE_IDX = 13; -static const uint8_t Z_LOWBYTE = 0b00101100; -/* Register adress to access high byte of z-axis */ -static const uint8_t Z_HIGHBYTE_IDX = 14; -static const uint8_t Z_HIGHBYTE = 0b00101101; - -/* Register adress to access low byte of temperature sensor */ -static const uint8_t TEMP_LOWBYTE = 0b00101110; -/* Register adress to access high byte of temperature sensor */ -static const uint8_t TEMP_HIGHBYTE = 0b00101111; - -/*------------------------------------------------------------------------*/ -/* Initialize Setup Register set bits */ -/*------------------------------------------------------------------------*/ -/* General transfer bits */ -// Read=1 / Write=0 Bit -static const uint8_t RW_BIT = 7; -// Continous Read/Write Bit, increment adress -static const uint8_t MS_BIT = 6; - -/* CTRL_REG1 bits */ -static const uint8_t ST = 0; // Self test enable bit, enabled = 1 -// Enable rates higher than 80 Hz enabled = 1 -static const uint8_t FAST_ODR = 1; -static const uint8_t DO0 = 2; // Output data rate bit 2 -static const uint8_t DO1 = 3; // Output data rate bit 3 -static const uint8_t DO2 = 4; // Output data rate bit 4 -static const uint8_t OM0 = 5; // XY operating mode bit 5 -static const uint8_t OM1 = 6; // XY operating mode bit 6 -static const uint8_t TEMP_EN = 7; // Temperature sensor enable enabled = 1 -static const uint8_t CTRL_REG1_DEFAULT = (1 << TEMP_EN) | (1 << OM1) | - (1 << DO0) | (1 << DO1) | (1 << DO2); - -/* CTRL_REG2 bits */ -//reset configuration registers and user registers -static const uint8_t SOFT_RST = 2; -static const uint8_t REBOOT = 3; //reboot memory content -static const uint8_t FSO = 5; //full-scale selection bit 5 -static const uint8_t FS1 = 6; //full-scale selection bit 6 -static const uint8_t CTRL_REG2_DEFAULT = 0; - -/* CTRL_REG3 bits */ -static const uint8_t MD0 = 0; //Operating mode bit 0 -static const uint8_t MD1 = 1; //Operating mode bit 1 -//SPI serial interface mode selection enabled = 3-wire-mode -static const uint8_t SIM = 2; -static const uint8_t LP = 5; //low-power mode -static const uint8_t CTRL_REG3_DEFAULT = 0; - -/* CTRL_REG4 bits */ -//big/little endian data selection enabled = MSb at lower adress -static const uint8_t BLE = 1; -static const uint8_t OMZ0 = 2; //Z operating mode bit 2 -static const uint8_t OMZ1 = 3; //Z operating mode bit 3 -static const uint8_t CTRL_REG4_DEFAULT = (1 << OMZ1); - -/* CTRL_REG5 bits */ -static const uint8_t BDU = 6; //Block data update -static const uint8_t FAST_READ = 7; //Fast read enabled = 1 -static const uint8_t CTRL_REG5_DEFAULT = 0; - -static const uint32_t MGM_DATA_SET_ID = READ_CONFIG_AND_DATA; - -enum MgmPoolIds: lp_id_t { - FIELD_STRENGTH_X, - FIELD_STRENGTH_Y, - FIELD_STRENGTH_Z, - TEMPERATURE_CELCIUS -}; - -class MgmPrimaryDataset: public StaticLocalDataSet<5> { -public: - MgmPrimaryDataset(HasLocalDataPoolIF* hkOwner): - StaticLocalDataSet(hkOwner, MGM_DATA_SET_ID) {} - - MgmPrimaryDataset(object_id_t mgmId): - StaticLocalDataSet(sid_t(mgmId, MGM_DATA_SET_ID)) {} - - lp_var_t fieldStrengthX = lp_var_t(sid.objectId, - FIELD_STRENGTH_X, this); - lp_var_t fieldStrengthY = lp_var_t(sid.objectId, - FIELD_STRENGTH_Y, this); - lp_var_t fieldStrengthZ = lp_var_t(sid.objectId, - FIELD_STRENGTH_Z, this); - lp_var_t temperature = lp_var_t(sid.objectId, - TEMPERATURE_CELCIUS, this); -}; - -} - - -#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERLIS3DEFINITIONS_H_ */ -- 2.43.0 From 5cb6ab841656bf0b68f2b95f16cb15426aeb7bce Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 17 Sep 2021 13:08:03 +0200 Subject: [PATCH 071/102] more acs tests --- fsfw | 2 +- .../pollingSequenceFactory.cpp | 102 +++++++++--------- tmtc | 2 +- 3 files changed, 53 insertions(+), 53 deletions(-) diff --git a/fsfw b/fsfw index b1a56a71..7d44aab9 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit b1a56a71cdba538e82b4052413e1663b34cfee90 +Subproject commit 7d44aab98e6861bc7999541e97085ba5a62b6633 diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index a0064fc5..f45f5f32 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -425,16 +425,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); #if OBSW_ADD_ACS_BOARD == 1 -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -447,27 +447,27 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); -// -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -480,16 +480,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -502,16 +502,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); #endif /* OBSW_ADD_ACS_BOARD == 1 */ if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { diff --git a/tmtc b/tmtc index a5d9fedc..3f29dff6 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit a5d9fedc649966c901a7ede9bbbe915df9ed9446 +Subproject commit 3f29dff6067e8c6a486deda93f071b705b7dc699 -- 2.43.0 From 87d00dbceea39685362130d5c74da34bf5594c97 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 17 Sep 2021 16:53:15 +0200 Subject: [PATCH 072/102] some more acs board tests --- fsfw | 2 +- linux/boardtest/SpiTestClass.cpp | 2 +- .../pollingSequenceFactory.cpp | 22 +++++++++---------- tmtc | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fsfw b/fsfw index 7d44aab9..e8050183 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 7d44aab98e6861bc7999541e97085ba5a62b6633 +Subproject commit e8050183f4f54452caceba67a9d4da50bd230770 diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 08d7c14c..bdd9a2dd 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -24,7 +24,7 @@ gpioIF(gpioIF) { if(gpioIF == nullptr) { sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl; } - testMode = TestModes::MGM_RM3100; + testMode = TestModes::MGM_LIS3MDL; spiTransferStruct.rx_buf = reinterpret_cast<__u64>(recvBuffer.data()); spiTransferStruct.tx_buf = reinterpret_cast<__u64>(sendBuffer.data()); } diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index f45f5f32..0d189476 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -447,16 +447,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -479,7 +479,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // DeviceHandlerIF::SEND_READ); // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, diff --git a/tmtc b/tmtc index 3f29dff6..58da80cb 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 3f29dff6067e8c6a486deda93f071b705b7dc699 +Subproject commit 58da80cb9e2426e6b9d7fc1efb661077c35541f5 -- 2.43.0 From 487b6fd5caa1f0731ff6703ad59dc4c913eb3704 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 20 Sep 2021 11:22:11 +0200 Subject: [PATCH 073/102] updated print commands for PDUs --- mission/devices/GomspaceDeviceHandler.cpp | 10 +- mission/devices/PDU1Handler.cpp | 81 +++++++---- mission/devices/PDU1Handler.h | 4 +- mission/devices/PDU2Handler.cpp | 136 ++++++------------ mission/devices/PDU2Handler.h | 4 +- .../devicedefinitions/GomspaceDefinitions.h | 8 +- tmtc | 2 +- 7 files changed, 108 insertions(+), 137 deletions(-) diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 72c2766e..348bd35e 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -75,10 +75,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand( } break; } - case(GOMSPACE::PRINT_OUT_ENB_STATUS): - case(GOMSPACE::PRINT_ALL): - case(GOMSPACE::PRINT_OUT_CURRENTS): - case(GOMSPACE::PRINT_OUT_VOLTAGES): { + case(GOMSPACE::PRINT_HK_TABLE): { result = printStatus(deviceCommand); break; } @@ -102,10 +99,7 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap(){ this->insertInCommandAndReplyMap(GOMSPACE::PARAM_GET, 3); this->insertInCommandAndReplyMap(GOMSPACE::REQUEST_HK_TABLE, 3); this->insertInCommandMap(GOMSPACE::GNDWDT_RESET); - this->insertInCommandMap(GOMSPACE::PRINT_ALL); - this->insertInCommandMap(GOMSPACE::PRINT_OUT_ENB_STATUS); - this->insertInCommandMap(GOMSPACE::PRINT_OUT_VOLTAGES); - this->insertInCommandMap(GOMSPACE::PRINT_OUT_CURRENTS); + this->insertInCommandMap(GOMSPACE::PRINT_HK_TABLE); } ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t *start, diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index 8df972e5..378a9589 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -1,7 +1,7 @@ -#include +#include "OBSWConfig.h" #include "PDU1Handler.h" -#include -#include + +#include PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie) : GomspaceDeviceHandler(objectId, comIF, comCookie, PDU::MAX_CONFIGTABLE_ADDRESS, @@ -72,27 +72,6 @@ void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac #endif } -void PDU1Handler::printOutputSwitchStates() { - sif::info << "PDU1 TCS Board switch: " << - static_cast(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << std::endl; - sif::info << "PDU1 Syrlinks switch: " << - static_cast(pdu1HkTableDataset.outEnabledSyrlinks.value) << std::endl; - sif::info << "PDU1 star tracker switch: " << - static_cast(pdu1HkTableDataset.outEnabledStarTracker.value) << std::endl; - sif::info << "PDU1 MGT switch: " << - static_cast(pdu1HkTableDataset.outEnabledMGT.value) << std::endl; - sif::info << "PDU1 SUS nominal switch: " << - static_cast(pdu1HkTableDataset.outEnabledSUSNominal.value) << std::endl; - sif::info << "PDU1 solar cell experiment switch: " << - static_cast(pdu1HkTableDataset.outEnabledSolarCellExp.value) << std::endl; - sif::info << "PDU1 PLOC switch: " << - static_cast(pdu1HkTableDataset.outEnabledPLOC.value) << std::endl; - sif::info << "PDU1 ACS Side A switch: " << - static_cast(pdu1HkTableDataset.outEnabledAcsBoardSideA.value) << std::endl; - sif::info << "PDU1 channel 8 switch: " << - static_cast(pdu1HkTableDataset.outEnabledChannel8.value) << std::endl; -} - void PDU1Handler::parseHkTableReply(const uint8_t *packet) { uint16_t dataOffset = 0; PoolReadGuard pg(&pdu1HkTableDataset); @@ -356,14 +335,14 @@ ReturnValue_t PDU1Handler::initializeLocalDataPool( ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { switch(cmd) { - case(GOMSPACE::PRINT_OUT_ENB_STATUS): { + case(GOMSPACE::PRINT_HK_TABLE): { PoolReadGuard pg(&pdu1HkTableDataset); ReturnValue_t readResult = pg.getReadResult(); if(readResult != HasReturnvaluesIF::RETURN_OK) { sif::warning << "Reading PDU1 HK table failed!" << std::endl; return HasReturnvaluesIF::RETURN_FAILED; } - printOutputSwitchStates(); + printHkTable(); return HasReturnvaluesIF::RETURN_OK; } default: { @@ -371,3 +350,53 @@ ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { } } } + +void PDU1Handler::printHkTable() { + sif::info << "PDU1 Info: SwitchState, Voltages [mV], Currents [mA]" << std::endl; + sif::info << std::setw(30) << std::left << "TCS Board" << std::dec << "| " << + unsigned(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutTCSBoard3V3.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutTCSBoard3V3.value << std::endl; + sif::info << std::setw(30) << std::left << "Syrlinks" << std::dec << "| " << + unsigned(pdu1HkTableDataset.outEnabledSyrlinks.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutSyrlinks.value << ", " << std::setw(4) << + pdu1HkTableDataset.currentOutSyrlinks.value << std::endl; + sif::info << std::setw(30) << std::left << "Star Tracker" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledStarTracker.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutStarTracker.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutStarTracker.value << std::endl; + sif::info << std::setw(30) << std::left << "MGT" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledMGT.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutMGT.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutMGT.value << std::endl; + sif::info << std::setw(30) << std::left << "SuS nominal" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledSUSNominal.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutSUSNominal.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutSUSNominal.value << std::endl; + sif::info << std::setw(30) << std::left << "Solar Cell Experiment" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledSolarCellExp.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutSolarCellExp.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutSolarCellExp.value << std::endl; + sif::info << std::setw(30) << std::left << "PLOC" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledPLOC.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutPLOC.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutPLOC.value << std::endl; + sif::info << std::setw(30) << std::left << "ACS Side A" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledAcsBoardSideA.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutACSBoardSideA.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutACSBoardSideA.value << std::endl; + sif::info << std::setw(30) << std::left << "Channel 8" << std::dec << "| " << + static_cast(pdu1HkTableDataset.outEnabledChannel8.value) << ", " << + std::setw(4) << std::right << + pdu1HkTableDataset.currentOutChannel8.value << ", " << std::setw(4) << + pdu1HkTableDataset.voltageOutChannel8.value << std::right << std::endl; +} + diff --git a/mission/devices/PDU1Handler.h b/mission/devices/PDU1Handler.h index fa73b584..3df99776 100644 --- a/mission/devices/PDU1Handler.h +++ b/mission/devices/PDU1Handler.h @@ -2,7 +2,7 @@ #define MISSION_DEVICES_PDU1Handler_H_ #include "GomspaceDeviceHandler.h" -#include +#include "devicedefinitions/GomspaceDefinitions.h" /** * @brief This is the device handler for the PDU1. @@ -38,7 +38,7 @@ private: /** Dataset for the housekeeping table of the PDU1 */ PDU1::PDU1HkTableDataset pdu1HkTableDataset; - void printOutputSwitchStates(); + void printHkTable(); void parseHkTableReply(const uint8_t *packet); }; diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 06e60002..15166323 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -312,46 +312,14 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool( ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { switch(cmd) { - case(GOMSPACE::PRINT_ALL): { + case(GOMSPACE::PRINT_HK_TABLE): { PoolReadGuard pg(&pdu2HkTableDataset); ReturnValue_t readResult = pg.getReadResult(); if(readResult != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "Reading PDU2 HK table failed!" << std::endl; + sif::warning << "Reading PDU1 HK table failed!" << std::endl; return HasReturnvaluesIF::RETURN_FAILED; } - printOutputSwitchStates(); - printOutputCurrents(); - printOutputVoltages(); - return HasReturnvaluesIF::RETURN_OK; - } - case(GOMSPACE::PRINT_OUT_ENB_STATUS): { - PoolReadGuard pg(&pdu2HkTableDataset); - ReturnValue_t readResult = pg.getReadResult(); - if(readResult != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "Reading PDU2 HK table failed!" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - printOutputSwitchStates(); - return HasReturnvaluesIF::RETURN_OK; - } - case(GOMSPACE::PRINT_OUT_CURRENTS): { - PoolReadGuard pg(&pdu2HkTableDataset); - ReturnValue_t readResult = pg.getReadResult(); - if(readResult != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "Reading PDU2 HK table failed!" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - printOutputCurrents(); - return HasReturnvaluesIF::RETURN_OK; - } - case(GOMSPACE::PRINT_OUT_VOLTAGES): { - PoolReadGuard pg(&pdu2HkTableDataset); - ReturnValue_t readResult = pg.getReadResult(); - if(readResult != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "Reading PDU2 HK table failed!" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - printOutputVoltages(); + printHkTable(); return HasReturnvaluesIF::RETURN_OK; } default: { @@ -360,67 +328,51 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { } } -void PDU2Handler::printOutputSwitchStates() { - sif::info << "PDU2 Q7S enable state: " << - unsigned(pdu2HkTableDataset.outEnabledQ7S.value) << std::endl; - sif::info << "PDU2 Payload PCDU channel 1 enable state: " - << unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh1.value) << std::endl; - sif::info << "PDU2 reaction wheels enable state: " - << unsigned(pdu2HkTableDataset.outEnabledReactionWheels.value) << std::endl; - sif::info << "PDU2 TCS Board 8V heater input enable state: " - << unsigned(pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value) << std::endl; - sif::info << "PDU2 redundant SUS group enable state: " - << unsigned(pdu2HkTableDataset.outEnabledSUSRedundant.value) << std::endl; - sif::info << "PDU2 deployment mechanism enable state: " - << unsigned(pdu2HkTableDataset.outEnabledDeplMechanism.value) << std::endl; - sif::info << "PDU2 PCDU channel 6 enable state: " - << unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh6.value) << std::endl; - sif::info << "PDU2 ACS board side B enable state: " - << unsigned(pdu2HkTableDataset.outEnabledAcsBoardSideB.value) << std::endl; - sif::info << "PDU2 payload camera enable state: " - << unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << std::endl; -} - -void PDU2Handler::printOutputCurrents() { - sif::info << "Printing PDU2 currents [mA]: " << std::endl; - sif::info << "PDU2 Q7S:" << - pdu2HkTableDataset.currentOutQ7S.value << std::endl; - sif::info << "PDU2 Payload PCDU:" << - pdu2HkTableDataset.currentOutPayloadPCDUCh1.value << std::endl; - sif::info << "PDU2 RW:" << - pdu2HkTableDataset.currentOutReactionWheels.value << std::endl; - sif::info << "PDU2 TCS Board Heater In:" << - pdu2HkTableDataset.currentOutTCSBoardHeaterIn.value << std::endl; - sif::info << "PDU2 SuS Redundant:" << - pdu2HkTableDataset.currentOutSUSRedundant.value << std::endl; - sif::info << "PDU2 Depl-Mechanism:" << - pdu2HkTableDataset.currentOutDeplMechanism.value << std::endl; - sif::info << "PDU2 Payload PCDU:" << - pdu2HkTableDataset.currentOutPayloadPCDUCh6.value << std::endl; - sif::info << "PDU2 ACS Board:" << - pdu2HkTableDataset.currentOutACSBoardSideB.value << std::endl; - sif::info << "PDU2 Payload Camera:" << - pdu2HkTableDataset.currentOutPayloadCamera.value << std::endl; -} - -void PDU2Handler::printOutputVoltages() { - sif::info << "Printing PDU2 voltages [mV]: " << std::endl; - sif::info << "PDU2 Q7S:" << - pdu2HkTableDataset.voltageOutQ7S.value << std::endl; - sif::info << "PDU2 Payload PCDU:" << +void PDU2Handler::printHkTable() { + sif::info << "PDU2 Info: SwitchState, Voltages [mV], Currents [mA]" << std::endl; + sif::info << std::setw(30) << std::left << "Q7S" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledQ7S.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutQ7S.value << ", " << std::setw(4) << + pdu2HkTableDataset.voltageOutQ7S.value << std::endl; + sif::info << std::setw(30) << std::left << "Payload PCDU Channel 1" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh1.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutPayloadPCDUCh1.value << ", " << std::setw(4) << pdu2HkTableDataset.voltageOutPayloadPCDUCh1.value << std::endl; - sif::info << "PDU2 RW:" << + sif::info << std::setw(30) << std::left << "Reaction Wheels" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledReactionWheels.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutReactionWheels.value << ", " << std::setw(4) << pdu2HkTableDataset.voltageOutReactionWheels.value << std::endl; - sif::info << "PDU2 TCS Board Heater In:" << + sif::info << std::setw(30) << std::left << "TCS Board 8V heater input" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledTCSBoardHeaterIn.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutTCSBoardHeaterIn.value << ", " << std::setw(4) << pdu2HkTableDataset.voltageOutTCSBoardHeaterIn.value << std::endl; - sif::info << "PDU2 SuS Redundant:" << + sif::info << std::setw(30) << std::left << "Redundant SUS group" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledSUSRedundant.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutSUSRedundant.value << ", " << std::setw(4) << pdu2HkTableDataset.voltageOutSUSRedundant.value << std::endl; - sif::info << "PDU2 Depl-Mechanism:" << + sif::info << std::setw(30) << std::left << "Deployment mechanism" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledDeplMechanism.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutDeplMechanism.value << ", " << std::setw(4) << pdu2HkTableDataset.voltageOutDeplMechanism.value << std::endl; - sif::info << "PDU2 Payload PCDU:" << - pdu2HkTableDataset.voltageOutPayloadPCDUCh6.value << std::endl; - sif::info << "PDU2 ACS Board voltage:" << + sif::info << std::setw(30) << std::left << "Payload PCDU Channel 6" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledPlPCDUCh6.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutPayloadPCDUCh6.value << ", " << std::setw(4) << + pdu2HkTableDataset.voltageOutPayloadPCDUCh6.value<< std::endl; + sif::info << std::setw(30) << std::left << "ACS Board Side B" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledAcsBoardSideB.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutACSBoardSideB.value << ", " << std::setw(4) << pdu2HkTableDataset.voltageOutACSBoardSideB.value << std::endl; - sif::info << "PDU2 Payload Camera voltage:" << - pdu2HkTableDataset.voltageOutPayloadCamera.value << std::endl; + sif::info << std::setw(30) << std::left << "Payload Camera enable state" << std::dec << "| " << + unsigned(pdu2HkTableDataset.outEnabledPayloadCamera.value) << ", " << + std::setw(4) << std::right << + pdu2HkTableDataset.currentOutPayloadCamera.value << ", " << std::setw(4) << + pdu2HkTableDataset.voltageOutPayloadCamera.value << std::right << std::endl; } diff --git a/mission/devices/PDU2Handler.h b/mission/devices/PDU2Handler.h index 93f9200e..c44d1267 100644 --- a/mission/devices/PDU2Handler.h +++ b/mission/devices/PDU2Handler.h @@ -39,9 +39,7 @@ private: /** Dataset for the housekeeping table of the PDU2 */ PDU2::PDU2HkTableDataset pdu2HkTableDataset; - void printOutputSwitchStates(); - void printOutputCurrents(); - void printOutputVoltages(); + void printHkTable(); void parseHkTableReply(const uint8_t *packet); }; diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index 5f067bed..e14745a4 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -9,7 +9,7 @@ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEDEFINITIONS_H_ -#include +#include #include #include #include @@ -33,10 +33,8 @@ static const DeviceCommandId_t GNDWDT_RESET = 9; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PRINT_ALL = 32; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PRINT_OUT_ENB_STATUS = 33; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PRINT_OUT_CURRENTS = 34; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PRINT_OUT_VOLTAGES = 35; //!< [EXPORT] : [COMMAND] +//!< [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console +static const DeviceCommandId_t PRINT_HK_TABLE = 32; } diff --git a/tmtc b/tmtc index 58da80cb..f3a2e755 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 58da80cb9e2426e6b9d7fc1efb661077c35541f5 +Subproject commit f3a2e755fdc73ee791ea32dc6f2dfce43af70e60 -- 2.43.0 From cbb7fdfa9969ff090ed2b2f079cabc8dfee4ae05 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 20 Sep 2021 11:47:19 +0200 Subject: [PATCH 074/102] p60 print command --- mission/devices/GomspaceDeviceHandler.cpp | 4 +- mission/devices/P60DockHandler.cpp | 101 ++++++++++++++++-- mission/devices/P60DockHandler.h | 8 ++ mission/devices/PDU1Handler.cpp | 2 +- mission/devices/PDU2Handler.cpp | 2 +- .../devicedefinitions/GomspaceDefinitions.h | 5 +- tmtc | 2 +- 7 files changed, 109 insertions(+), 15 deletions(-) diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 348bd35e..e5912969 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -75,7 +75,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand( } break; } - case(GOMSPACE::PRINT_HK_TABLE): { + case(GOMSPACE::PRINT_SWITCH_V_I): { result = printStatus(deviceCommand); break; } @@ -99,7 +99,7 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap(){ this->insertInCommandAndReplyMap(GOMSPACE::PARAM_GET, 3); this->insertInCommandAndReplyMap(GOMSPACE::REQUEST_HK_TABLE, 3); this->insertInCommandMap(GOMSPACE::GNDWDT_RESET); - this->insertInCommandMap(GOMSPACE::PRINT_HK_TABLE); + this->insertInCommandMap(GOMSPACE::PRINT_SWITCH_V_I); } ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t *start, diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index 357bee30..928a9883 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -1,3 +1,4 @@ +#include #include "P60DockHandler.h" #include "OBSWConfig.h" @@ -27,15 +28,24 @@ void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t * #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_P60DOCK == 1 p60dockHkTableDataset.read(); - sif::info << "P60 Dock: ACU VCC switch: " << static_cast(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << std::endl; - sif::info << "P60 Dock: PDU1 VCC switch: " << static_cast(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value) << std::endl; - sif::info << "P60 Dock: PDU2 VCC switch: " << static_cast(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value) << std::endl; - sif::info << "P60 Dock: ACU VBAT switch: " << static_cast(p60dockHkTableDataset.outputEnableStateAcuVbat.value) << std::endl; - sif::info << "P60 Dock: PDU1 VBAT switch: " << static_cast(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value) << std::endl; - sif::info << "P60 Dock: PDU2 VBAT switch: " << static_cast(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value) << std::endl; - sif::info << "P60 Dock: Stack VBAT switch: " << static_cast(p60dockHkTableDataset.outputEnableStateStackVbat.value) << std::endl; - sif::info << "P60 Dock: Stack 3V3 switch: " << static_cast(p60dockHkTableDataset.outputEnableStateStack3V3.value) << std::endl; - sif::info << "P60 Dock: Stack 5V switch: " << static_cast(p60dockHkTableDataset.outputEnableStateStack5V.value) << std::endl; + sif::info << "P60 Dock: ACU VCC switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << std::endl; + sif::info << "P60 Dock: PDU1 VCC switch: " << + static_cast(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value) << std::endl; + sif::info << "P60 Dock: PDU2 VCC switch: " << + static_cast(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value) << std::endl; + sif::info << "P60 Dock: ACU VBAT switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateAcuVbat.value) << std::endl; + sif::info << "P60 Dock: PDU1 VBAT switch: " << + static_cast(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value) << std::endl; + sif::info << "P60 Dock: PDU2 VBAT switch: " << + static_cast(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value) << std::endl; + sif::info << "P60 Dock: Stack VBAT switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateStackVbat.value) << std::endl; + sif::info << "P60 Dock: Stack 3V3 switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateStack3V3.value) << std::endl; + sif::info << "P60 Dock: Stack 5V switch: " << + static_cast(p60dockHkTableDataset.outputEnableStateStack5V.value) << std::endl; float temperatureC = p60dockHkTableDataset.temperature1.value * 0.1; sif::info << "P60 Dock: Temperature 1: " << temperatureC << " °C" << std::endl; @@ -395,3 +405,76 @@ ReturnValue_t P60DockHandler::initializeLocalDataPool( return HasReturnvaluesIF::RETURN_OK; } + + +ReturnValue_t P60DockHandler::printStatus(DeviceCommandId_t cmd) { + switch(cmd) { + case(GOMSPACE::PRINT_SWITCH_V_I): { + PoolReadGuard pg(&p60dockHkTableDataset); + ReturnValue_t readResult = pg.getReadResult(); + if(readResult != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Reading PDU1 HK table failed!" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + printHkTable(); + return HasReturnvaluesIF::RETURN_OK; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } +} + +void P60DockHandler::printHkTable() { + sif::info << "P60 Dock Info: SwitchState, Voltages [mV], Currents [mA]" << std::endl; + + sif::info << std::setw(30) << std::left << "ACU VCC" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentAcuVcc.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageAcuVcc.value << std::endl; + sif::info << std::setw(30) << std::left << "ACU VBAT" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateAcuVbat.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentAcuVbat.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageAcuVbat.value << std::endl; + + sif::info << std::setw(30) << std::left << "PDU1 VCC" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStatePdu1Vcc.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentPdu1Vcc.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltagePdu1Vcc.value << std::endl; + sif::info << std::setw(30) << std::left << "PDU1 VBAT" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStatePdu1Vbat.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentPdu1Vbat.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltagePdu1Vbat.value << std::endl; + + sif::info << std::setw(30) << std::left << "PDU2 VCC" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStatePdu2Vcc.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentPdu2Vcc.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltagePdu2Vcc.value << std::endl; + sif::info << std::setw(30) << std::left << "PDU2 VBAT" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStatePdu2Vbat.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentPdu2Vbat.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltagePdu2Vbat.value << std::endl; + + sif::info << std::setw(30) << std::left << "Stack VBAT" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateStackVbat.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentStackVbat.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageStackVbat.value << std::endl; + sif::info << std::setw(30) << std::left << "Stack 3V3" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateStack3V3.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentStack3V3.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageStack3V3.value << std::endl; + sif::info << std::setw(30) << std::left << "Stack 5V" << std::dec << "| " << + unsigned(p60dockHkTableDataset.outputEnableStateStack5V.value) << ", " << + std::setw(4) << std::right << + p60dockHkTableDataset.currentStack5V.value << ", " << std::setw(5) << + p60dockHkTableDataset.voltageStack5V.value << std::endl; +} + diff --git a/mission/devices/P60DockHandler.h b/mission/devices/P60DockHandler.h index 6326e407..cee0ecec 100644 --- a/mission/devices/P60DockHandler.h +++ b/mission/devices/P60DockHandler.h @@ -26,6 +26,14 @@ protected: virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override; + /** + * This command handles printing the HK table to the console. This is useful for debugging + * purposes + * @return + */ + ReturnValue_t printStatus(DeviceCommandId_t cmd) override; + + void printHkTable(); private: P60Dock::HkTableDataset p60dockHkTableDataset; diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index 378a9589..a17b4abb 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -335,7 +335,7 @@ ReturnValue_t PDU1Handler::initializeLocalDataPool( ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { switch(cmd) { - case(GOMSPACE::PRINT_HK_TABLE): { + case(GOMSPACE::PRINT_SWITCH_V_I): { PoolReadGuard pg(&pdu1HkTableDataset); ReturnValue_t readResult = pg.getReadResult(); if(readResult != HasReturnvaluesIF::RETURN_OK) { diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 15166323..e0400b6f 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -312,7 +312,7 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool( ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { switch(cmd) { - case(GOMSPACE::PRINT_HK_TABLE): { + case(GOMSPACE::PRINT_SWITCH_V_I): { PoolReadGuard pg(&pdu2HkTableDataset); ReturnValue_t readResult = pg.getReadResult(); if(readResult != HasReturnvaluesIF::RETURN_OK) { diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index e14745a4..bd509239 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -34,7 +34,7 @@ static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND] //!< [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console -static const DeviceCommandId_t PRINT_HK_TABLE = 32; +static const DeviceCommandId_t PRINT_SWITCH_V_I = 32; } @@ -379,6 +379,9 @@ static const uint16_t HK_TABLE_REPLY_SIZE = 407; /** * @brief This class defines a dataset for the hk table of the P60 Dock. + * @details + * The GS port and X3 are not required for EIVE. X3 is another slot on the P60 dock and + * GS is required for a module from Gomspace which is not used. */ class HkTableDataset: public StaticLocalDataSet { diff --git a/tmtc b/tmtc index f3a2e755..53bf6508 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit f3a2e755fdc73ee791ea32dc6f2dfce43af70e60 +Subproject commit 53bf65083889af10f77c3899972b1153ea835f3c -- 2.43.0 From cf9ff87560680c3f7194ab5d179bcb5a577dec7a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 20 Sep 2021 14:34:39 +0200 Subject: [PATCH 075/102] bugfixes for new print commands --- .../pollingSequenceFactory.cpp | 186 +++++++++--------- mission/devices/P60DockHandler.cpp | 2 +- mission/devices/PDU1Handler.cpp | 4 +- mission/devices/PDU2Handler.cpp | 2 +- 4 files changed, 101 insertions(+), 93 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 0d189476..727334d2 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -425,93 +425,101 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); #if OBSW_ADD_ACS_BOARD == 1 - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + bool enableAside = false; + bool enableBside = true; + if(enableAside) { + // A side + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, + // DeviceHandlerIF::PERFORM_OPERATION); + // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, + // DeviceHandlerIF::SEND_WRITE); + // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, + // DeviceHandlerIF::GET_WRITE); + // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, + // DeviceHandlerIF::SEND_READ); + // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, + // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + } -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); -// - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + if(enableBside) { + // B side + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, + // DeviceHandlerIF::PERFORM_OPERATION); + // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.2, + // DeviceHandlerIF::SEND_WRITE); + // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.4, + // DeviceHandlerIF::GET_WRITE); + // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, + // DeviceHandlerIF::SEND_READ); + // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, + // DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + } #endif /* OBSW_ADD_ACS_BOARD == 1 */ if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { @@ -547,13 +555,13 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); + DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); + DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); + DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + DeviceHandlerIF::GET_READ); #endif thisSequence->addSlot(objects::PLOC_UPDATER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -563,13 +571,13 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); + DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); + DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); + DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); + DeviceHandlerIF::GET_READ); #endif #if Q7S_ADD_SYRLINKS_HANDLER == 1 diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index 928a9883..4ade2a0b 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -426,7 +426,7 @@ ReturnValue_t P60DockHandler::printStatus(DeviceCommandId_t cmd) { } void P60DockHandler::printHkTable() { - sif::info << "P60 Dock Info: SwitchState, Voltages [mV], Currents [mA]" << std::endl; + sif::info << "P60 Dock Info: SwitchState, Currents [mA], Voltages [mV]" << std::endl; sif::info << std::setw(30) << std::left << "ACU VCC" << std::dec << "| " << unsigned(p60dockHkTableDataset.outputEnableStateAcuVcc.value) << ", " << diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index a17b4abb..1676e488 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -352,7 +352,7 @@ ReturnValue_t PDU1Handler::printStatus(DeviceCommandId_t cmd) { } void PDU1Handler::printHkTable() { - sif::info << "PDU1 Info: SwitchState, Voltages [mV], Currents [mA]" << std::endl; + sif::info << "PDU1 Info: SwitchState, Currents [mA], Voltages [mV]" << std::endl; sif::info << std::setw(30) << std::left << "TCS Board" << std::dec << "| " << unsigned(pdu1HkTableDataset.outEnabledTCSBoard3V3.value) << ", " << std::setw(4) << std::right << @@ -362,7 +362,7 @@ void PDU1Handler::printHkTable() { unsigned(pdu1HkTableDataset.outEnabledSyrlinks.value) << ", " << std::setw(4) << std::right << pdu1HkTableDataset.currentOutSyrlinks.value << ", " << std::setw(4) << - pdu1HkTableDataset.currentOutSyrlinks.value << std::endl; + pdu1HkTableDataset.voltageOutSyrlinks.value << std::endl; sif::info << std::setw(30) << std::left << "Star Tracker" << std::dec << "| " << static_cast(pdu1HkTableDataset.outEnabledStarTracker.value) << ", " << std::setw(4) << std::right << diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index e0400b6f..287fdaf3 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -329,7 +329,7 @@ ReturnValue_t PDU2Handler::printStatus(DeviceCommandId_t cmd) { } void PDU2Handler::printHkTable() { - sif::info << "PDU2 Info: SwitchState, Voltages [mV], Currents [mA]" << std::endl; + sif::info << "PDU2 Info: SwitchState, Currents [mA], Voltages [mV]" << std::endl; sif::info << std::setw(30) << std::left << "Q7S" << std::dec << "| " << unsigned(pdu2HkTableDataset.outEnabledQ7S.value) << ", " << std::setw(4) << std::right << -- 2.43.0 From cd92f4a6112e7e50af5916debee55e378acfcb76 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 20 Sep 2021 16:30:50 +0200 Subject: [PATCH 076/102] open gpio by label test on te0720 --- bsp_q7s/core/InitMission.cpp | 2 ++ bsp_q7s/core/ObjectFactory.cpp | 16 +++++++++---- bsp_q7s/simple/simple.cpp | 4 ++++ linux/boardtest/LibgpiodTest.cpp | 39 ++++++++++++++++++++++++++++++-- linux/boardtest/LibgpiodTest.h | 3 ++- linux/fsfwconfig/OBSWConfig.h.in | 1 + 6 files changed, 57 insertions(+), 8 deletions(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 5ddb6b9b..481d4060 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -292,10 +292,12 @@ void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFuncti ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; PeriodicTaskIF* testTask = factory.createPeriodicTask( "TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc); +#if OBSW_ADD_TEST_TASK == 1 result = testTask->addComponent(objects::TEST_TASK); if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK); } +#endif /* OBSW_ADD_TEST_TASK == 1 */ #if OBSW_ADD_SPI_TEST_CODE == 1 result = testTask->addComponent(objects::SPI_TEST); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index bdad3dac..ad452c8d 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -529,8 +529,10 @@ void ObjectFactory::createHeaterComponents() { GpioCookie* heaterGpiosCookie = new GpioCookie; /* Pin H2-11 on stack connector */ - GpiodRegular* gpioConfigHeater0 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, - q7s::GPIO_HEATER_0_PIN, "Heater0", gpio::OUT, 0); + GpiodRegular* gpioConfigHeater0 = new GpiodRegular("Heater0", gpio::OUT, 0, "axi_gpio_q7_3v3", + q7s::GPIO_HEATER_0_PIN); +// GpiodRegular* gpioConfigHeater0 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, +// q7s::GPIO_HEATER_0_PIN, "Heater0", gpio::OUT, 0); heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0); /* Pin H2-12 on stack connector */ @@ -822,11 +824,15 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { #endif #if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 +#if OBSW_TEST_GPIO_LABEL == 1 /* Configure MIO0 as input */ - GpiodRegular gpioConfigMio0(std::string("gpiochip0"), 0, - std::string("MIO0"), gpio::IN, 0); + GpiodRegular* testGpio = new GpiodRegular("MIO0", gpio::OUT, 0, "/amba_pl/gpio@41200000", 0); +#else + /* Configure MIO0 as input */ + GpiodRegular* testGpio = new GpiodRegular("gpiochip0", 0, "MIO0", gpio::IN, 0); +#endif /* OBSW_TEST_GPIO_LABEL == 1 */ GpioCookie* gpioCookie = new GpioCookie; - gpioCookie->addGpio(gpioIds::TEST_ID_0, gpioConfigMio0); + gpioCookie->addGpio(gpioIds::TEST_ID_0, testGpio); new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie); #endif diff --git a/bsp_q7s/simple/simple.cpp b/bsp_q7s/simple/simple.cpp index a6bb9fdf..960aa7db 100644 --- a/bsp_q7s/simple/simple.cpp +++ b/bsp_q7s/simple/simple.cpp @@ -11,6 +11,10 @@ int simple::simple() { { FileSystemTest fileSystemTest; } +#endif + +#if TE0720_GPIO_TEST + #endif return 0; } diff --git a/linux/boardtest/LibgpiodTest.cpp b/linux/boardtest/LibgpiodTest.cpp index 39e863b4..8eb9b536 100644 --- a/linux/boardtest/LibgpiodTest.cpp +++ b/linux/boardtest/LibgpiodTest.cpp @@ -15,7 +15,7 @@ LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl; } gpioInterface->addGpios(gpioCookie); - testCase = TestCases::LOOPBACK; + testCase = TestCases::BLINK; } LibgpiodTest::~LibgpiodTest() { @@ -29,7 +29,7 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() { case(TestCases::READ): { result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState); if (result != RETURN_OK) { - sif::debug << "LibgpiodTest::performPeriodicAction: Failed to read gpio " + sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio " << std::endl; return RETURN_FAILED; } @@ -42,6 +42,38 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() { case(TestCases::LOOPBACK): { break; } + case(TestCases::BLINK): { + result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio " + << std::endl; + return RETURN_FAILED; + } + if (gpioState == 1) { + result = gpioInterface->pullLow(gpioIds::TEST_ID_0); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO low!" + << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + } + else if (gpioState == 0) { + result = gpioInterface->pullHigh(gpioIds::TEST_ID_0); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO high!" + << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + } + else { + sif::warning << "LibgpiodTest::performPeriodicAction: Invalid GPIO state" << std::endl; + } + + break; + } + default: + sif::debug << "LibgpiodTest::performPeriodicAction: Invalid test case" << std::endl; + break; } @@ -56,6 +88,9 @@ ReturnValue_t LibgpiodTest::performOneShotAction() { case(TestCases::READ): { break; } + case(TestCases::BLINK): { + break; + } case(TestCases::LOOPBACK): { result = gpioInterface->pullHigh(gpioIds::TEST_ID_0); if(result == HasReturnvaluesIF::RETURN_OK) { diff --git a/linux/boardtest/LibgpiodTest.h b/linux/boardtest/LibgpiodTest.h index a18c618e..718d0209 100644 --- a/linux/boardtest/LibgpiodTest.h +++ b/linux/boardtest/LibgpiodTest.h @@ -14,7 +14,8 @@ class LibgpiodTest: public TestTask { public: enum TestCases { READ = 0, - LOOPBACK = 1 + LOOPBACK = 1, + BLINK }; TestCases testCase; diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index dc397635..04a9fedd 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -59,6 +59,7 @@ debugging. */ #define OBSW_TEST_CCSDS_BRIDGE 0 #define OBSW_TEST_CCSDS_PTME 0 #define OBSW_TEST_TE7020_HEATER 0 +#define OBSW_TEST_GPIO_LABEL 0 #define OBSW_DEBUG_P60DOCK 0 #define OBSW_DEBUG_PDU1 0 -- 2.43.0 From 26162f8e784bc976eb313e3af66e9e25e8f0e5e1 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 20 Sep 2021 17:47:29 +0200 Subject: [PATCH 077/102] gpio chips now opened by label --- bsp_q7s/boardconfig/busConf.h | 33 ++-- bsp_q7s/core/ObjectFactory.cpp | 313 +++++++++++++++---------------- bsp_q7s/gpio/gpioCallbacks.cpp | 29 +-- linux/boardtest/SpiTestClass.cpp | 48 ++--- 4 files changed, 207 insertions(+), 216 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index 257883cd..f5b4a860 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -19,18 +19,18 @@ static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2"; /**************************************************************/ /** OBC1E */ /**************************************************************/ -static constexpr char GPIO_MULTIPURPOSE_1V8_OBC1D[] = "gpiochip4"; -static const char* const GPIO_GYRO_ADIS_CHIP = GPIO_MULTIPURPOSE_1V8_OBC1D; +static constexpr char GPIO_MULTIPURPOSE_1V8_OBC1D[] = "/amba_pl/gpio@42020000"; +static const char* const GPIO_GYRO_ADIS_LABEL = GPIO_MULTIPURPOSE_1V8_OBC1D; static constexpr uint32_t GPIO_GYRO_0_ADIS_CS = 0; // Package Pin: W20 static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 2; // AA22 /**************************************************************/ /** OBC1F B0 */ /**************************************************************/ -static constexpr char GPIO_FLEX_OBC1F_B0[] = "gpiochip5"; -static const char* const GPIO_ACS_BOARD_DEFAULT_CHIP = GPIO_FLEX_OBC1F_B0; -static const char* const GPIO_RW_DEFAULT_CHIP = GPIO_FLEX_OBC1F_B0; -static const char* const GPIO_RAD_SENSOR_CHIP = GPIO_FLEX_OBC1F_B0; +static constexpr char GPIO_FLEX_OBC1F_B0[] = "/amba_pl/gpio@42030000"; +static const char* const GPIO_ACS_BOARD_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0; +static const char* const GPIO_RW_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0; +static const char* const GPIO_RAD_SENSOR_LABEL = GPIO_FLEX_OBC1F_B0; static constexpr uint32_t GPIO_RW_0_CS = 7; // B20 static constexpr uint32_t GPIO_RW_1_CS = 3; // G22 @@ -40,7 +40,6 @@ static constexpr uint32_t GPIO_RW_3_CS = 6; // B19 static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 18; // N22 static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 1; // M21 static constexpr uint32_t GPIO_MGM_0_LIS3_CS = 5; // C18 -// MGM_2 is part of gpiochip6 static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16; // A16 static constexpr uint32_t GPIO_MGM_3_RM3100_CS = 10; // C17 @@ -56,16 +55,16 @@ static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; // R18 /**************************************************************/ /** OBC1F B1 */ /**************************************************************/ -static constexpr char GPIO_FLEX_OBC1F_B1[] = "gpiochip6"; -static const char* const GPIO_MGM2_LIS3_CHIP = GPIO_FLEX_OBC1F_B1; +static constexpr char GPIO_FLEX_OBC1F_B1[] = "/amba_pl/gpio@42030000"; +static const char* const GPIO_MGM2_LIS3_LABEL = GPIO_FLEX_OBC1F_B1; static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0; // D18 /**************************************************************/ /** OBC1C */ /**************************************************************/ -static constexpr char GPIO_3V3_OBC1C[] = "gpiochip7"; -static const char* const GPIO_HEATER_CHIP = GPIO_3V3_OBC1C; -static const char* const GPIO_SOLAR_ARR_DEPL_CHIP = GPIO_3V3_OBC1C; +static constexpr char GPIO_3V3_OBC1C[] = "/amba_pl/gpio@42040000"; +static const char* const GPIO_HEATER_LABEL = GPIO_3V3_OBC1C; +static const char* const GPIO_SOLAR_ARR_DEPL_LABEL = GPIO_3V3_OBC1C; static constexpr uint32_t GPIO_HEATER_0_PIN = 6; static constexpr uint32_t GPIO_HEATER_1_PIN = 12; static constexpr uint32_t GPIO_HEATER_2_PIN = 7; @@ -79,10 +78,18 @@ static constexpr uint32_t GPIO_GYRO_2_ENABLE = 18; // F22 static constexpr uint32_t GPIO_SOL_DEPL_SA_0_PIN = 4; static constexpr uint32_t GPIO_SOL_DEPL_SA_1_PIN = 2; -static constexpr char GPIO_RW_SPI_MUX_CHIP[] = "gpiochip11"; +static constexpr char GPIO_RW_SPI_MUX_LABEL[] = "zynq_gpio"; // Uses EMIO interface to PL, starts at 54 static constexpr uint32_t GPIO_RW_SPI_MUX_CS = 54; +static constexpr uint32_t SPI_MUX_BIT_1 = 13; +static constexpr uint32_t SPI_MUX_BIT_2 = 14; +static constexpr uint32_t SPI_MUX_BIT_3 = 15; +static constexpr uint32_t SPI_MUX_BIT_4 = 16; +static constexpr uint32_t SPI_MUX_BIT_5 = 17; +static constexpr uint32_t SPI_MUX_BIT_6 = 9; +static constexpr uint32_t EN_RW_CS = 17; + } #endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */ diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 7be56baa..e8be0ef1 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -109,7 +109,7 @@ void Factory::setStaticFrameworkObjectIds() { TmPacketBase::timeStamperId = objects::TIME_STAMPER; } -void ObjectFactory::produce(void* args){ +void ObjectFactory::produce(void* args) { ObjectFactory::setStatics(); ObjectFactory::produceGenericObjects(); LinuxLibgpioIF* gpioComIF = nullptr; @@ -137,8 +137,8 @@ void ObjectFactory::produce(void* args){ createRtdComponents(); #endif /* Q7S_ADD_RTD_DEVICES == 1 */ - I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, - IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV); + I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, + q7s::I2C_DEFAULT_DEV); new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie); createReactionWheelComponents(gpioComIF); @@ -175,13 +175,13 @@ void ObjectFactory::produce(void* args){ auto udpBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); sif::info << "Created UDP server for TMTC commanding with listener port " << - udpBridge->getUdpPort() << std::endl; + udpBridge->getUdpPort() << std::endl; #else auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); tmtcBridge->setMaxNumberOfPacketsStored(50); auto tcpServer = new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); - sif::info << "Created TCP server for TMTC commanding with listener port " << - tcpServer->getTcpPort() << std::endl; + sif::info << "Created TCP server for TMTC commanding with listener port " + << tcpServer->getTcpPort() << std::endl; #endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */ /* Test Task */ @@ -207,19 +207,17 @@ void ObjectFactory::createTmpComponents() { #endif /* Temperature sensors */ - Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler( - objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, - i2cCookieTmp1075tcs1); + Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler(objects::TMP1075_HANDLER_1, + objects::I2C_COM_IF, i2cCookieTmp1075tcs1); (void) tmp1075Handler_1; - Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler( - objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, - i2cCookieTmp1075tcs2); + Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler(objects::TMP1075_HANDLER_2, + objects::I2C_COM_IF, i2cCookieTmp1075tcs2); (void) tmp1075Handler_2; } -void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF, - UartComIF** uartComIF, SpiComIF** spiComIF) { - if(gpioComIF == nullptr or uartComIF == nullptr or spiComIF == nullptr) { +void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF, UartComIF** uartComIF, + SpiComIF** spiComIF) { + if (gpioComIF == nullptr or uartComIF == nullptr or spiComIF == nullptr) { sif::error << "ObjectFactory::createCommunicationInterfaces: Invalid passed ComIF pointer" << std::endl; } @@ -240,23 +238,19 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF, } void ObjectFactory::createPcduComponents() { - CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, - addresses::P60DOCK); - CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, - addresses::PDU1); - CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, - addresses::PDU2); - CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, - addresses::ACU); + CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, addresses::P60DOCK); + CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU1); + CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2); + CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, addresses::ACU); /* Device Handler */ P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie); - PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER, - objects::CSP_COM_IF, pdu1CspCookie); - PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER, - objects::CSP_COM_IF, pdu2CspCookie); - ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, - objects::CSP_COM_IF, acuCspCookie); + PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, + pdu1CspCookie); + PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, + pdu2CspCookie); + ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, + acuCspCookie); new PCDUHandler(objects::PCDU_HANDLER, 50); /** @@ -271,8 +265,8 @@ void ObjectFactory::createPcduComponents() { void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) { GpioCookie* gpioCookieRadSensor = new GpioCookie; - GpiodRegular* chipSelectRadSensor = new GpiodRegular(q7s::GPIO_RAD_SENSOR_CHIP, - q7s::GPIO_RAD_SENSOR_CS, "Chip Select Radiation Sensor", gpio::OUT, 1); + GpiodRegular* chipSelectRadSensor = new GpiodRegular("Chip Select Radiation Sensor", gpio::OUT, + 1, q7s::GPIO_RAD_SENSOR_LABEL, q7s::GPIO_RAD_SENSOR_CS); gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor); gpioComIF->addGpios(gpioCookieRadSensor); @@ -282,8 +276,7 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) { new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor); } -void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, - SpiComIF* spiComIF) { +void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, SpiComIF* spiComIF) { GpioCookie* gpioCookieSus = new GpioCookie(); GpioCallback* susgpio = nullptr; @@ -400,46 +393,46 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComIF* uartComIF) { GpioCookie* gpioCookieAcsBoard = new GpioCookie(); GpiodRegular* gpio = nullptr; - gpio = new GpiodRegular(q7s::GPIO_GYRO_ADIS_CHIP, q7s::GPIO_GYRO_0_ADIS_CS, - "CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH); + gpio = new GpiodRegular("CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, + q7s::GPIO_GYRO_0_ADIS_CS); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_1_L3G_CS, - "CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH); + gpio = new GpiodRegular("CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH, + q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_1_L3G_CS); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_GYRO_ADIS_CHIP, q7s::GPIO_GYRO_2_ADIS_CS, - "CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH); + gpio = new GpiodRegular("CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, + q7s::GPIO_GYRO_2_ADIS_CS); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_GYRO_3_L3G_CS, - "CS_GYRO_3_L3G", gpio::OUT, gpio::HIGH); + gpio = new GpiodRegular("CS_GYRO_3_L3G", gpio::OUT, gpio::HIGH, + q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_3_L3G_CS); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_MGM_0_LIS3_CS, - "CS_MGM_0_LIS3_A", gpio::OUT, gpio::HIGH); + gpio = new GpiodRegular("CS_MGM_0_LIS3_A", gpio::OUT, gpio::HIGH, + q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_0_LIS3_CS); gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_MGM_1_RM3100_CS, - "CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH); + gpio = new GpiodRegular("CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH, + q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_1_RM3100_CS); gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_MGM2_LIS3_CHIP, q7s::GPIO_MGM_2_LIS3_CS, - "CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH); + gpio = new GpiodRegular("CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH, q7s::GPIO_MGM2_LIS3_LABEL, + q7s::GPIO_MGM_2_LIS3_CS); gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_MGM_3_RM3100_CS, - "CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH); + gpio = new GpiodRegular("CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH, + q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_3_RM3100_CS); gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); // GNSS reset pins are active low - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_RESET_GNSS_0, - "GNSS_0_NRESET", gpio::OUT, gpio::HIGH); + gpio = new GpiodRegular("GNSS_0_NRESET", gpio::OUT, gpio::HIGH, + q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_0); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_NRESET, gpio); - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, q7s::GPIO_RESET_GNSS_1, - "GNSS_1_NRESET", gpio::OUT, gpio::HIGH); + gpio = new GpiodRegular("GNSS_1_NRESET", gpio::OUT, gpio::HIGH, + q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_1); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio); // Enable pins must be pulled low for regular operations - gpio = new GpiodRegular(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE, - "GYRO_0_ENABLE", gpio::OUT, gpio::LOW); + gpio = new GpiodRegular("GYRO_0_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_FLEX_OBC1F_B0, + q7s::GPIO_GYRO_0_ENABLE); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ENABLE, gpio); - gpio = new GpiodRegular(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE, - "GYRO_2_ENABLE", gpio::OUT, gpio::LOW); + gpio = new GpiodRegular("GYRO_2_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_3V3_OBC1C, + q7s::GPIO_GYRO_2_ENABLE); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ENABLE, gpio); // TODO: Add enable pins for GPS as soon as new interface board design is finished @@ -448,8 +441,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI std::string spiDev = q7s::SPI_DEFAULT_DEV; SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); - auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, - objects::SPI_COM_IF, spiCookie, 0); + auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF, + spiCookie, 0); mgmLis3Handler->setStartUpImmediately(); #if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 mgmLis3Handler->setToGoToNormalMode(true); @@ -457,8 +450,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); - auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, - objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_A); + auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, + spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_A); mgmRm3100Handler->setStartUpImmediately(); #if FSFW_HAL_RM3100_MGM_DEBUG == 1 mgmRm3100Handler->setToGoToNormalMode(true); @@ -466,8 +459,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); - auto mgmLis3Handler2 = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, - objects::SPI_COM_IF, spiCookie, 0); + auto mgmLis3Handler2 = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, + spiCookie, 0); mgmLis3Handler2->setStartUpImmediately(); #if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 mgmLis3Handler2->setToGoToNormalMode(true); @@ -475,8 +468,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); - mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, - objects::SPI_COM_IF, spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_B); + mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, + spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_B); mgmRm3100Handler->setStartUpImmediately(); #if FSFW_HAL_RM3100_MGM_DEBUG == 1 mgmRm3100Handler->setToGoToNormalMode(true); @@ -487,14 +480,14 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED); - auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, - objects::SPI_COM_IF, spiCookie); + auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, + spiCookie); adisHandler->setStartUpImmediately(); // Gyro 1 Side A spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); - auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, - objects::SPI_COM_IF, spiCookie, 0); + auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, + spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); #if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 gyroL3gHandler->setGoNormalModeAtStartup(); @@ -503,14 +496,14 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED); - adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, - objects::SPI_COM_IF, spiCookie); + adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, + spiCookie); adisHandler->setStartUpImmediately(); // Gyro 3 Side B spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); - gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, - objects::SPI_COM_IF, spiCookie, 0); + gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, + spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); #if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 gyroL3gHandler->setGoNormalModeAtStartup(); @@ -549,40 +542,37 @@ void ObjectFactory::createHeaterComponents() { GpioCookie* heaterGpiosCookie = new GpioCookie; /* Pin H2-11 on stack connector */ - GpiodRegular* gpioConfigHeater0 = new GpiodRegular("Heater0", gpio::OUT, 0, "axi_gpio_q7_3v3", - q7s::GPIO_HEATER_0_PIN); -// GpiodRegular* gpioConfigHeater0 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, -// q7s::GPIO_HEATER_0_PIN, "Heater0", gpio::OUT, 0); + GpiodRegular* gpioConfigHeater0 = new GpiodRegular("Heater0", gpio::OUT, 0, + q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_0_PIN); heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0); - /* Pin H2-12 on stack connector */ - GpiodRegular* gpioConfigHeater1 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, - q7s::GPIO_HEATER_1_PIN, "Heater1", gpio::OUT, 0); + GpiodRegular* gpioConfigHeater1 = new GpiodRegular("Heater1", gpio::OUT, 0, + q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_1_PIN); heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1); /* Pin H2-13 on stack connector */ - GpiodRegular* gpioConfigHeater2 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, - q7s::GPIO_HEATER_2_PIN, "Heater2", gpio::OUT, 0); + GpiodRegular* gpioConfigHeater2 = new GpiodRegular("Heater2", gpio::OUT, 0, + q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_2_PIN); heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2); - GpiodRegular* gpioConfigHeater3 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, - q7s::GPIO_HEATER_3_PIN, "Heater3", gpio::OUT, 0); + GpiodRegular* gpioConfigHeater3 = new GpiodRegular("Heater3", gpio::OUT, 0, + q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_3_PIN); heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3); - GpiodRegular* gpioConfigHeater4 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, - q7s::GPIO_HEATER_4_PIN, "Heater4", gpio::OUT, 0); + GpiodRegular* gpioConfigHeater4 = new GpiodRegular("Heater4", gpio::OUT, 0, + q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_4_PIN); heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4); - GpiodRegular* gpioConfigHeater5 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, - q7s::GPIO_HEATER_5_PIN, "Heater5", gpio::OUT, 0); + GpiodRegular* gpioConfigHeater5 = new GpiodRegular("Heater5", gpio::OUT, 0, + q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_5_PIN); heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5); - GpiodRegular* gpioConfigHeater6 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, - q7s::GPIO_HEATER_6_PIN, "Heater6", gpio::OUT, 0); + GpiodRegular* gpioConfigHeater6 = new GpiodRegular("Heater6", gpio::OUT, 0, + q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_6_PIN); heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6); - GpiodRegular* gpioConfigHeater7 = new GpiodRegular(q7s::GPIO_HEATER_CHIP, - q7s::GPIO_HEATER_7_PIN, "Heater7", gpio::OUT, 0); + GpiodRegular* gpioConfigHeater7 = new GpiodRegular("Heater7", gpio::OUT, 0, + q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_7_PIN); heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7); new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie, @@ -592,11 +582,11 @@ void ObjectFactory::createHeaterComponents() { void ObjectFactory::createSolarArrayDeploymentComponents() { GpioCookie* solarArrayDeplCookie = new GpioCookie; - GpiodRegular* gpioConfigDeplSA0 = new GpiodRegular(q7s::GPIO_SOLAR_ARR_DEPL_CHIP, - q7s::GPIO_SOL_DEPL_SA_0_PIN, "DeplSA0", gpio::OUT, 0); + GpiodRegular* gpioConfigDeplSA0 = new GpiodRegular("DeplSA0", gpio::OUT, 0, + q7s::GPIO_SOLAR_ARR_DEPL_LABEL, q7s::GPIO_SOL_DEPL_SA_0_PIN); solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpioConfigDeplSA0); - GpiodRegular* gpioConfigDeplSA1 = new GpiodRegular(q7s::GPIO_SOLAR_ARR_DEPL_CHIP, - q7s::GPIO_SOL_DEPL_SA_1_PIN, "DeplSA1", gpio::OUT, 0); + GpiodRegular* gpioConfigDeplSA1 = new GpiodRegular("DeplSA1", gpio::OUT, 0, + q7s::GPIO_SOLAR_ARR_DEPL_LABEL, q7s::GPIO_SOL_DEPL_SA_1_PIN); solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpioConfigDeplSA1); //TODO: Find out burn time. For now set to 1000 ms. @@ -668,69 +658,62 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) { gpioComIF->addGpios(rtdGpioCookie); - SpiCookie* spiRtdIc3 = new SpiCookie(addresses::RTD_IC3, gpioIds::RTD_IC3, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc4 = new SpiCookie(addresses::RTD_IC4, gpioIds::RTD_IC4, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc5 = new SpiCookie(addresses::RTD_IC5, gpioIds::RTD_IC5, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc6 = new SpiCookie(addresses::RTD_IC6, gpioIds::RTD_IC6, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc7 = new SpiCookie(addresses::RTD_IC7, gpioIds::RTD_IC7, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc8 = new SpiCookie(addresses::RTD_IC8, gpioIds::RTD_IC8, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); - SpiCookie* spiRtdIc9 = new SpiCookie(addresses::RTD_IC9, gpioIds::RTD_IC9, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); + SpiCookie* spiRtdIc3 = new SpiCookie(addresses::RTD_IC3, gpioIds::RTD_IC3, q7s::SPI_DEFAULT_DEV, + Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); + SpiCookie* spiRtdIc4 = new SpiCookie(addresses::RTD_IC4, gpioIds::RTD_IC4, q7s::SPI_DEFAULT_DEV, + Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); + SpiCookie* spiRtdIc5 = new SpiCookie(addresses::RTD_IC5, gpioIds::RTD_IC5, q7s::SPI_DEFAULT_DEV, + Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); + SpiCookie* spiRtdIc6 = new SpiCookie(addresses::RTD_IC6, gpioIds::RTD_IC6, q7s::SPI_DEFAULT_DEV, + Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); + SpiCookie* spiRtdIc7 = new SpiCookie(addresses::RTD_IC7, gpioIds::RTD_IC7, q7s::SPI_DEFAULT_DEV, + Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); + SpiCookie* spiRtdIc8 = new SpiCookie(addresses::RTD_IC8, gpioIds::RTD_IC8, q7s::SPI_DEFAULT_DEV, + Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); + SpiCookie* spiRtdIc9 = new SpiCookie(addresses::RTD_IC9, gpioIds::RTD_IC9, q7s::SPI_DEFAULT_DEV, + Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); SpiCookie* spiRtdIc10 = new SpiCookie(addresses::RTD_IC10, gpioIds::RTD_IC10, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + spi::RTD_SPEED); SpiCookie* spiRtdIc11 = new SpiCookie(addresses::RTD_IC11, gpioIds::RTD_IC11, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + spi::RTD_SPEED); SpiCookie* spiRtdIc12 = new SpiCookie(addresses::RTD_IC12, gpioIds::RTD_IC12, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + spi::RTD_SPEED); SpiCookie* spiRtdIc13 = new SpiCookie(addresses::RTD_IC13, gpioIds::RTD_IC13, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + spi::RTD_SPEED); SpiCookie* spiRtdIc14 = new SpiCookie(addresses::RTD_IC14, gpioIds::RTD_IC14, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + spi::RTD_SPEED); SpiCookie* spiRtdIc15 = new SpiCookie(addresses::RTD_IC15, gpioIds::RTD_IC15, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + spi::RTD_SPEED); SpiCookie* spiRtdIc16 = new SpiCookie(addresses::RTD_IC16, gpioIds::RTD_IC16, std::string(q7s::SPI_DEFAULT_DEV), Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED); SpiCookie* spiRtdIc17 = new SpiCookie(addresses::RTD_IC17, gpioIds::RTD_IC17, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + spi::RTD_SPEED); SpiCookie* spiRtdIc18 = new SpiCookie(addresses::RTD_IC18, gpioIds::RTD_IC18, - q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, - spi::SpiModes::MODE_1, spi::RTD_SPEED); + q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, + spi::RTD_SPEED); - Max31865PT1000Handler* rtdIc3 = new Max31865PT1000Handler(objects::RTD_IC3, - objects::SPI_COM_IF, spiRtdIc3, 0); // 0 is switchId - Max31865PT1000Handler* rtdIc4 = new Max31865PT1000Handler(objects::RTD_IC4, - objects::SPI_COM_IF, spiRtdIc4, 0); - Max31865PT1000Handler* rtdIc5 = new Max31865PT1000Handler(objects::RTD_IC5, - objects::SPI_COM_IF, spiRtdIc5, 0); - Max31865PT1000Handler* rtdIc6 = new Max31865PT1000Handler(objects::RTD_IC6, - objects::SPI_COM_IF, spiRtdIc6, 0); - Max31865PT1000Handler* rtdIc7 = new Max31865PT1000Handler(objects::RTD_IC7, - objects::SPI_COM_IF, spiRtdIc7, 0); - Max31865PT1000Handler* rtdIc8 = new Max31865PT1000Handler(objects::RTD_IC8, - objects::SPI_COM_IF, spiRtdIc8, 0); - Max31865PT1000Handler* rtdIc9 = new Max31865PT1000Handler(objects::RTD_IC9, - objects::SPI_COM_IF, spiRtdIc9, 0); + Max31865PT1000Handler* rtdIc3 = new Max31865PT1000Handler(objects::RTD_IC3, objects::SPI_COM_IF, + spiRtdIc3, 0); // 0 is switchId + Max31865PT1000Handler* rtdIc4 = new Max31865PT1000Handler(objects::RTD_IC4, objects::SPI_COM_IF, + spiRtdIc4, 0); + Max31865PT1000Handler* rtdIc5 = new Max31865PT1000Handler(objects::RTD_IC5, objects::SPI_COM_IF, + spiRtdIc5, 0); + Max31865PT1000Handler* rtdIc6 = new Max31865PT1000Handler(objects::RTD_IC6, objects::SPI_COM_IF, + spiRtdIc6, 0); + Max31865PT1000Handler* rtdIc7 = new Max31865PT1000Handler(objects::RTD_IC7, objects::SPI_COM_IF, + spiRtdIc7, 0); + Max31865PT1000Handler* rtdIc8 = new Max31865PT1000Handler(objects::RTD_IC8, objects::SPI_COM_IF, + spiRtdIc8, 0); + Max31865PT1000Handler* rtdIc9 = new Max31865PT1000Handler(objects::RTD_IC9, objects::SPI_COM_IF, + spiRtdIc9, 0); Max31865PT1000Handler* rtdIc10 = new Max31865PT1000Handler(objects::RTD_IC10, objects::SPI_COM_IF, spiRtdIc10, 0); Max31865PT1000Handler* rtdIc11 = new Max31865PT1000Handler(objects::RTD_IC11, @@ -770,30 +753,30 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) { void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { GpioCookie* gpioCookieRw = new GpioCookie; - GpioCallback* csRw1 = new GpioCallback("Chip select reaction wheel 1", gpio::OUT, - gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + GpioCallback* csRw1 = new GpioCallback("Chip select reaction wheel 1", gpio::OUT, gpio::HIGH, + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieRw->addGpio(gpioIds::CS_RW1, csRw1); - GpioCallback* csRw2 = new GpioCallback("Chip select reaction wheel 2", gpio::OUT, - gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + GpioCallback* csRw2 = new GpioCallback("Chip select reaction wheel 2", gpio::OUT, gpio::HIGH, + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieRw->addGpio(gpioIds::CS_RW2, csRw2); - GpioCallback* csRw3 = new GpioCallback("Chip select reaction wheel 3", gpio::OUT, - gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + GpioCallback* csRw3 = new GpioCallback("Chip select reaction wheel 3", gpio::OUT, gpio::HIGH, + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieRw->addGpio(gpioIds::CS_RW3, csRw3); - GpioCallback* csRw4 = new GpioCallback("Chip select reaction wheel 4", gpio::OUT, - gpio::HIGH, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); + GpioCallback* csRw4 = new GpioCallback("Chip select reaction wheel 4", gpio::OUT, gpio::HIGH, + &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4); - GpiodRegular* enRw1 = new GpiodRegular(q7s::GPIO_RW_DEFAULT_CHIP, q7s::GPIO_RW_0_CS, - "Enable reaction wheel 1", gpio::OUT, 0); + GpiodRegular* enRw1 = new GpiodRegular("Enable reaction wheel 1", gpio::OUT, 0, + q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS); gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); - GpiodRegular* enRw2 = new GpiodRegular(q7s::GPIO_RW_DEFAULT_CHIP, q7s::GPIO_RW_1_CS, - "Enable reaction wheel 2", gpio::OUT, 0); + GpiodRegular* enRw2 = new GpiodRegular("Enable reaction wheel 2", gpio::OUT, 0, + q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS); gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2); - GpiodRegular* enRw3 = new GpiodRegular(q7s::GPIO_RW_DEFAULT_CHIP, q7s::GPIO_RW_2_CS, - "Enable reaction wheel 3", gpio::OUT, 0); + GpiodRegular* enRw3 = new GpiodRegular("Enable reaction wheel 3", gpio::OUT, 0, + q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS); gpioCookieRw->addGpio(gpioIds::EN_RW3, enRw3); - GpiodRegular* enRw4 = new GpiodRegular(q7s::GPIO_RW_DEFAULT_CHIP, q7s::GPIO_RW_3_CS, - "Enable reaction wheel 4", gpio::OUT, 0); + GpiodRegular* enRw4 = new GpiodRegular("Enable reaction wheel 4", gpio::OUT, 0, + q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_3_CS); gpioCookieRw->addGpio(gpioIds::EN_RW4, enRw4); /** @@ -801,8 +784,8 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { * the PS SPI peripheral from the SPI interface and route out the SPI lines of the AXI SPI core. * Per default the PS SPI is selected (EMIO = 0). */ - GpiodRegular* spiMux = new GpiodRegular(q7s::GPIO_RW_SPI_MUX_CHIP, q7s::GPIO_RW_SPI_MUX_CS, - "EMIO 0 SPI Mux", gpio::OUT, 0); + GpiodRegular* spiMux = new GpiodRegular("EMIO 0 SPI Mux", gpio::OUT, 0, + q7s::GPIO_RW_SPI_MUX_LABEL, q7s::GPIO_RW_SPI_MUX_CS); gpioCookieRw->addGpio(gpioIds::SPI_MUX, spiMux); gpioComIF->addGpios(gpioCookieRw); diff --git a/bsp_q7s/gpio/gpioCallbacks.cpp b/bsp_q7s/gpio/gpioCallbacks.cpp index 34c927ed..da3678c6 100644 --- a/bsp_q7s/gpio/gpioCallbacks.cpp +++ b/bsp_q7s/gpio/gpioCallbacks.cpp @@ -1,4 +1,5 @@ #include "gpioCallbacks.h" +#include "busConf.h" #include #include @@ -24,29 +25,29 @@ void initSpiCsDecoder(GpioIF* gpioComIF) { GpioCookie* spiMuxGpios = new GpioCookie; /** Setting mux bit 1 to low will disable IC21 on the interface board */ - GpiodRegular* spiMuxBit1 = new GpiodRegular(std::string("gpiochip7"), 13, - std::string("SPI Mux Bit 1"), gpio::OUT, 0); + GpiodRegular* spiMuxBit1 = new GpiodRegular(std::string("SPI Mux Bit 1"), gpio::OUT, 0, + q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_1); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit1); /** Setting mux bit 2 to low disables IC1 on the TCS board */ - GpiodRegular* spiMuxBit2 = new GpiodRegular(std::string("gpiochip7"), 14, - std::string("SPI Mux Bit 2"), gpio::OUT, 0); + GpiodRegular* spiMuxBit2 = new GpiodRegular(std::string("SPI Mux Bit 2"), gpio::OUT, 0, + q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_2); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit2); /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */ - GpiodRegular* spiMuxBit3 = new GpiodRegular(std::string("gpiochip7"), 15, - std::string("SPI Mux Bit 3"), gpio::OUT, 0); + GpiodRegular* spiMuxBit3 = new GpiodRegular(std::string("SPI Mux Bit 3"), gpio::OUT, 0, + q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_3); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit3); /** The following gpios can take arbitrary initial values */ - GpiodRegular* spiMuxBit4 = new GpiodRegular(std::string("gpiochip7"), 16, - std::string("SPI Mux Bit 4"), gpio::OUT, 0); + GpiodRegular* spiMuxBit4 = new GpiodRegular(std::string("SPI Mux Bit 4"), gpio::OUT, 0, + q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_4); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit4); - GpiodRegular* spiMuxBit5 = new GpiodRegular(std::string("gpiochip7"), 17, - std::string("SPI Mux Bit 5"), gpio::OUT, 0); + GpiodRegular* spiMuxBit5 = new GpiodRegular(std::string("SPI Mux Bit 5"), gpio::OUT, 0, + q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_5); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit5); - GpiodRegular* spiMuxBit6 = new GpiodRegular(std::string("gpiochip7"), 9, - std::string("SPI Mux Bit 6"), gpio::OUT, 0); + GpiodRegular* spiMuxBit6 = new GpiodRegular(std::string("SPI Mux Bit 6"), gpio::OUT, 0, + q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_6); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit6); - GpiodRegular* enRwDecoder = new GpiodRegular(std::string("gpiochip5"), 17, - std::string("EN_RW_CS"), gpio::OUT, 1); + GpiodRegular* enRwDecoder = new GpiodRegular(std::string("EN_RW_CS"), gpio::OUT, 1, + q7s::GPIO_FLEX_OBC1F_B1, q7s::EN_RW_CS); spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder); result = gpioComInterface->addGpios(spiMuxGpios); diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index bdd9a2dd..e69c63e5 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -299,7 +299,7 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { void SpiTestClass::acsInit() { GpioCookie* gpioCookie = new GpioCookie(); GpiodRegular* gpio = nullptr; -#ifdef RASPBERRY_PI + #ifdef RASPBERRY_PI std::string rpiGpioName = "gpiochip0"; gpio = new GpiodRegular(rpiGpioName, mgm0Lis3mdlChipSelect, "MGM_0_LIS3", gpio::Direction::OUT, 1); @@ -328,43 +328,43 @@ void SpiTestClass::acsInit() { gpio = new GpiodRegular(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); -#elif defined(XIPHOS_Q7S) + #elif defined(XIPHOS_Q7S) - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, mgm0Lis3mdlChipSelect, - "MGM_0_LIS3", gpio::Direction::OUT, gpio::HIGH); +gpio = new GpiodRegular("MGM_0_LIS3", gpio::Direction::OUT, gpio::HIGH, + q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm0Lis3mdlChipSelect); gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, mgm1Rm3100ChipSelect, - "MGM_1_RM3100", gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegular("MGM_1_RM3100", gpio::Direction::OUT, gpio::HIGH, + q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm1Rm3100ChipSelect); gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_MGM2_LIS3_CHIP, mgm2Lis3mdlChipSelect, - "MGM_2_LIS3", gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegular("MGM_2_LIS3", gpio::Direction::OUT, gpio::HIGH, q7s::GPIO_MGM2_LIS3_LABEL, + mgm2Lis3mdlChipSelect); gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, mgm3Rm3100ChipSelect, - "MGM_3_RM3100", gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegular("MGM_3_RM3100", gpio::Direction::OUT, gpio::HIGH, + q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm3Rm3100ChipSelect); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_GYRO_ADIS_CHIP, gyro0AdisChipSelect, - "GYRO_0_ADIS", gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegular("GYRO_0_ADIS", gpio::Direction::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, + gyro0AdisChipSelect); gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, gyro1L3gd20ChipSelect, - "GYRO_1_L3G", gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegular("GYRO_1_L3G", gpio::Direction::OUT, gpio::HIGH, + q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro1L3gd20ChipSelect); gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_GYRO_ADIS_CHIP, gyro2AdisChipSelect, - "GYRO_2_ADIS", gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegular("GYRO_2_ADIS", gpio::Direction::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, + gyro2AdisChipSelect); gpioCookie->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio); - gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, gyro3L3gd20ChipSelect, - "GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH); + gpio = new GpiodRegular("GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH, + q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro3L3gd20ChipSelect); gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); // Enable pins must be pulled low for regular operations - gpio = new GpiodRegular(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE, - "GYRO_0_ENABLE", gpio::OUT, gpio::LOW); + gpio = new GpiodRegular("GYRO_0_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_FLEX_OBC1F_B0, + q7s::GPIO_GYRO_0_ENABLE); gpioCookie->addGpio(gpioIds::GYRO_0_ENABLE, gpio); - gpio = new GpiodRegular(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE, - "GYRO_2_ENABLE", gpio::OUT, gpio::LOW); + gpio = new GpiodRegular("GYRO_2_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_3V3_OBC1C, + q7s::GPIO_GYRO_2_ENABLE); gpioCookie->addGpio(gpioIds::GYRO_2_ENABLE, gpio); -#endif - if(gpioIF != nullptr) { + #endif + if (gpioIF != nullptr) { gpioIF->addGpios(gpioCookie); } } -- 2.43.0 From 804afa5d960bff569826795e17c643ace41e9e55 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 20 Sep 2021 18:15:35 +0200 Subject: [PATCH 078/102] add test code now default 0 --- fsfw | 2 +- linux/fsfwconfig/OBSWConfig.h.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index e8050183..85654eef 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e8050183f4f54452caceba67a9d4da50bd230770 +Subproject commit 85654eefaa7e989f634051c9648db0fb803bb8b3 diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 664cab2b..7abe1ea8 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -48,7 +48,7 @@ debugging. */ #define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1 #define OBSW_PRINT_MISSED_DEADLINES 1 // If this is enabled, all other SPI code should be disabled -#define OBSW_ADD_TEST_CODE 1 +#define OBSW_ADD_TEST_CODE 0 #define OBSW_ADD_SPI_TEST_CODE 0 #define OBSW_ADD_TEST_PST 0 #define OBSW_ADD_TEST_TASK 0 -- 2.43.0 From c4ba578285ee1e7cc217e2399278f02e9810bfab Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 20 Sep 2021 18:46:48 +0200 Subject: [PATCH 079/102] fixed warning --- bsp_q7s/core/InitMission.cpp | 2 ++ fsfw | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 481d4060..e7d8779b 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -289,7 +289,9 @@ void initmission::createPusTasks(TaskFactory &factory, void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, std::vector& taskVec) { +#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || (BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1) ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; +#endif PeriodicTaskIF* testTask = factory.createPeriodicTask( "TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc); #if OBSW_ADD_TEST_TASK == 1 diff --git a/fsfw b/fsfw index 85654eef..70a3749d 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 85654eefaa7e989f634051c9648db0fb803bb8b3 +Subproject commit 70a3749dbe2cf7d23c685b0e3b3ce350a7c9db05 -- 2.43.0 From 1d8c4be47a01ad1e01c2bad988cef6716c4d51cc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 21 Sep 2021 14:47:03 +0200 Subject: [PATCH 080/102] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index e8050183..87b68e84 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e8050183f4f54452caceba67a9d4da50bd230770 +Subproject commit 87b68e84bef1b77ad87ccd189c12b5a49a8f5955 -- 2.43.0 From 652cfa09864926dd14d398fde1907c558438f2e4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 21 Sep 2021 17:31:55 +0200 Subject: [PATCH 081/102] gpio refactoring --- bsp_q7s/core/ObjectFactory.cpp | 122 +++++++++++++++------------- bsp_q7s/gpio/gpioCallbacks.cpp | 41 +++++----- fsfw | 2 +- linux/archive/gpio/LinuxLibgpioIF.h | 4 +- linux/boardtest/SpiTestClass.cpp | 51 ++++++------ 5 files changed, 115 insertions(+), 105 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index e8be0ef1..cf17cb25 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -265,8 +265,8 @@ void ObjectFactory::createPcduComponents() { void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) { GpioCookie* gpioCookieRadSensor = new GpioCookie; - GpiodRegular* chipSelectRadSensor = new GpiodRegular("Chip Select Radiation Sensor", gpio::OUT, - 1, q7s::GPIO_RAD_SENSOR_LABEL, q7s::GPIO_RAD_SENSOR_CS); + auto chipSelectRadSensor = new GpiodRegularByLabel(q7s::GPIO_RAD_SENSOR_LABEL, + q7s::GPIO_RAD_SENSOR_CS, "Chip Select Radiation Sensor", gpio::OUT, gpio::HIGH); gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor); gpioComIF->addGpios(gpioCookieRadSensor); @@ -392,47 +392,47 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, SpiComI void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComIF* uartComIF) { GpioCookie* gpioCookieAcsBoard = new GpioCookie(); - GpiodRegular* gpio = nullptr; - gpio = new GpiodRegular("CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, - q7s::GPIO_GYRO_0_ADIS_CS); + GpiodRegularByLabel* gpio = nullptr; + gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, q7s::GPIO_GYRO_0_ADIS_CS, + "CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - gpio = new GpiodRegular("CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_1_L3G_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_1_L3G_CS, + "CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegular("CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, - q7s::GPIO_GYRO_2_ADIS_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, q7s::GPIO_GYRO_2_ADIS_CS, + "CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio); - gpio = new GpiodRegular("CS_GYRO_3_L3G", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_3_L3G_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_3_L3G_CS, + "CS_GYRO_3_L3G", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); - gpio = new GpiodRegular("CS_MGM_0_LIS3_A", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_0_LIS3_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_0_LIS3_CS, + "CS_MGM_0_LIS3_A", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - gpio = new GpiodRegular("CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_1_RM3100_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_1_RM3100_CS, + "CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegular("CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH, q7s::GPIO_MGM2_LIS3_LABEL, - q7s::GPIO_MGM_2_LIS3_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_MGM2_LIS3_LABEL, q7s::GPIO_MGM_2_LIS3_CS, + "CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - gpio = new GpiodRegular("CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_3_RM3100_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_3_RM3100_CS, + "CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); // GNSS reset pins are active low - gpio = new GpiodRegular("GNSS_0_NRESET", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_0); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_0, + "GNSS_0_NRESET", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_NRESET, gpio); - gpio = new GpiodRegular("GNSS_1_NRESET", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_1); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_1, + "GNSS_1_NRESET", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio); // Enable pins must be pulled low for regular operations - gpio = new GpiodRegular("GYRO_0_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_FLEX_OBC1F_B0, - q7s::GPIO_GYRO_0_ENABLE); + gpio = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE, + "GYRO_0_ENABLE", gpio::OUT, gpio::LOW); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ENABLE, gpio); - gpio = new GpiodRegular("GYRO_2_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_3V3_OBC1C, - q7s::GPIO_GYRO_2_ENABLE); + gpio = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE, + "GYRO_2_ENABLE", gpio::OUT, gpio::LOW); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ENABLE, gpio); // TODO: Add enable pins for GPS as soon as new interface board design is finished @@ -542,37 +542,37 @@ void ObjectFactory::createHeaterComponents() { GpioCookie* heaterGpiosCookie = new GpioCookie; /* Pin H2-11 on stack connector */ - GpiodRegular* gpioConfigHeater0 = new GpiodRegular("Heater0", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_0_PIN); + auto gpioConfigHeater0 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_0_PIN, + "Heater0", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0); /* Pin H2-12 on stack connector */ - GpiodRegular* gpioConfigHeater1 = new GpiodRegular("Heater1", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_1_PIN); + auto gpioConfigHeater1 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_1_PIN, + "Heater1", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1); /* Pin H2-13 on stack connector */ - GpiodRegular* gpioConfigHeater2 = new GpiodRegular("Heater2", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_2_PIN); + auto gpioConfigHeater2 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_2_PIN, + "Heater2", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2); - GpiodRegular* gpioConfigHeater3 = new GpiodRegular("Heater3", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_3_PIN); + auto gpioConfigHeater3 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_3_PIN, + "Heater3", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3); - GpiodRegular* gpioConfigHeater4 = new GpiodRegular("Heater4", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_4_PIN); + auto gpioConfigHeater4 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_4_PIN, + "Heater4", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4); - GpiodRegular* gpioConfigHeater5 = new GpiodRegular("Heater5", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_5_PIN); + auto gpioConfigHeater5 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_5_PIN, + "Heater5", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5); - GpiodRegular* gpioConfigHeater6 = new GpiodRegular("Heater6", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_6_PIN); + auto gpioConfigHeater6 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_6_PIN, + "Heater6", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6); - GpiodRegular* gpioConfigHeater7 = new GpiodRegular("Heater7", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_7_PIN); + auto gpioConfigHeater7 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_7_PIN, + "Heater7", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7); new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie, @@ -582,11 +582,11 @@ void ObjectFactory::createHeaterComponents() { void ObjectFactory::createSolarArrayDeploymentComponents() { GpioCookie* solarArrayDeplCookie = new GpioCookie; - GpiodRegular* gpioConfigDeplSA0 = new GpiodRegular("DeplSA0", gpio::OUT, 0, - q7s::GPIO_SOLAR_ARR_DEPL_LABEL, q7s::GPIO_SOL_DEPL_SA_0_PIN); + auto gpioConfigDeplSA0 = new GpiodRegularByLabel(q7s::GPIO_SOLAR_ARR_DEPL_LABEL, + q7s::GPIO_SOL_DEPL_SA_0_PIN, "DeplSA0", gpio::OUT, gpio::LOW); solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpioConfigDeplSA0); - GpiodRegular* gpioConfigDeplSA1 = new GpiodRegular("DeplSA1", gpio::OUT, 0, - q7s::GPIO_SOLAR_ARR_DEPL_LABEL, q7s::GPIO_SOL_DEPL_SA_1_PIN); + auto gpioConfigDeplSA1 = new GpiodRegularByLabel(q7s::GPIO_SOLAR_ARR_DEPL_LABEL, + q7s::GPIO_SOL_DEPL_SA_1_PIN, "DeplSA1", gpio::OUT, gpio::LOW); solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpioConfigDeplSA1); //TODO: Find out burn time. For now set to 1000 ms. @@ -766,17 +766,25 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4); - GpiodRegular* enRw1 = new GpiodRegular("Enable reaction wheel 1", gpio::OUT, 0, - q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS); +// GpiodRegular* enRw1 = new GpiodRegular("Enable reaction wheel 1", gpio::OUT, 0, +// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS); +// gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); +// GpiodRegular* enRw2 = new GpiodRegular("Enable reaction wheel 2", gpio::OUT, 0, +// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS); +// gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2); +// GpiodRegular* enRw3 = new GpiodRegular(, gpio::OUT, 0, +// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS); + auto enRw1 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS, + "Enable reaction wheel 1", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); - GpiodRegular* enRw2 = new GpiodRegular("Enable reaction wheel 2", gpio::OUT, 0, - q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS); + auto enRw2 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS, + "Enable reaction wheel 2", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2); - GpiodRegular* enRw3 = new GpiodRegular("Enable reaction wheel 3", gpio::OUT, 0, - q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS); + auto enRw3 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS, + "Enable reaction wheel 3", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW3, enRw3); - GpiodRegular* enRw4 = new GpiodRegular("Enable reaction wheel 4", gpio::OUT, 0, - q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_3_CS); + auto enRw4 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_3_CS, + "Enable reaction wheel 4", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW4, enRw4); /** @@ -784,8 +792,8 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { * the PS SPI peripheral from the SPI interface and route out the SPI lines of the AXI SPI core. * Per default the PS SPI is selected (EMIO = 0). */ - GpiodRegular* spiMux = new GpiodRegular("EMIO 0 SPI Mux", gpio::OUT, 0, - q7s::GPIO_RW_SPI_MUX_LABEL, q7s::GPIO_RW_SPI_MUX_CS); + auto spiMux = new GpiodRegularByLabel(q7s::GPIO_RW_SPI_MUX_LABEL, + q7s::GPIO_RW_SPI_MUX_CS, "EMIO 0 SPI Mux", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::SPI_MUX, spiMux); gpioComIF->addGpios(gpioCookieRw); diff --git a/bsp_q7s/gpio/gpioCallbacks.cpp b/bsp_q7s/gpio/gpioCallbacks.cpp index da3678c6..da7c58e4 100644 --- a/bsp_q7s/gpio/gpioCallbacks.cpp +++ b/bsp_q7s/gpio/gpioCallbacks.cpp @@ -24,30 +24,31 @@ void initSpiCsDecoder(GpioIF* gpioComIF) { GpioCookie* spiMuxGpios = new GpioCookie; + GpiodRegularByLabel* spiMuxBit = nullptr; /** Setting mux bit 1 to low will disable IC21 on the interface board */ - GpiodRegular* spiMuxBit1 = new GpiodRegular(std::string("SPI Mux Bit 1"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_1); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit1); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_1, + "SPI Mux Bit 1", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit); /** Setting mux bit 2 to low disables IC1 on the TCS board */ - GpiodRegular* spiMuxBit2 = new GpiodRegular(std::string("SPI Mux Bit 2"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_2); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit2); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_2, + "SPI Mux Bit 2", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit); /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */ - GpiodRegular* spiMuxBit3 = new GpiodRegular(std::string("SPI Mux Bit 3"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_3); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit3); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_3, + "SPI Mux Bit 3", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit); /** The following gpios can take arbitrary initial values */ - GpiodRegular* spiMuxBit4 = new GpiodRegular(std::string("SPI Mux Bit 4"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_4); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit4); - GpiodRegular* spiMuxBit5 = new GpiodRegular(std::string("SPI Mux Bit 5"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_5); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit5); - GpiodRegular* spiMuxBit6 = new GpiodRegular(std::string("SPI Mux Bit 6"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_6); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit6); - GpiodRegular* enRwDecoder = new GpiodRegular(std::string("EN_RW_CS"), gpio::OUT, 1, - q7s::GPIO_FLEX_OBC1F_B1, q7s::EN_RW_CS); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_4, + "SPI Mux Bit 4", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_5, + "SPI Mux Bit 5", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_6, + "SPI Mux Bit 6", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit); + GpiodRegularByLabel* enRwDecoder = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B1, + q7s::EN_RW_CS, "EN_RW_CS", gpio::OUT, gpio::HIGH); spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder); result = gpioComInterface->addGpios(spiMuxGpios); diff --git a/fsfw b/fsfw index 8374d495..8e65d2d3 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 8374d495fa4ca7208af5fd6e2273d9b52e7d9ee0 +Subproject commit 8e65d2d3fcbccc9cfda4803f9cf6461981266356 diff --git a/linux/archive/gpio/LinuxLibgpioIF.h b/linux/archive/gpio/LinuxLibgpioIF.h index a5015999..9c444e50 100644 --- a/linux/archive/gpio/LinuxLibgpioIF.h +++ b/linux/archive/gpio/LinuxLibgpioIF.h @@ -47,9 +47,9 @@ private: * @param gpioId The GPIO ID of the GPIO to drive. * @param logiclevel The logic level to set. O or 1. */ - ReturnValue_t driveGpio(gpioId_t gpioId, GpiodRegular* regularGpio, unsigned int logiclevel); + ReturnValue_t driveGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio, unsigned int logiclevel); - ReturnValue_t configureRegularGpio(gpioId_t gpioId, GpiodRegular* regularGpio); + ReturnValue_t configureRegularGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio); /** * @brief This function checks if GPIOs are already registered and whether diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index e69c63e5..1f54c5ec 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -298,8 +298,9 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { void SpiTestClass::acsInit() { GpioCookie* gpioCookie = new GpioCookie(); - GpiodRegular* gpio = nullptr; - #ifdef RASPBERRY_PI + +#ifdef RASPBERRY_PI + GpiodRegularByChip* gpio = nullptr; std::string rpiGpioName = "gpiochip0"; gpio = new GpiodRegular(rpiGpioName, mgm0Lis3mdlChipSelect, "MGM_0_LIS3", gpio::Direction::OUT, 1); @@ -328,42 +329,42 @@ void SpiTestClass::acsInit() { gpio = new GpiodRegular(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); - #elif defined(XIPHOS_Q7S) - -gpio = new GpiodRegular("MGM_0_LIS3", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm0Lis3mdlChipSelect); +#elif defined(XIPHOS_Q7S) + GpiodRegularByLabel* gpio = nullptr; + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm0Lis3mdlChipSelect, + "MGM_0_LIS3", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - gpio = new GpiodRegular("MGM_1_RM3100", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm1Rm3100ChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm1Rm3100ChipSelect, + "MGM_1_RM3100", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegular("MGM_2_LIS3", gpio::Direction::OUT, gpio::HIGH, q7s::GPIO_MGM2_LIS3_LABEL, - mgm2Lis3mdlChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_MGM2_LIS3_LABEL, mgm2Lis3mdlChipSelect, + "MGM_2_LIS3", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - gpio = new GpiodRegular("MGM_3_RM3100", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm3Rm3100ChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm3Rm3100ChipSelect, + "MGM_3_RM3100", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); - gpio = new GpiodRegular("GYRO_0_ADIS", gpio::Direction::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, - gyro0AdisChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, gyro0AdisChipSelect, + "GYRO_0_ADIS", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - gpio = new GpiodRegular("GYRO_1_L3G", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro1L3gd20ChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro1L3gd20ChipSelect, + "GYRO_1_L3G", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegular("GYRO_2_ADIS", gpio::Direction::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, - gyro2AdisChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, gyro2AdisChipSelect, "GYRO_2_ADIS", + gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio); - gpio = new GpiodRegular("GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro3L3gd20ChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro3L3gd20ChipSelect, + "GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); // Enable pins must be pulled low for regular operations - gpio = new GpiodRegular("GYRO_0_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_FLEX_OBC1F_B0, - q7s::GPIO_GYRO_0_ENABLE); + gpio = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE, + "GYRO_0_ENABLE", gpio::OUT, gpio::LOW); gpioCookie->addGpio(gpioIds::GYRO_0_ENABLE, gpio); - gpio = new GpiodRegular("GYRO_2_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_3V3_OBC1C, - q7s::GPIO_GYRO_2_ENABLE); + gpio = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE, + "GYRO_2_ENABLE", gpio::OUT, gpio::LOW); gpioCookie->addGpio(gpioIds::GYRO_2_ENABLE, gpio); - #endif +#endif if (gpioIF != nullptr) { gpioIF->addGpios(gpioCookie); } -- 2.43.0 From 28040f85ccd61a3fb2703ca99b5f7033d16f849c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 21 Sep 2021 19:28:22 +0200 Subject: [PATCH 082/102] fixes for new gpio update --- bsp_q7s/boardconfig/busConf.h | 7 +- bsp_q7s/core/ObjectFactory.cpp | 4 +- fsfw | 2 +- linux/archive/gpio/LinuxLibgpioIF.cpp | 3 + .../pollingSequenceFactory.cpp | 64 +++++++++---------- 5 files changed, 44 insertions(+), 36 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index f5b4a860..a86a6c79 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -28,10 +28,12 @@ static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 2; // AA22 /** OBC1F B0 */ /**************************************************************/ static constexpr char GPIO_FLEX_OBC1F_B0[] = "/amba_pl/gpio@42030000"; +static constexpr uint32_t GPIO_FLEX_OBC1F_B0_WIDTH = 20; static const char* const GPIO_ACS_BOARD_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0; static const char* const GPIO_RW_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0; static const char* const GPIO_RAD_SENSOR_LABEL = GPIO_FLEX_OBC1F_B0; + static constexpr uint32_t GPIO_RW_0_CS = 7; // B20 static constexpr uint32_t GPIO_RW_1_CS = 3; // G22 static constexpr uint32_t GPIO_RW_2_CS = 11; // E18 @@ -56,7 +58,10 @@ static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; // R18 /** OBC1F B1 */ /**************************************************************/ static constexpr char GPIO_FLEX_OBC1F_B1[] = "/amba_pl/gpio@42030000"; -static const char* const GPIO_MGM2_LIS3_LABEL = GPIO_FLEX_OBC1F_B1; +// Need to use chip name here for now because the label name is the name for +// gpiochip 5 and gpiochip6 +static constexpr char GPIO_FLEX_OBC1F_B1_CHIP[] = "gpiochip6"; +static const char* const GPIO_MGM2_LIS3_LABEL = GPIO_FLEX_OBC1F_B1_CHIP; static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0; // D18 /**************************************************************/ diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index cf17cb25..3f1d4c7d 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -412,9 +412,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_1_RM3100_CS, "CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegularByLabel(q7s::GPIO_MGM2_LIS3_LABEL, q7s::GPIO_MGM_2_LIS3_CS, + auto gpioChip = new GpiodRegularByChip(q7s::GPIO_MGM2_LIS3_LABEL, q7s::GPIO_MGM_2_LIS3_CS, "CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH); - gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); + gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpioChip); gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_3_RM3100_CS, "CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); diff --git a/fsfw b/fsfw index 8e65d2d3..3d1be94e 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 8e65d2d3fcbccc9cfda4803f9cf6461981266356 +Subproject commit 3d1be94e120b76f7d1c86ff8f2a82e596f13c165 diff --git a/linux/archive/gpio/LinuxLibgpioIF.cpp b/linux/archive/gpio/LinuxLibgpioIF.cpp index 64ee2982..92ffa63c 100644 --- a/linux/archive/gpio/LinuxLibgpioIF.cpp +++ b/linux/archive/gpio/LinuxLibgpioIF.cpp @@ -10,6 +10,9 @@ LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) { + struct gpiod_chip* chip = gpiod_chip_open_by_label("/amba_pl/gpio@42030000"); + + sif::debug << chip->name << std::endl; } LinuxLibgpioIF::~LinuxLibgpioIF() { diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 8a756a56..1b5ec2e3 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -425,8 +425,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); #if OBSW_ADD_ACS_BOARD == 1 - bool enableAside = true; - bool enableBside = false; + bool enableAside = false; + bool enableBside = true; if(enableAside) { // A side // thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, @@ -440,16 +440,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -487,16 +487,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -509,16 +509,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); } #endif /* OBSW_ADD_ACS_BOARD == 1 */ -- 2.43.0 From da45326150f98c428efe94ecf310a496120c1629 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 09:22:06 +0200 Subject: [PATCH 083/102] bumped SW subversion --- common/config/OBSWVersion.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/config/OBSWVersion.h b/common/config/OBSWVersion.h index 1656eda0..5e9b1b9c 100644 --- a/common/config/OBSWVersion.h +++ b/common/config/OBSWVersion.h @@ -4,7 +4,7 @@ const char* const SW_NAME = "eive"; #define SW_VERSION 1 -#define SW_SUBVERSION 6 -#define SW_REVISION 1 +#define SW_SUBVERSION 7 +#define SW_REVISION 0 #endif /* COMMON_CONFIG_OBSWVERSION_H_ */ -- 2.43.0 From e1ae1c021acacee92d4d87510a5170c27a152674 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 11:45:25 +0200 Subject: [PATCH 084/102] made more spi devices optional --- bsp_q7s/boardconfig/q7sConfig.h.in | 1 - bsp_q7s/core/ObjectFactory.cpp | 8 +- linux/fsfwconfig/OBSWConfig.h.in | 25 +++ .../pollingSequenceFactory.cpp | 188 ++++++++++-------- 4 files changed, 130 insertions(+), 92 deletions(-) diff --git a/bsp_q7s/boardconfig/q7sConfig.h.in b/bsp_q7s/boardconfig/q7sConfig.h.in index 40b5a510..43283ea1 100644 --- a/bsp_q7s/boardconfig/q7sConfig.h.in +++ b/bsp_q7s/boardconfig/q7sConfig.h.in @@ -28,7 +28,6 @@ // Probably better if this is disabled for mission code. Convenient for development #define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1 -#define Q7S_ADD_RTD_DEVICES 0 #define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0 diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 3f1d4c7d..a6d6dda3 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -129,13 +129,13 @@ void ObjectFactory::produce(void* args) { #endif /* OBSW_ADD_ACS_BOARD == 1 */ createHeaterComponents(); createSolarArrayDeploymentComponents(); -#if Q7S_ADD_SYRLINKS_HANDLER == 1 +#if OBSW_ADD_SYRLINKS == 1 createSyrlinksComponents(); -#endif /* Q7S_ADD_SYRLINKS_HANDLER == 1 */ +#endif /* OBSW_ADD_SYRLINKS == 1 */ -#if Q7S_ADD_RTD_DEVICES == 1 +#if OBSW_ADD_RTD_DEVICES == 1 createRtdComponents(); -#endif /* Q7S_ADD_RTD_DEVICES == 1 */ +#endif /* OBSW_ADD_RTD_DEVICES == 1 */ I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV); diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 7abe1ea8..bf5c1405 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -31,6 +31,8 @@ debugging. */ //! Timers can mess up the code when debugging //! All of this should be enabled for mission code! +#if defined XIPHOS_Q7S + #define OBSW_ENABLE_TIMERS 1 #define OBSW_ADD_STAR_TRACKER 0 #define OBSW_ADD_PLOC_SUPERVISOR 0 @@ -39,6 +41,29 @@ debugging. */ #define OBSW_ADD_ACS_BOARD 0 #define OBSW_ADD_GPS_0 0 #define OBSW_ADD_GPS_1 0 +#define OBSW_ADD_RW 0 +#define OBSW_ADD_RTD_DEVICES 0 +#define OBSW_ADD_TMP_DEVICES 0 +#define OBSW_ADD_RAD_SENSORS 0 +#define OBSW_ADD_SYRLINKS 0 + +#elif defined RASPBERRY_PI + +#define OBSW_ENABLE_TIMERS 1 +#define OBSW_ADD_STAR_TRACKER 0 +#define OBSW_ADD_PLOC_SUPERVISOR 0 +#define OBSW_ADD_PLOC_MPSOC 0 +#define OBSW_ADD_SUN_SENSORS 0 +#define OBSW_ADD_ACS_BOARD 0 +#define OBSW_ADD_GPS_0 0 +#define OBSW_ADD_GPS_1 0 +#define OBSW_ADD_RW 0 +#define OBSW_ADD_RTD_DEVICES 0 +#define OBSW_ADD_TMP_DEVICES 0 +#define OBSW_ADD_RAD_SENSORS 0 +#define OBSW_ADD_SYRLINKS 0 + +#endif /*******************************************************************/ /** All of the following flags should be disabled for mission code */ diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 1b5ec2e3..1f74cca6 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -28,12 +28,14 @@ ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence) ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { uint32_t length = thisSequence->getPeriodMs(); - + static_cast(length); +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC5, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -50,11 +52,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC17, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC18, length * 0, DeviceHandlerIF::PERFORM_OPERATION); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::SEND_WRITE); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC4, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC5, length * 0.2, DeviceHandlerIF::SEND_WRITE); @@ -71,11 +75,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC17, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC18, length * 0.2, DeviceHandlerIF::SEND_WRITE); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.4, DeviceHandlerIF::GET_WRITE); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC4, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC5, length * 0.4, DeviceHandlerIF::GET_WRITE); @@ -92,11 +98,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC17, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC18, length * 0.4, DeviceHandlerIF::GET_WRITE); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC4, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC5, length * 0.6, DeviceHandlerIF::SEND_READ); @@ -113,11 +121,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC17, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC18, length * 0.6, DeviceHandlerIF::SEND_READ); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.8, DeviceHandlerIF::GET_READ); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC4, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC5, length * 0.8, DeviceHandlerIF::GET_READ); @@ -134,14 +144,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC17, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC18, length * 0.8, DeviceHandlerIF::GET_READ); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_RAD_SENSORS == 1 /* Radiation sensor */ thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ); +#endif #if OBSW_ADD_SUN_SENSORS == 1 /** @@ -400,6 +412,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_READ); #endif +#if OBSW_ADD_RW == 1 thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW1, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RW1, length * 0.4, DeviceHandlerIF::GET_WRITE); @@ -408,70 +421,71 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW2, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::RW2, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::RW2, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::RW2, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RW2, length * 0.6, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW2, length * 0.7, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW2, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW3, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::RW3, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::RW3, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::RW3, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RW3, length * 0.6, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW3, length * 0.7, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW3, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW4, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::RW4, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::RW4, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RW4, length * 0.6, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW4, length * 0.7, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW4, length * 0.85, DeviceHandlerIF::GET_READ); +#endif #if OBSW_ADD_ACS_BOARD == 1 bool enableAside = false; bool enableBside = true; if(enableAside) { // A side -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); + +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.3, // DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, // DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.75, // DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); - - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, - // DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, - // DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, - // DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, - // DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, - // DeviceHandlerIF::GET_READ); - -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); } if(enableBside) { @@ -480,45 +494,45 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.205, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); + +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.210, // DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, // DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.75, // DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); - // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, - // DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.2, - // DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.4, - // DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, - // DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, - // DeviceHandlerIF::GET_READ); - -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.215, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); } #endif /* OBSW_ADD_ACS_BOARD == 1 */ @@ -580,7 +594,7 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { DeviceHandlerIF::GET_READ); #endif -#if Q7S_ADD_SYRLINKS_HANDLER == 1 +#if OBSW_ADD_SYRLINKS == 1 uartPstEmpty = false; thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); -- 2.43.0 From d6e22e7d4d34b754f5598af01b405b91508e4c36 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 11:48:56 +0200 Subject: [PATCH 085/102] trying other timing --- .../pollingSequenceFactory.cpp | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 1f74cca6..78c613de 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -439,20 +439,20 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { #endif #if OBSW_ADD_ACS_BOARD == 1 - bool enableAside = false; - bool enableBside = true; + bool enableAside = true; + bool enableBside = false; if(enableAside) { // A side - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -476,16 +476,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); } if(enableBside) { @@ -503,7 +503,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.205, + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.25, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE); @@ -514,7 +514,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.210, +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.3, // DeviceHandlerIF::SEND_WRITE); // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, // DeviceHandlerIF::GET_WRITE); @@ -525,7 +525,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.215, + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE); -- 2.43.0 From f9050ab185929eb9ee151b94353db29104e4743a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 12:19:45 +0200 Subject: [PATCH 086/102] fixes for RPi code --- bsp_linux_board/ObjectFactory.cpp | 5 +-- fsfw | 2 +- linux/boardtest/SpiTestClass.cpp | 16 ++++---- linux/boardtest/SpiTestClass.h | 11 ++--- .../pollingSequenceFactory.cpp | 40 +++++++++---------- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 60ca5b6e..19b0d9e4 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -14,9 +14,6 @@ #include "mission/core/GenericFactory.h" #include "mission/utility/TmFunnel.h" #include -#include - -#include "mission/devices/MGMHandlerRM3100.h" #include "mission/devices/GyroADIS16507Handler.h" #include "fsfw/datapoollocal/LocalDataPoolManager.h" @@ -34,6 +31,8 @@ #include "fsfw/osal/common/UdpTcPollingTask.h" #endif +#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h" +#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h" #include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h" #include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" #include "fsfw_hal/linux/rpi/GpioRPi.h" diff --git a/fsfw b/fsfw index 3d1be94e..5c56eda6 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 3d1be94e120b76f7d1c86ff8f2a82e596f13c165 +Subproject commit 5c56eda61077e3aef00d32133c5546987b476e8c diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 1f54c5ec..8a340ecb 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -206,7 +206,7 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { /* Configure all SPI chip selects and pull them high */ acsInit(); - l3gId = gyro3L3gd20ChipSelect; + l3gId = gyro1L3gd20ChipSelect; /* Adapt accordingly */ if(l3gId != gyro1L3gd20ChipSelect and l3gId != gyro3L3gd20ChipSelect) { @@ -302,31 +302,31 @@ void SpiTestClass::acsInit() { #ifdef RASPBERRY_PI GpiodRegularByChip* gpio = nullptr; std::string rpiGpioName = "gpiochip0"; - gpio = new GpiodRegular(rpiGpioName, mgm0Lis3mdlChipSelect, "MGM_0_LIS3", + gpio = new GpiodRegularByChip(rpiGpioName, mgm0Lis3mdlChipSelect, "MGM_0_LIS3", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100", + gpio = new GpiodRegularByChip(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS", + gpio = new GpiodRegularByChip(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G", + gpio = new GpiodRegularByChip(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, gyro2L3gd20ChipSelect, "GYRO_2_L3G", + gpio = new GpiodRegularByChip(rpiGpioName, gyro3L3gd20ChipSelect, "GYRO_2_L3G", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", + gpio = new GpiodRegularByChip(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", + gpio = new GpiodRegularByChip(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); #elif defined(XIPHOS_Q7S) diff --git a/linux/boardtest/SpiTestClass.h b/linux/boardtest/SpiTestClass.h index d5309a1e..7ccc2eb7 100644 --- a/linux/boardtest/SpiTestClass.h +++ b/linux/boardtest/SpiTestClass.h @@ -45,11 +45,12 @@ private: /* ACS board specific variables */ #ifdef RASPBERRY_PI - uint8_t mgm0Lis3mdlChipSelect = 0; - uint8_t mgm1Rm3100ChipSelect = 1; - uint8_t gyro0AdisChipSelect = 5; - uint8_t gyro1L3gd20ChipSelect = 6; - uint8_t gyro2L3gd20ChipSelect = 4; + uint8_t mgm0Lis3mdlChipSelect = 2; + uint8_t mgm1Rm3100ChipSelect = 3; + uint8_t gyro0AdisChipSelect = 4; + uint8_t gyro1L3gd20ChipSelect = 5; + int8_t gyro2AdisChipSelect = 6; + uint8_t gyro3L3gd20ChipSelect = 16; uint8_t mgm2Lis3mdlChipSelect = 17; uint8_t mgm3Rm3100ChipSelect = 27; #elif defined(XIPHOS_Q7S) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 78c613de..3219b984 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -454,16 +454,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -476,16 +476,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); } if(enableBside) { -- 2.43.0 From dbcf4f5d699f043f98cded492bbe82e13265b0e0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 12:29:43 +0200 Subject: [PATCH 087/102] more improvements for RPi code --- bsp_linux_board/InitMission.cpp | 6 ++++-- bsp_linux_board/ObjectFactory.cpp | 10 +++++----- linux/boardtest/SpiTestClass.h | 17 +++++++++-------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index febae2f3..48e91013 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -135,6 +135,7 @@ void initmission::initTasks() { } bool startTestPst = true; + static_cast(startTestPst); #if OBSW_ADD_TEST_PST == 1 FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); @@ -145,14 +146,14 @@ void initmission::initTasks() { } #endif /* RPI_TEST_ACS_BOARD == 1 */ + +#if OBSW_ADD_TEST_CODE == 1 PeriodicTaskIF* testTask = factory->createPeriodicTask( "TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); -#if OBSW_ADD_TEST_CODE == 1 result = testTask->addComponent(objects::TEST_TASK); if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK); } -#endif /* OBSW_ADD_TEST_CODE == 1 */ #if RPI_ADD_SPI_TEST == 1 result = testTask->addComponent(objects::SPI_TEST); if(result != HasReturnvaluesIF::RETURN_OK) { @@ -171,6 +172,7 @@ void initmission::initTasks() { initmission::printAddObjectError("UART_TEST", objects::UART_TEST); } #endif /* RPI_ADD_GPIO_TEST == 1 */ +#endif /* OBSW_ADD_TEST_CODE == 1 */ sif::info << "Starting tasks.." << std::endl; tmTcDistributor->startTask(); diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 19b0d9e4..5597242c 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -132,20 +132,20 @@ void ObjectFactory::produce(void* args){ spiDev = "/dev/spidev0.0"; spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); - auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, - objects::SPI_COM_IF, spiCookie); + auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler->setStartUpImmediately(); spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); - auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER, - objects::SPI_COM_IF, spiCookie); + auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); mgmRm3100Handler->setStartUpImmediately(); spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, - spiCookie); + spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); #endif /* RPI_TEST_ACS_BOARD == 1 */ diff --git a/linux/boardtest/SpiTestClass.h b/linux/boardtest/SpiTestClass.h index 7ccc2eb7..45a7cdd8 100644 --- a/linux/boardtest/SpiTestClass.h +++ b/linux/boardtest/SpiTestClass.h @@ -45,14 +45,15 @@ private: /* ACS board specific variables */ #ifdef RASPBERRY_PI - uint8_t mgm0Lis3mdlChipSelect = 2; - uint8_t mgm1Rm3100ChipSelect = 3; - uint8_t gyro0AdisChipSelect = 4; - uint8_t gyro1L3gd20ChipSelect = 5; - int8_t gyro2AdisChipSelect = 6; - uint8_t gyro3L3gd20ChipSelect = 16; - uint8_t mgm2Lis3mdlChipSelect = 17; - uint8_t mgm3Rm3100ChipSelect = 27; + uint8_t mgm0Lis3mdlChipSelect = gpio::MGM_0_BCM_PIN; + uint8_t mgm1Rm3100ChipSelect = gpio::MGM_1_BCM_PIN; + uint8_t mgm2Lis3mdlChipSelect = gpio::MGM_2_BCM_PIN; + uint8_t mgm3Rm3100ChipSelect = gpio::MGM_3_BCM_PIN; + + uint8_t gyro0AdisChipSelect = gpio::GYRO_0_BCM_PIN; + uint8_t gyro1L3gd20ChipSelect = gpio::GYRO_1_BCM_PIN; + uint8_t gyro2AdisChipSelect = gpio::GYRO_2_BCM_PIN; + uint8_t gyro3L3gd20ChipSelect = gpio::GYRO_3_BCM_PIN; #elif defined(XIPHOS_Q7S) uint8_t mgm0Lis3mdlChipSelect = q7s::GPIO_MGM_0_LIS3_CS; uint8_t mgm1Rm3100ChipSelect = q7s::GPIO_MGM_1_RM3100_CS; -- 2.43.0 From 9a165448360afb0e8fab299f6924e3233ab8b001 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 14:04:39 +0200 Subject: [PATCH 088/102] cleaning up RPi code --- bsp_linux_board/InitMission.cpp | 89 +++++++++---- bsp_linux_board/InitMission.h | 13 ++ bsp_linux_board/ObjectFactory.cpp | 120 +++++++++++------- bsp_linux_board/ObjectFactory.h | 2 + .../pollingSequenceFactory.cpp | 111 +++------------- 5 files changed, 174 insertions(+), 161 deletions(-) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index 48e91013..1adc8a2b 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -36,6 +36,7 @@ void initmission::initMission() { void initmission::initTasks() { TaskFactory* factory = TaskFactory::instance(); + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; if(factory == nullptr) { /* Should never happen ! */ return; @@ -46,11 +47,11 @@ void initmission::initTasks() { void (*missedDeadlineFunc) (void) = nullptr; #endif + /* TMTC Distribution */ PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask( "DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); - ReturnValue_t result = tmTcDistributor->addComponent( - objects::CCSDS_PACKET_DISTRIBUTOR); + result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR); if(result != HasReturnvaluesIF::RETURN_OK){ sif::error << "Object add component failed" << std::endl; } @@ -146,9 +147,68 @@ void initmission::initTasks() { } #endif /* RPI_TEST_ACS_BOARD == 1 */ + std::vector pstTasks; + createPstTasks(*factory, missedDeadlineFunc, pstTasks); +#if OBSW_ADD_TEST_CODE == 1 + std::vector testTasks; + createTestTasks(*factory, missedDeadlineFunc, pstTasks); +#endif /* OBSW_ADD_TEST_CODE == 1 */ + + auto taskStarter = [](std::vector& taskVector, std::string name) { + for(const auto& task: taskVector) { + if(task != nullptr) { + task->startTask(); + } + else { + sif::error << "Task in vector " << name << " is invalid!" << std::endl; + } + } + }; + + sif::info << "Starting tasks.." << std::endl; + tmTcDistributor->startTask(); + udpBridgeTask->startTask(); + udpPollingTask->startTask(); + + pusVerification->startTask(); + pusEvents->startTask(); + pusHighPrio->startTask(); + pusMedPrio->startTask(); + pusLowPrio->startTask(); #if OBSW_ADD_TEST_CODE == 1 - PeriodicTaskIF* testTask = factory->createPeriodicTask( + taskStarter(testTasks, "Test Tasks"); +#endif /* OBSW_ADD_TEST_CODE == 1 */ + taskStarter(pstTasks, "PST Tasks"); + +#if OBSW_ADD_TEST_PST == 1 + if(startTestPst) { + pstTestTask->startTask(); + } +#endif /* RPI_TEST_ACS_BOARD == 1 */ + sif::info << "Tasks started.." << std::endl; +} + +void initmission::createPstTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, std::vector &taskVec) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; +#if OBSW_ADD_SPI_TEST_CODE == 0 + FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask( + "PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, + missedDeadlineFunc); + result = pst::pstSpi(spiPst); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; + } + taskVec.push_back(spiPst); +#endif +} + +void initmission::createTestTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector &taskVec) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + PeriodicTaskIF* testTask = factory.createPeriodicTask( "TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); result = testTask->addComponent(objects::TEST_TASK); if(result != HasReturnvaluesIF::RETURN_OK) { @@ -172,27 +232,4 @@ void initmission::initTasks() { initmission::printAddObjectError("UART_TEST", objects::UART_TEST); } #endif /* RPI_ADD_GPIO_TEST == 1 */ -#endif /* OBSW_ADD_TEST_CODE == 1 */ - - sif::info << "Starting tasks.." << std::endl; - tmTcDistributor->startTask(); - udpBridgeTask->startTask(); - udpPollingTask->startTask(); - - pusVerification->startTask(); - pusEvents->startTask(); - pusHighPrio->startTask(); - pusMedPrio->startTask(); - pusLowPrio->startTask(); - -#if OBSW_ADD_TEST_CODE == 1 - testTask->startTask(); -#endif /* OBSW_ADD_TEST_CODE == 1 */ - -#if OBSW_ADD_TEST_PST == 1 - if(startTestPst) { - pstTestTask->startTask(); - } -#endif /* RPI_TEST_ACS_BOARD == 1 */ - sif::info << "Tasks started.." << std::endl; } diff --git a/bsp_linux_board/InitMission.h b/bsp_linux_board/InitMission.h index 01c72008..aaeea8c1 100644 --- a/bsp_linux_board/InitMission.h +++ b/bsp_linux_board/InitMission.h @@ -1,9 +1,22 @@ #ifndef BSP_LINUX_INITMISSION_H_ #define BSP_LINUX_INITMISSION_H_ +#include "fsfw/tasks/Typedef.h" +#include + +class PeriodicTaskIF; +class TaskFactory; + namespace initmission { void initMission(); void initTasks(); + +void createPstTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector &taskVec); +void createTestTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector &taskVec); }; #endif /* BSP_LINUX_INITMISSION_H_ */ diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 5597242c..5c6b5f47 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -81,7 +81,82 @@ void ObjectFactory::produce(void* args){ SpiCookie* spiCookie = nullptr; static_cast(spiCookie); +#if OBSW_ADD_ACS_BOARD == 1 + if(gpioCookie == nullptr) { + gpioCookie = new GpioCookie(); + } + // TODO: Missing pin for Gyro 2 + gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, + "MGM_0_LIS3", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN, + "MGM_1_RM3100", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, + "MGM_2_LIS3", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN, + "MGM_3_RM3100", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN, + "GYRO_0_ADIS", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, + "GYRO_1_L3G", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_2_BCM_PIN, + "GYRO_2_L3G", gpio::Direction::OUT, 1); + gpioIF->addGpios(gpioCookie); + + spiDev = "/dev/spidev0.1"; + spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, + MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); + auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); + mgmLis3Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, + RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); + auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); + mgmRm3100Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, + MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); + mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); + mgmLis3Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, + RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); + mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); + mgmRm3100Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, + spiCookie); + adisHandler->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, + spiCookie, 0); + gyroL3gHandler->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, + spiCookie, 0); + gyroL3gHandler->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + adisHandler = new GyroADIS16507Handler(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, + spiCookie); + gyroL3gHandler->setStartUpImmediately(); + +#endif /* RPI_TEST_ACS_BOARD == 1 */ + #if OBSW_ADD_TEST_CODE == 1 + createTestTasks(); +#endif /* OBSW_ADD_TEST_CODE == 1 */ +} + +void ObjectFactory::createTestTasks() { + new TestTask(objects::TEST_TASK); #if RPI_ADD_SPI_TEST == 1 @@ -108,48 +183,6 @@ void ObjectFactory::produce(void* args){ new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookieLoopback); #endif /* RPI_LOOPBACK_TEST_GPIO == 1 */ -#if RPI_TEST_ACS_BOARD == 1 - if(gpioCookie == nullptr) { - gpioCookie = new GpioCookie(); - } - // TODO: Missing pin for Gyro 2 - gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, - "MGM_0_LIS3", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN, - "MGM_1_RM3100", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, - "MGM_2_LIS3", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN, - "MGM_3_RM3100", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN, - "GYRO_0_ADIS", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, - "GYRO_1_L3G", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_2_BCM_PIN, - "GYRO_2_L3G", gpio::Direction::OUT, 1); - gpioIF->addGpios(gpioCookie); - - spiDev = "/dev/spidev0.0"; - spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, - MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); - auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, - objects::SPI_COM_IF, spiCookie, 0); - mgmLis3Handler->setStartUpImmediately(); - - spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, - RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); - auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, - objects::SPI_COM_IF, spiCookie, 0); - mgmRm3100Handler->setStartUpImmediately(); - - spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, - L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); - auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, - spiCookie, 0); - gyroL3gHandler->setStartUpImmediately(); - -#endif /* RPI_TEST_ACS_BOARD == 1 */ - #if RPI_TEST_ADIS16507 == 1 if(gpioCookie == nullptr) { gpioCookie = new GpioCookie(); @@ -158,7 +191,7 @@ void ObjectFactory::produce(void* args){ "GYRO_0_ADIS", gpio::Direction::OUT, 1); gpioIF->addGpios(gpioCookie); - spiDev = "/dev/spidev0.0"; + spiDev = "/dev/spidev0.1"; spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED, nullptr, nullptr); @@ -176,5 +209,4 @@ void ObjectFactory::produce(void* args){ gpsHandler->setStartUpImmediately(); #endif -#endif /* OBSW_ADD_TEST_CODE == 1 */ } diff --git a/bsp_linux_board/ObjectFactory.h b/bsp_linux_board/ObjectFactory.h index feaba70e..3b9aca49 100644 --- a/bsp_linux_board/ObjectFactory.h +++ b/bsp_linux_board/ObjectFactory.h @@ -5,6 +5,8 @@ namespace ObjectFactory { void setStatics(); void produce(void* args); + + void createTestTasks(); }; #endif /* BSP_LINUX_OBJECTFACTORY_H_ */ diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 3219b984..47851b0d 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -443,27 +443,27 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { bool enableBside = false; if(enableAside) { // A side -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -722,77 +722,6 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) { /* Length of a communication cycle */ uint32_t length = thisSequence->getPeriodMs(); bool notEmpty = false; -#if OBSW_ADD_ACS_BOARD == 1 - notEmpty = true; - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); -#endif #if RPI_TEST_ADIS16507 == 1 notEmpty = true; -- 2.43.0 From af9a9b837a00417a081bb32b9612d383257c7257 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 14:10:21 +0200 Subject: [PATCH 089/102] added missing GPIO --- bsp_linux_board/ObjectFactory.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 5c6b5f47..419bb6d8 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -98,8 +98,10 @@ void ObjectFactory::produce(void* args){ "GYRO_0_ADIS", gpio::Direction::OUT, 1); gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, "GYRO_1_L3G", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_2_BCM_PIN, - "GYRO_2_L3G", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN, + "GYRO_2_ADIS", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN, + "GYRO_3_L3G", gpio::Direction::OUT, 1); gpioIF->addGpios(gpioCookie); spiDev = "/dev/spidev0.1"; -- 2.43.0 From 1284d102570ad234c7721f9d714d024960200588 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 14:27:01 +0200 Subject: [PATCH 090/102] RPI updates --- bsp_linux_board/InitMission.cpp | 158 +++++++++++++++++--------------- bsp_linux_board/InitMission.h | 2 + 2 files changed, 87 insertions(+), 73 deletions(-) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index 1adc8a2b..b81754a7 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -79,73 +79,8 @@ void initmission::initTasks() { } /* PUS Services */ - PeriodicTaskIF* pusVerification = factory->createPeriodicTask( - "PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); - result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION); - if(result != HasReturnvaluesIF::RETURN_OK){ - sif::error << "Object add component failed" << std::endl; - } - - PeriodicTaskIF* pusEvents = factory->createPeriodicTask( - "PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); - result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING); - if(result != HasReturnvaluesIF::RETURN_OK){ - initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING); - } - - PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask( - "PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); - result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS); - } - result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT); - } - - PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask( - "PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc); - result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT); - } - result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT); - } - result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS); - } - result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING); - } - - PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask( - "PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc); - result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST); - } - result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("INT_ERR_RPRT", - objects::INTERNAL_ERROR_REPORTER); - } - - bool startTestPst = true; - static_cast(startTestPst); -#if OBSW_ADD_TEST_PST == 1 - FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50, - PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); - result = pst::pstTest(pstTestTask); - if(result != HasReturnvaluesIF::RETURN_OK) { - sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl; - startTestPst = false; - } -#endif /* RPI_TEST_ACS_BOARD == 1 */ + std::vector pusTasks; + createPstTasks(*factory, missedDeadlineFunc, pusTasks); std::vector pstTasks; createPstTasks(*factory, missedDeadlineFunc, pstTasks); @@ -170,12 +105,7 @@ void initmission::initTasks() { udpBridgeTask->startTask(); udpPollingTask->startTask(); - pusVerification->startTask(); - pusEvents->startTask(); - pusHighPrio->startTask(); - pusMedPrio->startTask(); - pusLowPrio->startTask(); - + taskStarter(pusTasks, "PUS Tasks"); #if OBSW_ADD_TEST_CODE == 1 taskStarter(testTasks, "Test Tasks"); #endif /* OBSW_ADD_TEST_CODE == 1 */ @@ -189,6 +119,75 @@ void initmission::initTasks() { sif::info << "Tasks started.." << std::endl; } +void initmission::createPusTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, std::vector& taskVec) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + PeriodicTaskIF* pusVerification = factory.createPeriodicTask( + "PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); + result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION); + if(result != HasReturnvaluesIF::RETURN_OK){ + sif::error << "Object add component failed" << std::endl; + } + taskVec.push_back(pusVerification); + + PeriodicTaskIF* pusEvents = factory.createPeriodicTask( + "PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); + result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING); + } + result = pusEvents->addComponent(objects::EVENT_MANAGER); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER); + } + taskVec.push_back(pusEvents); + + PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask( + "PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); + result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS); + } + result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT); + } + taskVec.push_back(pusHighPrio); + + PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask( + "PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc); + result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT); + } + result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT); + } + result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS); + } + result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING); + } + taskVec.push_back(pusMedPrio); + + PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask( + "PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc); + result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST); + } + result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("INT_ERR_RPRT", + objects::INTERNAL_ERROR_REPORTER); + } + taskVec.push_back(pusLowPrio); +} + void initmission::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, std::vector &taskVec) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; @@ -232,4 +231,17 @@ void initmission::createTestTasks(TaskFactory& factory, initmission::printAddObjectError("UART_TEST", objects::UART_TEST); } #endif /* RPI_ADD_GPIO_TEST == 1 */ + + bool startTestPst = true; + static_cast(startTestPst); +#if OBSW_ADD_TEST_PST == 1 + FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50, + PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); + result = pst::pstTest(pstTestTask); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl; + startTestPst = false; + } +#endif /* RPI_TEST_ACS_BOARD == 1 */ + } diff --git a/bsp_linux_board/InitMission.h b/bsp_linux_board/InitMission.h index aaeea8c1..f5da5855 100644 --- a/bsp_linux_board/InitMission.h +++ b/bsp_linux_board/InitMission.h @@ -17,6 +17,8 @@ void createPstTasks(TaskFactory& factory, void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, std::vector &taskVec); +void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector& taskVec); }; #endif /* BSP_LINUX_INITMISSION_H_ */ -- 2.43.0 From 413108497337019a53ae9b7def7875596a426b71 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 15:43:11 +0200 Subject: [PATCH 091/102] several tweaks and fixes --- bsp_linux_board/InitMission.cpp | 6 +-- bsp_linux_board/ObjectFactory.cpp | 36 +++++++++++++---- bsp_linux_board/boardconfig/rpiConfig.h.in | 11 ++--- fsfw | 2 +- .../pollingSequenceFactory.cpp | 40 +++++++++---------- 5 files changed, 59 insertions(+), 36 deletions(-) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index b81754a7..d265fded 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -80,7 +80,7 @@ void initmission::initTasks() { /* PUS Services */ std::vector pusTasks; - createPstTasks(*factory, missedDeadlineFunc, pusTasks); + createPusTasks(*factory, missedDeadlineFunc, pusTasks); std::vector pstTasks; createPstTasks(*factory, missedDeadlineFunc, pstTasks); @@ -193,7 +193,7 @@ void initmission::createPstTasks(TaskFactory& factory, ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; #if OBSW_ADD_SPI_TEST_CODE == 0 FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask( - "PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, + "SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc); result = pst::pstSpi(spiPst); if (result != HasReturnvaluesIF::RETURN_OK) { @@ -235,7 +235,7 @@ void initmission::createTestTasks(TaskFactory& factory, bool startTestPst = true; static_cast(startTestPst); #if OBSW_ADD_TEST_PST == 1 - FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50, + FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("TEST_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); result = pst::pstTest(pstTestTask); if(result != HasReturnvaluesIF::RETURN_OK) { diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 419bb6d8..1d3e0b31 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -64,10 +64,12 @@ void ObjectFactory::produce(void* args){ ObjectFactory::produceGenericObjects(); #if OBSW_USE_TMTC_TCP_BRIDGE == 1 - new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); + auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); + tmtcBridge->setMaxNumberOfPacketsStored(50); new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); #else - new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); + auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); + tmtcBridge->setMaxNumberOfPacketsStored(50); new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); #endif @@ -110,24 +112,36 @@ void ObjectFactory::produce(void* args){ auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler->setStartUpImmediately(); +#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 + mgmLis3Handler->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0); mgmRm3100Handler->setStartUpImmediately(); +#if FSFW_HAL_RM3100_MGM_DEBUG == 1 + mgmRm3100Handler->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0); mgmLis3Handler->setStartUpImmediately(); +#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 + mgmLis3Handler->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0); mgmRm3100Handler->setStartUpImmediately(); +#if FSFW_HAL_RM3100_MGM_DEBUG == 1 + mgmRm3100Handler->setToGoToNormalMode(true); +#endif spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); @@ -139,16 +153,24 @@ void ObjectFactory::produce(void* args){ auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); +#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1 + gyroL3gHandler->setToGoToNormalMode(true); +#endif + spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); - gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, - spiCookie, 0); - gyroL3gHandler->setStartUpImmediately(); + adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, + spiCookie); + adisHandler->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); - adisHandler = new GyroADIS16507Handler(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, - spiCookie); + gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, + spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); +#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1 + gyroL3gHandler->setToGoToNormalMode(true); +#endif #endif /* RPI_TEST_ACS_BOARD == 1 */ diff --git a/bsp_linux_board/boardconfig/rpiConfig.h.in b/bsp_linux_board/boardconfig/rpiConfig.h.in index 5198ddb7..7341fcca 100644 --- a/bsp_linux_board/boardconfig/rpiConfig.h.in +++ b/bsp_linux_board/boardconfig/rpiConfig.h.in @@ -19,13 +19,14 @@ /* Adapt these values accordingly */ namespace gpio { -static constexpr uint8_t MGM_0_BCM_PIN = 0; -static constexpr uint8_t MGM_1_BCM_PIN = 1; -static constexpr uint8_t MGM_2_BCM_PIN = 17; -static constexpr uint8_t MGM_3_BCM_PIN = 27; +static constexpr uint8_t MGM_0_BCM_PIN = 17; +static constexpr uint8_t MGM_1_BCM_PIN = 27; +static constexpr uint8_t MGM_2_BCM_PIN = 22; +static constexpr uint8_t MGM_3_BCM_PIN = 23; static constexpr uint8_t GYRO_0_BCM_PIN = 5; static constexpr uint8_t GYRO_1_BCM_PIN = 6; -static constexpr uint8_t GYRO_2_BCM_PIN = 4; +static constexpr uint8_t GYRO_2_BCM_PIN = 13; +static constexpr uint8_t GYRO_3_BCM_PIN = 19; } #endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */ diff --git a/fsfw b/fsfw index 5c56eda6..d3b83f3c 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 5c56eda61077e3aef00d32133c5546987b476e8c +Subproject commit d3b83f3cf9d702f76ddc5a00ac715dc3a9ef5343 diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 47851b0d..611928f3 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -443,16 +443,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { bool enableBside = false; if(enableAside) { // A side - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -476,16 +476,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); } if(enableBside) { -- 2.43.0 From 0b50d9aedf9b38a5f45b7c4c5880b19558ea9b40 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 16:00:31 +0200 Subject: [PATCH 092/102] fix for ADIS device --- bsp_linux_board/ObjectFactory.cpp | 4 +-- fsfw | 2 +- linux/fsfwconfig/FSFWConfig.h.in | 1 + .../pollingSequenceFactory.cpp | 32 +++++++++---------- mission/devices/GyroADIS16507Handler.cpp | 7 ++-- mission/devices/GyroADIS16507Handler.h | 8 +++-- .../GyroADIS16507Definitions.h | 1 + 7 files changed, 29 insertions(+), 26 deletions(-) diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 1d3e0b31..5cd52c91 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -144,7 +144,7 @@ void ObjectFactory::produce(void* args){ #endif spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, - L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie); adisHandler->setStartUpImmediately(); @@ -158,7 +158,7 @@ void ObjectFactory::produce(void* args){ #endif spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, - L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie); adisHandler->setStartUpImmediately(); diff --git a/fsfw b/fsfw index d3b83f3c..c51d2df4 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit d3b83f3cf9d702f76ddc5a00ac715dc3a9ef5343 +Subproject commit c51d2df43dca317175a9448e662f7f469e5f8725 diff --git a/linux/fsfwconfig/FSFWConfig.h.in b/linux/fsfwconfig/FSFWConfig.h.in index 7314b275..1b8251da 100644 --- a/linux/fsfwconfig/FSFWConfig.h.in +++ b/linux/fsfwconfig/FSFWConfig.h.in @@ -78,5 +78,6 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; #define FSFW_HAL_L3GD20_GYRO_DEBUG 0 #define FSFW_HAL_RM3100_MGM_DEBUG 0 #define FSFW_HAL_LIS3MDL_MGM_DEBUG 0 +#define FSFW_HAL_ADIS16507_GYRO_DEBUG 0 #endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 611928f3..646b8633 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -454,28 +454,28 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); - -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.3, +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, // DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, // DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.75, +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, // DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, // DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.3, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); + // thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, diff --git a/mission/devices/GyroADIS16507Handler.cpp b/mission/devices/GyroADIS16507Handler.cpp index 793aad66..02e69eaf 100644 --- a/mission/devices/GyroADIS16507Handler.cpp +++ b/mission/devices/GyroADIS16507Handler.cpp @@ -1,8 +1,7 @@ +#include "GyroADIS16507Handler.h" #include #include -#include "GyroADIS16507Handler.h" - #if OBSW_ADIS16507_LINUX_COM_IF == 1 #include "fsfw_hal/linux/utility.h" #include "fsfw_hal/linux/spi/SpiCookie.h" @@ -16,7 +15,7 @@ GyroADIS16507Handler::GyroADIS16507Handler(object_id_t objectId, object_id_t deviceCommunication, CookieIF * comCookie): DeviceHandlerBase(objectId, deviceCommunication, comCookie), primaryDataset(this), configDataset(this), breakCountdown() { -#if OBSW_DEBUG_ADIS16507 == 1 +#if FSFW_HAL_ADIS16507_GYRO_DEBUG == 1 debugDivider = new PeriodicOperationDivider(5); #endif @@ -285,7 +284,7 @@ ReturnValue_t GyroADIS16507Handler::handleSensorData(const uint8_t *packet) { primaryDataset.setValidity(true, true); } -#if OBSW_DEBUG_ADIS16507 == 1 +#if FSFW_HAL_ADIS16507_GYRO_DEBUG == 1 if(debugDivider->checkAndIncrement()) { sif::info << "GyroADIS16507Handler: Angular velocities in deg / s" << std::endl; sif::info << "X: " << primaryDataset.angVelocX.value << std::endl; diff --git a/mission/devices/GyroADIS16507Handler.h b/mission/devices/GyroADIS16507Handler.h index 41be5734..467e0906 100644 --- a/mission/devices/GyroADIS16507Handler.h +++ b/mission/devices/GyroADIS16507Handler.h @@ -1,11 +1,13 @@ #ifndef MISSION_DEVICES_GYROADIS16507HANDLER_H_ #define MISSION_DEVICES_GYROADIS16507HANDLER_H_ -#include #include "OBSWConfig.h" -#include "fsfw/devicehandlers/DeviceHandlerBase.h" +#include "FSFWConfig.h" #include "devicedefinitions/GyroADIS16507Definitions.h" +#include "fsfw/globalfunctions/PeriodicOperationDivider.h" +#include "fsfw/devicehandlers/DeviceHandlerBase.h" + #if OBSW_ADIS16507_LINUX_COM_IF == 1 class SpiComIF; class SpiCookie; @@ -69,7 +71,7 @@ private: const uint8_t *sendData, size_t sendLen, void* args); #endif -#if OBSW_DEBUG_ADIS16507 == 1 +#if FSFW_HAL_ADIS16507_GYRO_DEBUG == 1 PeriodicOperationDivider* debugDivider; #endif Countdown breakCountdown; diff --git a/mission/devices/devicedefinitions/GyroADIS16507Definitions.h b/mission/devices/devicedefinitions/GyroADIS16507Definitions.h index a7970b81..b83c984d 100644 --- a/mission/devices/devicedefinitions/GyroADIS16507Definitions.h +++ b/mission/devices/devicedefinitions/GyroADIS16507Definitions.h @@ -1,6 +1,7 @@ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GYROADIS16507DEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_GYROADIS16507DEFINITIONS_H_ +#include "fsfw/devicehandlers/DeviceHandlerIF.h" #include "fsfw/datapoollocal/StaticLocalDataSet.h" #include -- 2.43.0 From ee878d9fe9205cdf1146cb8586dd6279c0a12782 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 16:14:33 +0200 Subject: [PATCH 093/102] bugfix EIVE PST --- .../pollingSequenceFactory.cpp | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 646b8633..fdbdd52e 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -443,27 +443,27 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { bool enableBside = false; if(enableAside) { // A side -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -476,16 +476,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.35, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.75, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.85, + DeviceHandlerIF::GET_READ); } if(enableBside) { -- 2.43.0 From 7b7bd7670369719865e771004c55f6238b68082e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Sep 2021 18:38:06 +0200 Subject: [PATCH 094/102] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index c51d2df4..29c74283 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit c51d2df43dca317175a9448e662f7f469e5f8725 +Subproject commit 29c74283f117bb68186d1161896d82e3361680c2 -- 2.43.0 From e56a30df0650e7ebd5c83dc3a1138b4fb494facb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 13:13:46 +0200 Subject: [PATCH 095/102] HW bug fixes, board should work cleanly now --- bsp_q7s/core/ObjectFactory.cpp | 4 ++-- .../pollingSequenceFactory.cpp | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index a6d6dda3..9c1b58d3 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -490,7 +490,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); #if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 - gyroL3gHandler->setGoNormalModeAtStartup(); + gyroL3gHandler->setToGoToNormalMode(true); #endif // Gyro 2 Side B spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, @@ -506,7 +506,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); #if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 - gyroL3gHandler->setGoNormalModeAtStartup(); + gyroL3gHandler->setToGoToNormalMode(true); #endif bool debugGps = false; diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index fdbdd52e..642199da 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -439,8 +439,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { #endif #if OBSW_ADD_ACS_BOARD == 1 - bool enableAside = true; - bool enableBside = false; + bool enableAside = false; + bool enableBside = true; if(enableAside) { // A side thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, @@ -465,16 +465,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.3, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.75, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.3, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); -- 2.43.0 From aa71159a9a2e3bbb565fbef8a3aada8a28f53e3f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 14:45:42 +0200 Subject: [PATCH 096/102] A side enabled by default --- linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 642199da..3b826119 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -439,8 +439,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { #endif #if OBSW_ADD_ACS_BOARD == 1 - bool enableAside = false; - bool enableBside = true; + bool enableAside = true; + bool enableBside = false; if(enableAside) { // A side thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, -- 2.43.0 From 0ccf062d51be57d42d1aaa96453b105bd50a71ef Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 15:20:55 +0200 Subject: [PATCH 097/102] transition delays --- bsp_q7s/core/ObjectFactory.cpp | 12 ++++++------ common/config/devConf.h | 5 ++++- fsfw | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 9c1b58d3..4223c8fc 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -442,7 +442,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF, - spiCookie, 0); + spiCookie, spi::LIS3_TRANSITION_DELAY); mgmLis3Handler->setStartUpImmediately(); #if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 mgmLis3Handler->setToGoToNormalMode(true); @@ -451,7 +451,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, - spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_A); + spiCookie, spi::RM3100_TRANSITION_DELAY); mgmRm3100Handler->setStartUpImmediately(); #if FSFW_HAL_RM3100_MGM_DEBUG == 1 mgmRm3100Handler->setToGoToNormalMode(true); @@ -460,7 +460,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); auto mgmLis3Handler2 = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, - spiCookie, 0); + spiCookie, spi::LIS3_TRANSITION_DELAY); mgmLis3Handler2->setStartUpImmediately(); #if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 mgmLis3Handler2->setToGoToNormalMode(true); @@ -469,7 +469,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, - spiCookie, pcduSwitches::SwitcherList::ACS_BOARD_SIDE_B); + spiCookie, spi::RM3100_TRANSITION_DELAY); mgmRm3100Handler->setStartUpImmediately(); #if FSFW_HAL_RM3100_MGM_DEBUG == 1 mgmRm3100Handler->setToGoToNormalMode(true); @@ -487,7 +487,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, - spiCookie, 0); + spiCookie, spi::L3G_TRANSITION_DELAY); gyroL3gHandler->setStartUpImmediately(); #if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 gyroL3gHandler->setToGoToNormalMode(true); @@ -503,7 +503,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, - spiCookie, 0); + spiCookie, spi::L3G_TRANSITION_DELAY); gyroL3gHandler->setStartUpImmediately(); #if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 gyroL3gHandler->setToGoToNormalMode(true); diff --git a/common/config/devConf.h b/common/config/devConf.h index e1d95b5e..fbd9763b 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -10,14 +10,17 @@ */ namespace spi { -/* Default values, changing them is not supported for now */ +// Default values, changing them is not supported for now static constexpr uint32_t DEFAULT_LIS3_SPEED = 976'000; +static constexpr uint32_t LIS3_TRANSITION_DELAY = 10000; static constexpr spi::SpiModes DEFAULT_LIS3_MODE = spi::SpiModes::MODE_3; static constexpr uint32_t DEFAULT_RM3100_SPEED = 976'000; +static constexpr uint32_t RM3100_TRANSITION_DELAY = 10000; static constexpr spi::SpiModes DEFAULT_RM3100_MODE = spi::SpiModes::MODE_3; static constexpr uint32_t DEFAULT_L3G_SPEED = 976'000; +static constexpr uint32_t L3G_TRANSITION_DELAY = 10000; static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3; static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000; diff --git a/fsfw b/fsfw index 29c74283..c9b343eb 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 29c74283f117bb68186d1161896d82e3361680c2 +Subproject commit c9b343ebcd92de1d214a9b1d7abafee4a7e79888 -- 2.43.0 From d5205b59c1eb052b2674617f0dcca312a5eda6da Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 15:24:47 +0200 Subject: [PATCH 098/102] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 29c74283..350fbc38 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 29c74283f117bb68186d1161896d82e3361680c2 +Subproject commit 350fbc385cedae73ea2396dafdeb5b74b28be74d -- 2.43.0 From b12845521742085375ab45235972e71db6b3cd72 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 15:35:33 +0200 Subject: [PATCH 099/102] RW small improvements --- bsp_q7s/core/ObjectFactory.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 4223c8fc..ff8415f8 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -813,18 +813,30 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { auto rwHandler1 = new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF, gpioIds::EN_RW1); +#if OBSW_DEBUG_RW == 1 + rwHandler1->setStartUpImmediately(); +#endif rw1SpiCookie->setCallbackArgs(rwHandler1); auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF, gpioIds::EN_RW2); +#if OBSW_DEBUG_RW == 1 + rwHandler2->setStartUpImmediately(); +#endif rw2SpiCookie->setCallbackArgs(rwHandler2); auto rwHandler3 = new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF, gpioIds::EN_RW3); +#if OBSW_DEBUG_RW == 1 + rwHandler3->setStartUpImmediately(); +#endif rw3SpiCookie->setCallbackArgs(rwHandler3); auto rwHandler4 = new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF, gpioIds::EN_RW4); +#if OBSW_DEBUG_RW == 1 + rwHandler4->setStartUpImmediately(); +#endif rw4SpiCookie->setCallbackArgs(rwHandler4); } -- 2.43.0 From 8693075061dc78a07ca88d7c2f535c1ea143a2cb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 15:58:03 +0200 Subject: [PATCH 100/102] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 350fbc38..dccc2f0b 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 350fbc385cedae73ea2396dafdeb5b74b28be74d +Subproject commit dccc2f0ba77184933e3d551d95950a5b0801d2f2 -- 2.43.0 From 8fc144b595f9527dbaf52bbdb158accab4d10a9a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 16:03:09 +0200 Subject: [PATCH 101/102] RW handler tweaks --- bsp_q7s/core/ObjectFactory.cpp | 8 -------- mission/devices/RwHandler.cpp | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index ff8415f8..d956a392 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -766,14 +766,6 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4); -// GpiodRegular* enRw1 = new GpiodRegular("Enable reaction wheel 1", gpio::OUT, 0, -// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS); -// gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); -// GpiodRegular* enRw2 = new GpiodRegular("Enable reaction wheel 2", gpio::OUT, 0, -// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS); -// gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2); -// GpiodRegular* enRw3 = new GpiodRegular(, gpio::OUT, 0, -// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS); auto enRw1 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS, "Enable reaction wheel 1", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); diff --git a/mission/devices/RwHandler.cpp b/mission/devices/RwHandler.cpp index 571f7eca..792e530d 100644 --- a/mission/devices/RwHandler.cpp +++ b/mission/devices/RwHandler.cpp @@ -144,47 +144,47 @@ void RwHandler::fillCommandAndReplyMap() { ReturnValue_t RwHandler::scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) { - - switch (*(start)) { - case (static_cast(RwDefinitions::GET_LAST_RESET_STATUS)): { + uint8_t replyByte = *start; + switch (replyByte) { + case (RwDefinitions::GET_LAST_RESET_STATUS): { *foundLen = RwDefinitions::SIZE_GET_RESET_STATUS; *foundId = RwDefinitions::GET_LAST_RESET_STATUS; break; } - case (static_cast(RwDefinitions::CLEAR_LAST_RESET_STATUS)): { + case (RwDefinitions::CLEAR_LAST_RESET_STATUS): { *foundLen = RwDefinitions::SIZE_CLEAR_RESET_STATUS; *foundId = RwDefinitions::CLEAR_LAST_RESET_STATUS; break; } - case (static_cast(RwDefinitions::GET_RW_STATUS)): { + case (RwDefinitions::GET_RW_STATUS): { *foundLen = RwDefinitions::SIZE_GET_RW_STATUS; *foundId = RwDefinitions::GET_RW_STATUS; break; } - case (static_cast(RwDefinitions::INIT_RW_CONTROLLER)): { + case (RwDefinitions::INIT_RW_CONTROLLER): { *foundLen = RwDefinitions::SIZE_INIT_RW; *foundId = RwDefinitions::INIT_RW_CONTROLLER; break; } - case (static_cast(RwDefinitions::SET_SPEED)): { + case (RwDefinitions::SET_SPEED): { *foundLen = RwDefinitions::SIZE_SET_SPEED_REPLY; *foundId = RwDefinitions::SET_SPEED; break; } - case (static_cast(RwDefinitions::GET_TEMPERATURE)): { + case (RwDefinitions::GET_TEMPERATURE): { *foundLen = RwDefinitions::SIZE_GET_TEMPERATURE_REPLY; *foundId = RwDefinitions::GET_TEMPERATURE; break; } - case (static_cast(RwDefinitions::GET_TM)): { + case (RwDefinitions::GET_TM): { *foundLen = RwDefinitions::SIZE_GET_TELEMETRY_REPLY; *foundId = RwDefinitions::GET_TM; break; } default: { - sif::debug << "RwHandler::scanForReply: Reply contains invalid command code" << std::endl; + sif::warning << "RwHandler::scanForReply: Reply contains invalid command code" << + std::endl; return RETURN_FAILED; - break; } } -- 2.43.0 From 397e1433fd59b88c53b9fa86dea471db24c88484 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 17:14:08 +0200 Subject: [PATCH 102/102] GPS and RW handler improvements --- fsfw | 2 +- mission/devices/GPSHyperionHandler.cpp | 10 ++++++---- mission/devices/GPSHyperionHandler.h | 1 + mission/devices/RwHandler.cpp | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/fsfw b/fsfw index dccc2f0b..e1a85b47 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit dccc2f0ba77184933e3d551d95950a5b0801d2f2 +Subproject commit e1a85b47c5018590e58b9b1130b1754b0079450f diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 26b86a76..8944d17a 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -60,10 +60,8 @@ ReturnValue_t GPSHyperionHandler::buildCommandFromCommand( PoolReadGuard pg(&gpsSet); // Set HK entries invalid gpsSet.setValidity(false, true); - // The user needs to implement this. Don't touch states for now, the device should - // quickly reboot and send valid strings again. - actionHelper.finish(true, getCommanderQueueId(deviceCommand), deviceCommand); - return resetCallback(resetCallbackArgs); + resetCallback(resetCallbackArgs); + return HasActionsIF::EXECUTION_FINISHED; } return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } @@ -210,3 +208,7 @@ ReturnValue_t GPSHyperionHandler::initialize() { // Enable reply immediately for now return updatePeriodicReply(true, GpsHyperion::GPS_REPLY); } + +ReturnValue_t GPSHyperionHandler::acceptExternalDeviceCommands() { + return DeviceHandlerBase::acceptExternalDeviceCommands(); +} diff --git a/mission/devices/GPSHyperionHandler.h b/mission/devices/GPSHyperionHandler.h index 13591b44..e7c925be 100644 --- a/mission/devices/GPSHyperionHandler.h +++ b/mission/devices/GPSHyperionHandler.h @@ -22,6 +22,7 @@ public: using gpioResetFunction_t = ReturnValue_t (*) (void* args); void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void*args); + ReturnValue_t acceptExternalDeviceCommands() override; ReturnValue_t initialize() override; protected: diff --git a/mission/devices/RwHandler.cpp b/mission/devices/RwHandler.cpp index 792e530d..91188d87 100644 --- a/mission/devices/RwHandler.cpp +++ b/mission/devices/RwHandler.cpp @@ -184,6 +184,7 @@ ReturnValue_t RwHandler::scanForReply(const uint8_t *start, size_t remainingSize default: { sif::warning << "RwHandler::scanForReply: Reply contains invalid command code" << std::endl; + *foundLen = remainingSize; return RETURN_FAILED; } } -- 2.43.0