Skip to content

Compile without ethernet packets/orders and Round robin stack packets#89

Open
Cantonplas wants to merge 3 commits into
mainfrom
fix/round-robin-packets
Open

Compile without ethernet packets/orders and Round robin stack packets#89
Cantonplas wants to merge 3 commits into
mainfrom
fix/round-robin-packets

Conversation

@Cantonplas

Copy link
Copy Markdown
Contributor

No description provided.

This will make it so that you use the general_info.json ports. Also better exceptions for the code :p
Comment on lines +20 to +28
#ifdef STLIB_ETH
{% for packet in packets -%}
static void {{packet.name}}_init({% for variable in packet.variables %}{{variable.type}} &{{variable.name}}{% if not loop.last %}, {% endif %}{% endfor %})
{
{{packet.name}}_packet = new HeapPacket(static_cast<uint16_t>({{packet.id}}){% if packet.variables %}, {% for variable in packet.variables %}&{{variable.name}}{% if not loop.last %}, {% endif %}{% endfor %}{% endif %});
{{packet.name}}_packet = new StackPacket(static_cast<uint16_t>({{packet.id}}){% if packet.variables %}, {% for variable in packet.variables %}&{{variable.name}}{% if not loop.last %}, {% endif %}{% endfor %}{% endif %});
}

{% endfor -%}
#endif

@victor-Lopez25 victor-Lopez25 Jun 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making this in a single #ifdef block you can inside each function put an #ifdef block to do this:

#ifdef STLIB_ETH
  {{packet.name}}_packet = new StackPacket(static_cast<uint16_t>({{packet.id}}){% if packet.variables %}, {% for variable in packet.variables %}&{{variable.name}}{% if not loop.last %}, {% endif %}{% endfor %}{% endif %});
#else
  {% for variable in packet.variables %}(void){{variable.name}};{% endfor %}
#endif

This way the program using this api won't have to change if it is not using ethernet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants