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 Send TopicPrint
Hot Topic (More than 8 Replies) PROJECT_NAME (Read 1506 times)
xbary_pb
Junior Member
**
Offline


Posts: 12
Joined: Dec 22nd, 2015
PROJECT_NAME
Jul 5th, 2020 at 6:30pm
Print Post  
Hello
Does anyone know where the source name of the project can be downloaded from?
for example.
in the library I would like to:



String pn = PROJECT_NAME;

pn is "ESP32_STATION3_1"

XBary
« Last Edit: Jul 5th, 2020 at 6:31pm by xbary_pb »  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: PROJECT_NAME
Reply #1 - Jul 5th, 2020 at 6:58pm
Print Post  
You could set a define in the project properties of each project. Right click the project and click "Properties" or follow this guide.

https://www.visualmicro.com/page/User-Guide.aspx?doc=Project-Properties-Referenc...


« Last Edit: Jul 5th, 2020 at 6:59pm by Tim@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
Back to top
WWW  
IP Logged
 
xbary_pb
Junior Member
**
Offline


Posts: 12
Joined: Dec 22nd, 2015
Re: PROJECT_NAME
Reply #2 - Jul 5th, 2020 at 8:41pm
Print Post  

I didn't really mean it. For you it is sketch14 and it would be best if it happened "automatically". Of course from the library level.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: PROJECT_NAME
Reply #3 - Jul 5th, 2020 at 9:26pm
Print Post  
When you say library I expect you mean arduino library. Arduino libraries do not know about code sketch. It is the other way around. The only way would be via compiler defines as shown.

admin: EDITED with correction

You can add a variable such as PROJ_TYPE="{build.project_name}" that would automatically use the project name. This will give the name of the primary .ino file along with .ino extension.
« Last Edit: Jul 5th, 2020 at 10:13pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
xbary_pb
Junior Member
**
Offline


Posts: 12
Joined: Dec 22nd, 2015
Re: PROJECT_NAME
Reply #4 - Jul 5th, 2020 at 9:43pm
Print Post  
The arduino library is what I mean.
My application consists of 99% of libraries, so-called modular construction, and configuration is done via the GUI on the terminal. I would like to compile applications and see in my GUI what project it comes from. I think the PROJ_TYPE = {sketch_name} option in the properties will apply.
Thanks for the tips
  
Back to top
 
IP Logged
 
xbary_pb
Junior Member
**
Offline


Posts: 12
Joined: Dec 22nd, 2015
Re: PROJECT_NAME
Reply #5 - Jul 5th, 2020 at 10:02pm
Print Post  

Unfortunately it doesn't work with
PROJ_TYPE = {sketch_name} in the properties.
« Last Edit: Jul 5th, 2020 at 10:03pm by xbary_pb »  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: PROJECT_NAME
Reply #6 - Jul 5th, 2020 at 10:09pm
Print Post  
Yes sorry wrong var name. If you switch on the settings shown in yellow above you can see all the build variables. There is one that contains the "project_name.ino". Does that help

Code
Select All
defines: PROJECT_NAME_INO="{build.project_name}" 



note: The quotes were missing from my previous example which has also been corrected. Quotes around strings are important or the build will fail.

ps: The red squiggle will show until after a build. If you alter defines or build flags then a build is required before intellisense will detect the changes.
« Last Edit: Jul 5th, 2020 at 10:15pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
xbary_pb
Junior Member
**
Offline


Posts: 12
Joined: Dec 22nd, 2015
Re: PROJECT_NAME
Reply #7 - Jul 5th, 2020 at 10:32pm
Print Post  
Of course it works
thanks again for taking the time Smiley
  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: PROJECT_NAME
Reply #8 - Jul 5th, 2020 at 10:56pm
Print Post  
Very nice! Thanks for the update.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint