read() meaning I always need to read everytime before checking last NMEA or use. sendCommand("") since any bit sent to GPS will wake it up. wakeup()since the header uses waitForSentence (PMTK_AWAKE) in the func, so I just use. The standby and wakeup works now because of this. Therefore, I changed the sentence to: GPS.waitForSentence("$PMTK011,MTKGPS*08") which is basically the chip identifier which always come up when GPS starts/restarts. It appears that the response defined as PMTK_AWAKE rarely appear. ![]() ![]() I initally use: GPS.waitForSentence (PMTK_AWAKE) which is defined in the header, but that sentence was never cleared so I had to print out the NMEA to see what sentence actually came up. Now, the most confusing of all is the GPS library. Meaning: *(Array+7) = Array since pointer Array (without specified position ) is just a pointer to the start of the array/chunk of memory, so +7 means the next 7 positions. Thus, they are just continuous lines of data with "0" at the end in the case of string. they are not real array or string but act as pointer to a specific memory where the values get stored. In C/C++, array or strings work very similarly i.e. pointer points to the input when recalled in the main loop. ![]() The problem was solved simply by using the pointer (*) in the function parameter i.e. Now everything is consistent using the same file register.Īnother is when I tried to create file name by passing along the string from input parameter when using function in the main loop. declare file in setup, refer in and return from createFile, then refer in logGPSNMEA. The solution seems to be that instead of carrying the file name to be opened in the function, I can just reference the logfile over to the function (using & operator) i.e. I actually struggle a lot with the function that returns file type. But, remember to watch out for "fragmented heap" which could prevent us from really claiming back the dynamic space. This could be made better by de-allocating dynamic space. In creating functions, I can use the reclaimable stack space. SRAM allocation contains (1) Global and Static variables (2) Local variables (stack) (3) and Dynamic Allocations in between. SdFat sd Although it might be better to use "namespace" or "typedef" idk, have to read more. Instead of true header name, you can specify alias e.g. Uint8_t is used to specify that int is defined to be 8 bit which means uint16_t and uint32_t are 16 and 32 bits accordingly. void flash (uint8_t pin, char times = 0) ) Void logGPSNMEA (File & logfile) -> log GPS to specified fileĬhar timerswitch(uint8_t nswitch) -> switch operator by time pressedĭefault values for function parameters can be set at function declaration (e.g. Void flash (uint8_t pin, char times) -> replace manual LED blinkingįile createFile(File & logfile, char *prefix) -> generate file Since when the function closes, the memory allocated for stack (local variables) will be 100% reclaimed as free space thus, freeing up space and prevent RAM crashes. The two main reasons are that I'm trying to organize the code and trying to save memories esp. I'm trying more to break out the codes in the main loop into private functions. If not used, SIGNAL and useInterrupt can be deleted. Thus, this is mainly used for debugging to confirm what GPS is reading. useInterrupt allows the GPS to Serial.print the NMEA sentence (lastNMEA) even while loop is running. Interrupt is basically you are trying to do something while in the middle of other functions in this case main loop(). However, I saw no difference in dynamic memory i.e. Following some recommendations on forums, I decided to use SdFat.h instead of SD.h Although functions are more limited, it could save SRAM. ![]() $PMTK010,002*2D -> module is awake and waiting for input on the Serial connectionĪll of these indicate startup signals. $PMTK010,001*2E -> configuration is completed $PMTK011,MTKGPS*08 -> MTKGPS is a general chip identifier $PGACK,105*46 -> GPS initialization routine is done $PGACK,103*40 -> getting ready for a cold-start (flushing all memory of previous fixes)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |