logger: change message id from uint16_t to uint8_t

256 subscriptions are enough for now.
Reduces RAM usage by 300 bytes.
This commit is contained in:
Beat Küng
2018-10-17 15:59:50 +02:00
parent d6e820fe67
commit 28ac7679e0
2 changed files with 9 additions and 4 deletions
+6 -1
View File
@@ -1752,7 +1752,12 @@ void Logger::write_add_logged_msg(LoggerSubscription &subscription, int instance
{
ulog_message_add_logged_s msg;
if (subscription.msg_ids[instance] == (uint16_t) - 1) {
if (subscription.msg_ids[instance] == (uint8_t) - 1) {
if (_next_topic_id == (uint8_t) - 1) {
// if we land here an uint8 is too small -> switch to uint16
PX4_ERR("limit for _next_topic_id reached");
return;
}
subscription.msg_ids[instance] = _next_topic_id++;
}