Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe vscp_core_process should return true if vscp_core_extPageReadData has to send data #43

Closed
benys opened this issue Oct 1, 2022 · 5 comments

Comments

@benys
Copy link

benys commented Oct 1, 2022

Hi,

My implementation your framework uses events.So I would like to "sleep" MCU during waiting for CAN messages or IRQ.
But I discovered when ext page read is requested - "outside" program doesn't know and it cannot execute loop something like this:

while(event is handled) {
  while(vscp_core_process());
  //do work
}

What do you think? Maybe vscp_core_process should return true if something is need to handle?

Thanks
Kamil

@BlueAndi
Copy link
Owner

BlueAndi commented Oct 2, 2022

Hi Kamil,
if you send the MCU in sleep mode, does the CAN controller trigger an ISR via ext. interrupt to wake the MCU up again?
In sleep mode the code itself is not running, therefore vscp_core_process() is not called.

Note, dealing with the ISR is MCU/user specific and not part of the framework.

If the MCU is running, vscp_core_process() will return TRUE for a handled event. If there isn't a event to handle, it will return FALSE.

@benys
Copy link
Author

benys commented Oct 2, 2022

My true - enviroment is that I have timer which executes every second:

while(vscp_core_process());

And also it execute if CAN message is arrives. It works very well.

But I found problem, that if controller ask about ext page read with many data to send, your framework assume that vscp_core_process is executed inity in loop.
In my case this framework potion of code:

/* Continue a extended page read? */
    if (0 < vscp_core_extPageReadData.count)
    {
        vscp_core_extendedPageReadRegister(&vscp_core_extPageReadData);
    }

will execute only once per second :-)

I think that it should looks like this:

/* Continue a extended page read? */
    if (0 < vscp_core_extPageReadData.count)
    {
        vscp_core_extendedPageReadRegister(&vscp_core_extPageReadData);
        return true
    }

@BlueAndi
Copy link
Owner

BlueAndi commented Oct 2, 2022

Yes, you are right. The ext. page read depends on your sleep interval in this case.
I will update the vscp-framework correspondingly.

BlueAndi added a commit that referenced this issue Oct 2, 2022
BlueAndi added a commit that referenced this issue Oct 2, 2022
@benys
Copy link
Author

benys commented Oct 4, 2022

@BlueAndi thank you!

@benys benys closed this as completed Oct 4, 2022
@BlueAndi
Copy link
Owner

BlueAndi commented Oct 4, 2022

You are welcome. Note, the next release of the vscp-framework and the Arduino lib will probably come in my christmas vacation.

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

No branches or pull requests

2 participants