OzGrant 22 Posted January 27, 2016 Share Posted January 27, 2016 G Quote Link to post Share on other sites
OzGrant 22 Posted January 29, 2016 Author Share Posted January 29, 2016 I have a temporary solution to my problem of detecting the error line number relative to the start of that tab module. Normally if an error occurs within a function, the function name is displayed in the complier error screen, and all one has to do is search for that function name and determine the error. But if an erroneous character is between functions you normally have no clue where it is, and only told what the absolute error line number is. Step 1. And this function at the start of each tab module. void FirstLineBMP(void){ Serial.print("\nFirstLine BMP\t\t="); Serial.print(__LINE__ -1); } Make each function name and print line unique by including the TAB name Step 2. Add this function: void printLast(){ // one for each Tab FirstLineBMP(); FirstLineBT(); FirstLineEEM(); FirstLineI2C(); FirstLineKM(); FirstLineOLD(); FirstLineOW(); FirstLinePINS(); FirstLinePOLL(); FirstLineRTC(); FirstLineRULES(); FirstLineSD(); FirstLineTRYOUT(); FirstLineZLIB(); FirstLineZORG(); FirstLineZWIFI(); FirstLineZZBUGS(); FirstLineZZDHT22(); FirstLineZZFRAM(); Serial.println(); } Step 3 In setup() add this function call: printFirst(); This will produce list similar to the following: FirstLine BMP =2129 FirstLine BT =2223 FirstLine EEM =2492 FirstLine I2C =2576 FirstLine KM =3098 FirstLine OLD =3254 FirstLine OW =4030 FirstLine PINS =5653 FirstLine POLL =5732 FirstLine RTC =6051 FirstLine RULES =7863 FirstLine SD =9361 FirstLine TRYOUT =10123 FirstLine ZLIB =11023 FirstLine ZORG =11232 FirstLine ZWIFI =12891 FirstLine ZZBUGS =12944 FirstLine ZZDHT22 =12959 FirstLine ZZFRAM =13110 Step 4 Cut and past the list to a file. Step 5 Repeat Steps 3 & 4 whenever substantial code has been added to sketch. Of course these steps can only be performed on a bug free sketch. Step 6 (at last the fun part) An erroneous character has appeared (you accidently typed it in) between a function. You get a message like the following RulesTivaV44.cpp: At global scope: RulesTivaV44.cpp:2746:1: error: 'x' does not name a type As line 2746 is between... FirstLine I2C =2576 FirstLine KM =3098 ... the bug is in I2C tab module So subtract 2576 from 2746 resulting in 170 Now open up the I2C Tab and goto line 170 and fix the bug. Have fun Grant Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.