In *_commands.json command files, there are fields like this:
"address":"0x00"
When they are parsed into a std::vector<uint8_t> by string_to_chars(std::string hex_str), the written string length in the JSON will be preserved. The problem is that this length passes directly to the SpaceWire packet constructing functions, and results in a too-short SpaceWire address field if the JSON addresses are not explicitly written 4 B long.
Fix
When parsing out the command file JSON, guarantee the result stored in Command is 4 B long. This is done in CommandDeck::add_commands().
The trouble
In
*_commands.json
command files, there are fields like this:When they are parsed into a
std::vector<uint8_t>
bystring_to_chars(std::string hex_str)
, the written string length in the JSON will be preserved. The problem is that this length passes directly to the SpaceWire packet constructing functions, and results in a too-short SpaceWire address field if the JSON addresses are not explicitly written 4 B long.Fix
When parsing out the command file JSON, guarantee the result stored in
Command
is 4 B long. This is done inCommandDeck::add_commands()
.