Skip to content

[amnb] build error with code from g071 example #1214

@Tecnologic

Description

@Tecnologic

Hi all,

i'm quite new to modm an trying to evaluate if the amnb protocol is something for my application. With the great docs i started a project on the F4-disco board and used the nucleo-g071 amnb example as a base.

But when compiling i get this error:

`main.cpp: In member function 'bool Thread::update()':
modm\src/modm/processing/protothread/macros.hpp:91:22: error: jump to case label
   91 |                 case __LINE__: \
      |                      ^~~~~~~~
main.cpp:111:32: note: in expansion of macro 'PT_CALL'
  111 |                         res1 = PT_CALL(node2.request<uint8_t>(1, 1));`

The code is a direct copy of the example:

class Thread : public modm::pt::Protothread
{
	modm::ShortPeriodicTimer tmr{1s};
	uint32_t counter{0};
	Result<uint8_t> res1;
	Result<uint8_t, uint8_t> res2;

public:
	bool inline
	update()
	{
		PT_BEGIN();

		while(true)
		{
			PT_WAIT_UNTIL(tmr.execute());

			LedGreen::toggle();

			node1.broadcast(1, counter++);
			node3.broadcast(2);

			res1 = PT_CALL(node2.request<uint8_t>(1, 1));
			MODM_LOG_INFO << "Node1 responded with: " << res1.error();
			if (res1) { MODM_LOG_INFO << " " << *res1 << modm::endl; }

			res2 = PT_CALL(node1.request<uint8_t, uint8_t>(3, 2, counter));
			MODM_LOG_INFO << "Node3 responded with: " << res2.error();
			if (res2.hasUserError()) {
				MODM_LOG_INFO << " " << *res2.userError() << modm::endl;
			}
		}

		PT_END();
	}
}
thread;

I cant see the error here. PT_BEGIN is where it should be, i see no declaration of a local variable which could be uninitialized in a next case, in short i dot get what gcc is saying to me.

Is this a potential bug or is it me doing something wrong with protothreads?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions