Sorry for my delay in replying, busy weekend, and have been chasing the fault I have which was the reason I asked the question to start with.
Thanks for all your replies, the flow is what I thought, I really couldn’t see functions being that different.
arduino_new:
func5 returns to func3 (I assume you mistyped).
Opps yes sorry
The reason for the question was I'm getting straight results from things, I know I'm I am new to the world of Arduino and it’s a very large learning curve but something its right.
I'm working on a project using WS2811 running on a ESP8266, the WS pixels are very picky about timing, however if I have got my info right (and there is no guarantee I have) this shouldn’t a be problem
To make life easier for programming I have put various functions in .h files. One of the functions runs the WS2811 output
The full code from the project is far to big to post but here is a break down of what's happening.
I have a .h file with the following
#ifndef JSON_WS.h
#define JSON_ WS.h
void ICACHE_FLASH_ATTR WSOut() {
os_intr_lock();
for (uint16_t t = 0; t < 512; t++) {
.. process the data and send them out, there are timed loop etc to keep the timings using the pixArray[t]
}
os_intr_unlock();
}
#endif
// main file
uint8_t pixArray[512];
#include "WS.h";
void loop() {
webSocket.loop();
server.handleClient();
// other timers via millis and doing stuff
if (udp.parsePacket()) {
// check the Packets, process into pixArray
WSOut ();
}
So based on the above this is what I should expect to happen
It just sit in the loop doing the websocket and server and checking for data, if data is found, run the WSOut.
If data found, it should go off a run the WSOut, it shouldn’t return to the main loop until it has finished processing the data in WSout.
The WSout is stored in the .h file, in this function it calls os_intr_lock(), os_intr_unlock(); I can't find documentation to these, but have found references. From what I understand this said, "I don't care what else you are doing, stop it, and ONLY deal with this"
The issue I have is that I get the 1st LED flashing green, this is where I have spent hours chasing my tail, it turns out that is I remove the WSOut function from the .h file and keep it in the main file, it works.
This makes no sense, why would the code in the .h file mess up, apart from it being stored in a separate file its the same code?
The idea of using .h files so store functions is basic stuff, most programmers will split functions out once they are working.
BRAIN HURTS!