Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 8 Replies) Intellisense problems with Teensy 3.5? (Read 5263 times)
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Intellisense problems with Teensy 3.5?
Dec 10th, 2022 at 5:31pm
Print Post  
I think I'm having similar issues with code targeted at Teensy 3.5 - intellisense doesn't like any ENUM definitions/references, and also some function definitions.  I just updated my install to 2.2022.1128-4, but that did not seem to help.

I created a new Arduino project targeted at T3.5 as shown below

Code
Select All
/*
    Name:       IntellisenseTest.ino
    Created:	12/10/2022 11:58:21 AM
    Author:     FRANKNEWXPS15\Frank
*/

enum AnomalyCode
{
  NO_ANOMALIES = 0,
  STUCK_AHEAD,
  STUCK_BEHIND,
  OBSTACLE_AHEAD,
  WALL_OFFSET_DIST_AHEAD,
  OBSTACLE_BEHIND,
  OPEN_CORNER,
  DEAD_BATTERY,
  //CHG_STN_AVAIL, //added 04/14/22 c/o 06/12/22  back in 06/14/22 c/o again 06/16/22
  CHARGER_CONNECTED //added 05/22/22
};

AnomalyCode errcode = STUCK_BEHIND;
AnomalyCode errcode2 = (AnomalyCode)STUCK_BEHIND;
AnomalyCode errcode3 = AnomalyCode::STUCK_BEHIND;

void setup()
{


}

void loop()
{


}
 




Here's a screenshot of my current robot program showing a number of 'errors' highlighted by intellisense, even thought the program runs and compiles correctly (clicking on the link doesn't work for me, but copy/pasting it into a browser window does - don't know why)

https://drive.google.com/file/d/1j9XLtrC8CoTTNPpXagRuPaqRH-IQmk9z/viewusp=share_...

Looking through the 'New Releases' post, I am more than a little confused about all the different versions. It appears that 2.2022.1128-4 is the latest version, but it doesn't seem to affect the problem, even with a brand-new project.

What am I missing here?

TIA,

Frank




  
Back to top
 
IP Logged
 
cfeied
Junior Member
**
Offline


Posts: 49
Joined: May 18th, 2016
Re: Intellisense problems with Teensy 3.5?
Reply #1 - Dec 10th, 2022 at 9:47pm
Print Post  
The google drive link you posted says "not available," but I tested your code for Teensy 3.5 and 3.6.

The only squiggle I got was on STUCK_BEHIND in the line: AnomalyCode errcode = STUCK_BEHIND;

I believe this may be related to a longstanding visual studio (also VisualStudio/Code) intellisense bug related to enums: "A value of type X cannot be used to initialize an entity of type X"

The simplest workaround is to declare variables as type auto rather than as type AnomalyCode. For example:  auto errcode0 = STUCK_AHEAD;


However, my usual workaround is to make the enum a typedef and give it two names. That seems to work here:  visual studio (with visualMicro) identifies errcode as type AnomalyCode and STUCK_BEHIND as type AnomalyCode_t. 

As the attached screencap shows, there are no squiggles. 

Does that help at all?


Code
Select All
/*
    Name:       EnumTest.ino
    Created:	12/10/2022 4:00:10 PM
    Author:     CFF-ANTHEA\cff
*/

typedef enum AnomalyCode_t
{
    NO_ANOMALIES,
    STUCK_AHEAD,
    STUCK_BEHIND,
    OBSTACLE_AHEAD,
    WALL_OFFSET_DIST_AHEAD,
    OBSTACLE_BEHIND,
    OPEN_CORNER,
    DEAD_BATTERY,
    //CHG_STN_AVAIL, //added 04/14/22 c/o 06/12/22  back in 06/14/22 c/o again 06/16/22
    CHARGER_CONNECTED //added 05/22/22
} AnomalyCode;

AnomalyCode errcode = STUCK_BEHIND;
AnomalyCode errcode2 = (AnomalyCode)STUCK_BEHIND;
AnomalyCode errcode3 = AnomalyCode::STUCK_BEHIND;

void setup()
{


}

void loop()
{


}


 


  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense problems with Teensy 3.5?
Reply #2 - Dec 10th, 2022 at 10:01pm
Print Post  
There is a free upgrade to the new version of Visual Micro. It provies a new intellisense engine that understands Gcc better than the older Vs C++ that Visual Micro used.

The older projects are still supported in the new release and we will be releasing an auto update feature. 

In the meantime, close the solution, make a copy of your .vcxproj file, then delete it. After that use "File>Open>Arduino Project" to open the master INO file. That will create you a new .vcxproj that uses the new format. After that you can re-open the original solution.

Let us know how it goes or any questions.

ps: In 2.0, you should fine intellise is very accurate now and fully understands the gcc language. There should be no need to refine any code. fyi: in all versions of visual studio, we can add a vs-intellisense.hints file to a project.
« Last Edit: Dec 10th, 2022 at 10:09pm by Tim@Visual Micro »  
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Intellisense problems with Teensy 3.5?
Reply #3 - Dec 11th, 2022 at 7:59pm
Print Post  
Tim,

I'm still confused.  With my current VM version (2.2022.1128-4), deleting & re-creating the vxcproj file doesn't seem to do anything with respect to intellisense errors.  I still get all the errors I had before.  Do I need to replace 2.2022.1128-4 with the ARM64 Beta 2.0?

Frank
« Last Edit: Dec 11th, 2022 at 8:00pm by FrankP »  
Back to top
 
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Intellisense problems with Teensy 3.5?
Reply #4 - Dec 11th, 2022 at 8:07pm
Print Post  
cfeied wrote on Dec 10th, 2022 at 9:47pm:
The google drive link you posted says "not available," but I tested your code for Teensy 3.5 and 3.6.

The only squiggle I got was on STUCK_BEHIND in the line: AnomalyCode errcode = STUCK_BEHIND;

I believe this may be related to a longstanding visual studio (also VisualStudio/Code) intellisense bug related to enums: "A value of type X cannot be used to initialize an entity of type X"

The simplest workaround is to declare variables as type auto rather than as type AnomalyCode. For example:  auto errcode0 = STUCK_AHEAD;


However, my usual workaround is to make the enum a typedef and give it two names. That seems to work here:  visual studio (with visualMicro) identifies errcode as type AnomalyCode and STUCK_BEHIND as type AnomalyCode_t. 

As the attached screencap shows, there are no squiggles. 

Does that help at all?


Code
Select All
/*
    Name:       EnumTest.ino
    Created:	12/10/2022 4:00:10 PM
    Author:     CFF-ANTHEA\cff
*/

typedef enum AnomalyCode_t
{
    NO_ANOMALIES,
    STUCK_AHEAD,
    STUCK_BEHIND,
    OBSTACLE_AHEAD,
    WALL_OFFSET_DIST_AHEAD,
    OBSTACLE_BEHIND,
    OPEN_CORNER,
    DEAD_BATTERY,
    //CHG_STN_AVAIL, //added 04/14/22 c/o 06/12/22  back in 06/14/22 c/o again 06/16/22
    CHARGER_CONNECTED //added 05/22/22
} AnomalyCode;

AnomalyCode errcode = STUCK_BEHIND;
AnomalyCode errcode2 = (AnomalyCode)STUCK_BEHIND;
AnomalyCode errcode3 = AnomalyCode::STUCK_BEHIND;

void setup()
{


}

void loop()
{


}


 





This DID help - just not as completely as I hoped.  Using the typedef trick removes the intellisense errors from all references to enums, EXCEPT it still flags functions with enum return types, such as:

Code
Select All
AnomalyCode CheckForAnomalies()
{
  AnomalyCode errcode = NO_ANOMALIES;

  if (gl_bStuckAhead)
  {
    errcode = STUCK_AHEAD;
  }
  else if (gl_bStuckBehind)
  {
    errcode = STUCK_BEHIND;
  }
  else if (gl_bObstacleAhead)
  {
    errcode = OBSTACLE_AHEAD;
  }
  else if (gl_bWallOffsetDist)
  {
    errcode = WALL_OFFSET_DIST_AHEAD;
  }
  else if (gl_bObstacleBehind)
  {
    errcode = OBSTACLE_BEHIND;
  }
  else if (gl_bDeadBattery)
  {
    errcode = DEAD_BATTERY;
  }
  //06/12/22 removed, 06/14/22 replaced, 06/16/22 removed again
  //else if (gl_bIRBeamAvail)
  //{
  //  errcode = CHG_STN_AVAIL;
  //}
  else if (gl_bChgConnect)
  {
    errcode = CHARGER_CONNECTED;
  }
  else
  {
    errcode = NO_ANOMALIES;
  }

  //gl_pSerPort->printf("at bottom of  CheckForAnomalies() with errcode = %d\n", errcode);
  return errcode;
} 



In the above function, the function name is underlined with a red squiggly line, but the line 'AnomalyCode errcode = NO_ANOMALIES' isn't anymore (after the 'typedef' trick was applied).  Also, any call to the CheckForAnomalies() function is underlined as well.


  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense problems with Teensy 3.5?
Reply #5 - Dec 11th, 2022 at 11:04pm
Print Post  
No the ARM version is for apple mac and arm users.

Please post your verbose output and also confirm that with the new project you see the word (Arduino) to the right of the project name in the solution explorer.

Thanks
  
Back to top
IP Logged
 
cfeied
Junior Member
**
Offline


Posts: 49
Joined: May 18th, 2016
Re: Intellisense problems with Teensy 3.5?
Reply #6 - Dec 12th, 2022 at 1:20am
Print Post  
FrankP wrote on Dec 11th, 2022 at 8:07pm:
This DID help - just not as completely as I hoped.  Using the typedef trick removes the intellisense errors from all references to enums, EXCEPT it still flags functions with enum return types, such as:

...

In the above function, the function name is underlined with a red squiggly line, but the line 'AnomalyCode errcode = NO_ANOMALIES' isn't anymore (after the 'typedef' trick was applied).  Also, any call to the CheckForAnomalies() function is underlined as well.


There are workarounds for all of it, but since you're writing something at least moderately complex you can make the whole problem go away if you just move your enum definition out of the ino file. This class of problem and its workarounds are much worse when you allow the preprocessor to perform arduino-style automatic creation of header declarations from the ino file(s).

I get no squiggles when I just go back to a plain old enum defined in an enums.h file (with no associated .cpp file).  Of course we need to #include "enums.h" at the top of the .ino file (VisualMicro does that automatically if you let it create the arduino-style code file for you). 

I'll attach two screenshots showing (1) the enum file and (2) all of your code in an ino file, with no red squiggles anywhere.

This is on version  1.2022.0905-4. In my experience, VM intellisense can understand enums just fine even without the recent improvements based on gcc-awareness.

In fact, for many years I have never allowed a red squiggle in VM to persist, with the sole exception of an unusual macro construction used by Paul Stoffregen for his audio library.  



Code
Select All
// enums.h

#ifndef _ENUMS_h
#define _ENUMS_h

#if defined(ARDUINO) && ARDUINO >= 100
	#include "arduino.h"
#else
	#include "WProgram.h"
#endif

enum AnomalyCode
{
    NO_ANOMALIES,
    STUCK_AHEAD,
    STUCK_BEHIND,
    OBSTACLE_AHEAD,
    WALL_OFFSET_DIST_AHEAD,
    OBSTACLE_BEHIND,
    OPEN_CORNER,
    DEAD_BATTERY,
    //CHG_STN_AVAIL, //added 04/14/22 c/o 06/12/22  back in 06/14/22 c/o again 06/16/22
    CHARGER_CONNECTED //added 05/22/22
};
#endif

 



Code
Select All
/*
    Name:       EnumTest.ino
    Created:	12/10/2022 4:00:10 PM
    Author:     CFF-ANTHEA\cff
*/

#include "enums.h"

AnomalyCode errcode = STUCK_BEHIND;
AnomalyCode errcode2 = (AnomalyCode)STUCK_BEHIND;
AnomalyCode errcode3 = AnomalyCode::STUCK_BEHIND;

bool gl_bStuckAhead = false;
bool gl_bStuckBehind = false;
bool gl_bObstacleAhead = false;
bool gl_bObstacleBehind = false;
bool gl_bWallOffsetDist = false;
bool gl_bChgConnect = false;
bool gl_bDeadBattery = false;

AnomalyCode CheckForAnomalies()
{
    AnomalyCode errcode = NO_ANOMALIES;

    if (gl_bStuckAhead)
    {
        errcode = STUCK_AHEAD;
    }
    else if (gl_bStuckBehind)
    {
        errcode = STUCK_BEHIND;
    }
    else if (gl_bObstacleAhead)
    {
        errcode = OBSTACLE_AHEAD;
    }
    else if (gl_bWallOffsetDist)
    {
        errcode = WALL_OFFSET_DIST_AHEAD;
    }
    else if (gl_bObstacleBehind)
    {
        errcode = OBSTACLE_BEHIND;
    }
    else if (gl_bDeadBattery)
    {
        errcode = DEAD_BATTERY;
    }
    //06/12/22 removed, 06/14/22 replaced, 06/16/22 removed again
    //else if (gl_bIRBeamAvail)
    //{
    //  errcode = CHG_STN_AVAIL;
    //}
    else if (gl_bChgConnect)
    {
        errcode = CHARGER_CONNECTED;
    }
    else
    {
        errcode = NO_ANOMALIES;
    }
    //gl_pSerPort->printf("at bottom of  CheckForAnomalies() with errcode = %d\n", errcode);
    return errcode;
}
void setup()
{}
void loop()
{}
 


  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense problems with Teensy 3.5?
Reply #7 - Dec 12th, 2022 at 1:28am
Print Post  
@cfeied that is very clear and useful thanks
« Last Edit: Dec 12th, 2022 at 1:28am by Tim@Visual Micro »  
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Intellisense problems with Teensy 3.5?
Reply #8 - Dec 12th, 2022 at 2:50am
Print Post  
Tim@Visual Micro wrote on Dec 12th, 2022 at 1:28am:
@cfeied that is very clear and useful thanks


Ditto for me - thanks for the explanation!

Frank

  
Back to top
 
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Intellisense problems with Teensy 3.5?
Reply #9 - Dec 12th, 2022 at 8:01pm
Print Post  
Tim@Visual Micro wrote on Dec 11th, 2022 at 11:04pm:
No the ARM version is for apple mac and arm users.

Please post your verbose output and also confirm that with the new project you see the word (Arduino) to the right of the project name in the solution explorer.

Thanks


Verbose output posted.  Yes, the new project does contain the word 'Arduino'

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Intellisense problems with Teensy 3.5?
Reply #10 - Dec 12th, 2022 at 8:33pm
Print Post  
cfeied wrote on Dec 12th, 2022 at 1:20am:
In fact, for many years I have never allowed a red squiggle in VM to persist, with the sole exception of an unusual macro construction used by Paul Stoffregen for his audio library.


How do you handle the "identifier 'uint32_t' is undefined problem.  I can change them all to 'unsigned long', but I hate to change out a more specific identifier with a more vague one.

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Intellisense problems with Teensy 3.5?
Reply #11 - Dec 12th, 2022 at 11:57pm
Print Post  
Like you, I *really* hate having ANY intellisense errors in my code - it drives me completely batty.  I created a new Arduino project, created a companion 'enums.h' file, and slowly added pre-setup and setup() code to see how well intellisense responds.  Unfortunately I was unable to eliminate the red 'squiggles' from intellisense. AFAICT, *all* the enum identifiers are still being flagged as 'identifier 'x' is not defined', as shown in one of my many functions referencing enums

and here is my 'enums.h' file, which is included at the top of my main file.

Code
Select All
#pragma once

#if defined(ARDUINO) && ARDUINO >= 100
	#include "Arduino.h"
#else
	#include "WProgram.h"
#endif


enum NavCases
{
  NAV_NONE = 0,
  NAV_WALLTRK,
  NAV_OBSTACLE,
  NAV_STEPTURN,
  NAV_STUCK,
  NAV_OPENCNR
};

//04/10/20 Experiment with porting heading based tracking capability from two wheel robot
enum TrackingState
{
  TRK_RIGHT_NONE,
  TRK_RIGHT_CAPTURE,
  TRK_RIGHT_MAINTAIN,
  TRK_RIGHT_BACKUP_AND_TURN,
  TRK_RIGHT_STEP_TURN
};
const char* NavStrArray[] = { "WallTrack", "Obstacle", "StepTurn", "Stuck", "OpenCorner" };

//03/08/17 added for new mode/state definitions; see http://fpaynter.com/2017/03/wall-e2-operating-mode-review/
enum OpModes
{
  MODE_NONE = 0, //04/04/17 chg from MODE_DEFAULT and moved to top (zero) position
  MODE_CHARGING,
  MODE_IRHOMING,
  MODE_WALLFOLLOW,
  MODE_WALLCAPTURE, //added 07/16/21 to manage wall offset capture operations
  MODE_DEADBATTERY, //added 01/16/18 to handle dead battery case
  MODE_DISCHARGE //added 03/04/20 to safely discharge the battery
};

enum AnomalyCode
{
  NO_ANOMALIES = 0,
  STUCK_AHEAD,
  STUCK_BEHIND,
  OBSTACLE_AHEAD,
  WALL_OFFSET_DIST_AHEAD,
  OBSTACLE_BEHIND,
  OPEN_CORNER,
  DEAD_BATTERY,
  //CHG_STN_AVAIL, //added 04/14/22 c/o 06/12/22  back in 06/14/22 c/o again 06/16/22
  CHARGER_CONNECTED //added 05/22/22
};

const char* AnomalyStrArray[] = { "NO_ANOMALIES", "STUCK_AHEAD", "STUCK_BEHIND", "OBSTACLE_AHEAD",
"WALL_OFFSET_DIST_AHEAD","OBSTACLE_BEHIND", "OPEN_CORNER", "DEAD_BATTERY", "CHARGER_CONNECTED" };//06/12/22 CHG_STN_AVAIL removed


const char* ModeStrArray[] = { "None", "Charge", "Home", "Wall", "Capture", "DeadBatt", "Discharge" };
const char* LongModeStrArray[] = { "None", "Charging", "IR Homing", "Wall Following", "Wall Capture", "Dead Battery", "Discharging" };

enum WallTrackingCases
{
  TRACKING_NONE = 0,
  TRACKING_LEFT,
  TRACKING_LEFT_CAPTURE, //added 02/26/22
  TRACKING_RIGHT,
  TRACKING_RIGHT_CAPTURE, //added 02/26/22
  TRACKING_NEITHER
};

const char* TrkStrArray[] = { "None", "Left", "Left Capture", "Right", "Right Capture", "Neither" };
const char* WallFollowTelemHdrStr = "Msec\tLF\tLC\tLR\tSteer\tDeg\tCos\tLCCorr\tSet\tErr\tOutput\tLSpd\tRSpd\n";
const char* WallFollowTelemStr = "%lu\t%d\t%d\t%d\t%2.2f\t%2.2f\t%2.2f\t%2.1f\t%2.1f\t%2.1f\t%2.1f\t%d\t%d\n";

enum VL53L0X_REQUEST
{
  VL53L0X_READYCHECK, //added 11/10/20 to prevent bad reads during Teensy setup()
  VL53L0X_CENTERS_ONLY,
  VL53L0X_RIGHT,
  VL53L0X_LEFT,
  VL53L0X_ALL, //added 08/06/20, replaced VL53L0X_BOTH 10/31/20
  VL53L0X_REAR_ONLY //added 10/24/20
};
 




What am I doing wrong here?


  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Intellisense problems with Teensy 3.5?
Reply #12 - Dec 15th, 2022 at 9:11pm
Print Post  
Any updates on the VM/Intellisense issue?  I put all my enums into a 'enums.h' file, but I'm still getting lots of red bars up and down my code window.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense problems with Teensy 3.5?
Reply #13 - Dec 16th, 2022 at 1:53pm
Print Post  
Didn't think an update was required. @cfeied answered your question and I just tried it. Works fine.

Maybe you can make a simple project like the one in my screen shot, zip and email it to us is it doesn't give you correct results.

Make sure you are on latest Visual Micro, latest Visual Studio and latest Teensy core, just to be sure we are looking at the same thing.
« Last Edit: Dec 16th, 2022 at 1:54pm by Tim@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Intellisense problems with Teensy 3.5?
Reply #14 - Dec 17th, 2022 at 1:40am
Print Post  
Tim@Visual Micro wrote on Dec 16th, 2022 at 1:53pm:
Re: Intellisense problems with Teensy 3.5?
Reply #13 - Today at 1:53pm  Didn't think an update was required. @cfeied answered your question and I just tried it. Works fine.


I think you are correct.  I went back and *carefully* went through my IntellisenseTest.ino project and was able to get it to compile 'squiggle-free' using @cfeied's 'enums.h' trick.

Then I went back and did the same thing with a slightly larger 'real' program (a part-task test program for my robot) and got it to compile 'squiggle-free' using the same 'enums.h' file.  During this process I discovered that the 'enums.h' file I had been using on the part-task program was missing some enum sections, and that was what was causing my 'issues'.

Then I went back to one of my full-length robot programs that exhibited *lots* of red intellisense errors, and started copying some of the problematic code over to my new 'IntellesenseTest.ino' program and was able to get it to compile 'squiggle-free' as well.

Then I checked my full-length program to see if it said 'Arduino' on the project line and it does not, so I suspect that is the difference somehow.   

So, the next question is - what do I need to do to convert my 'non-Arduino' programs to the newer style so I can finally get rid of all the red marks that are driving me crazy!  Grin

Frank
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense problems with Teensy 3.5?
Reply #15 - Dec 17th, 2022 at 4:29pm
Print Post  
To use the new project format. 

  • Close the solution. 
  • Move or Delete the .vcxproj file
  • Use "File>Open>Arduino Project" to open the .ino code


That will create you a new .vcxproj file. Then you can open as usual, using the standard Visual Studio "recent" or "open" commands. Your solution should still open and access the new project without any changes.

If you have a vcxproj with a lot of settings you want to retain you can manually copy them with text editor between the old .vcxproj and the new .vcxproj. There isn't much difference between the two files. Using a text editor won't break anything. They are simple xml files.

We will be providing an auto-convert shortly.
« Last Edit: Dec 18th, 2022 at 1:41am by Tim@Visual Micro »  
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Intellisense problems with Teensy 3.5?
Reply #16 - Dec 17th, 2022 at 5:38pm
Print Post  
Tim@Visual Micro wrote on Dec 17th, 2022 at 4:29pm:
Close the solution.
Move or Delete the .vcxproj file
Use "File>Open>Arduino Project" to open the .ino code


Works great!  YAY!!   

Thanks - I can FINALLY get some rest from my OCD angst when seeing all those red marks  Cheesy
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense problems with Teensy 3.5?
Reply #17 - Dec 18th, 2022 at 1:40am
Print Post  
Great! Thanks for the feedback.
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense problems with Teensy 3.5?
Reply #18 - Dec 20th, 2022 at 2:11am
Print Post  
I was looking at your code for another reason ealier and realised it might help to point out a quirk of arduino. 

You can use enums in your .ino files but you have to be concious of the order you define things in the code.

At compile time, Visual Micro and the Arduino IDE automatically add any missing prototypes. This means that an enum can be defined and used in any place in the .ino code. The prototypes are added to the top of the code before the first user type, if there are no user types then before the first method.

When working from an intellisense perspective we don't have those prototypes (it's something we might try to look into). This means that you will see intellisense errors unless you use a .h file or unless you write your code in one of the two following ways.

//1) Add the prototype yourself. Note the passEnum() prototype at the top of the code has exact same signature as the method with ; suffix.
//
Code (C++)
Select All
void passEnum(VL53L0X_REQUEST e, uint32_t b);

enum VL53L0X_REQUEST
{
	VL53L0X_READYCHECK, //added 11/10/20 to prevent bad reads during Teensy setup()
	VL53L0X_CENTERS_ONLY,
	VL53L0X_RIGHT,
	VL53L0X_LEFT,
	VL53L0X_ALL, //added 08/06/20, replaced VL53L0X_BOTH 10/31/20
	VL53L0X_REAR_ONLY //added 10/24/20
};

void passEnum(VL53L0X_REQUEST e, uint32_t b)
{

}

void setup()
{
    uint32_t a = 0;

    passEnum(VL53L0X_ALL, a);
}

void loop()
{ }

 




// 2) define the .ino code in the correct order so that a prototype is not needed. Note that the method passEnum() is first and the enum defined after that. To be honest I would have the expected the types to be created before they are used but I guess an enum i different.
//
Code (C++)
Select All

void passEnum(VL53L0X_REQUEST e, uint32_t b)
{

}

enum VL53L0X_REQUEST
{
	VL53L0X_READYCHECK, //added 11/10/20 to prevent bad reads during Teensy setup()
	VL53L0X_CENTERS_ONLY,
	VL53L0X_RIGHT,
	VL53L0X_LEFT,
	VL53L0X_ALL, //added 08/06/20, replaced VL53L0X_BOTH 10/31/20
	VL53L0X_REAR_ONLY //added 10/24/20
};

void setup()
{
    uint32_t a = 0;

    passEnum(VL53L0X_ALL, a);
}

void loop()
{ }

 


  
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Intellisense problems with Teensy 3.5?
Reply #19 - Dec 20th, 2022 at 2:56am
Print Post  
Tim@Visual Micro wrote on Dec 20th, 2022 at 2:11am:
When working from an intellisense perspective we don't have those prototypes (it's something we might try to look into). This means that you will see intellisense errors unless you use a .h file or unless you write your code in one of the two following ways.


Thanks - I went the enums.h route and it works fine, with the small annoyance of not having the defs inline for clarity. Now that I have it running without intellisense errors I'll probably keep it that way  Wink
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint