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
Normal Topic Problem with external macro call on new Win11/VS2022 PC (Read 986 times)
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Problem with external macro call on new Win11/VS2022 PC
Sep 3rd, 2024 at 1:16am
Print Post  
I have been using an external macro successfully for several years now to program a Teensy 'Over the Air' with the RF link supplied by a Pololu Wixel setup.

Now I'm transitioning to a new PC with the same Win11/VS2022 setup, but now the external macro isn't being called correctly.  Instead of:

C:\Program Files (x86)\Arduino\java\bin>"c:\Program Files (x86)\teraterm\ttpmacro.exe" /v "C:\Users\Frank\Documents\Arduino\WallE3_Git\WallE3_Git\TeensyOTA1.ttl" "C:\Users\Frank\Documents\Arduino\WallE3_Git\WallE3_Git\obj\ARM64\Release\" COM5 WallE3_Git.ino 


The new PC emits:

am Files (x86)\teraterm\ttpmacro.exe" /v "C:\Users\Frank\Documents\Arduino\WallE3_Git\WallE3_Git\TeensyOTA1.ttl" "{vm.runtime.build.intermediate_output_path}" COM8 WALLE3~1.INO 


There are two significant differences in the above calls; the first is that the '{vm.runtime.build.intermediate_output_path}' variable hasn't been expanded in the call from the new PC, and the second is the use of 'WALLE3~1.INO' instead of the complete file name.

Any idea what is causing this?  I hav attached a zip file containing the 'show build properties' for both the new PC and the old one, along with my actual macro (a teraterm macro) that handles the communication between the PC and the Teensy 3.5 controller.

TIA,

Frank

  

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


Posts: 2695
Joined: Feb 13th, 2019
Re: Problem with external macro call on new Win11/VS2022 PC
Reply #1 - Sep 3rd, 2024 at 8:54am
Print Post  
Thanks for the report.

The {vm.runtime.build.intermediate_output_path} wiill work if you Enable the below option, we will check why this behaviour has changed:
vMicro > Compiler > Always Copy Build Output to Intermediate}

If you add the use_shell_execute=true property for your hook:
recipe.hooks.postbuild.1.use_shell_execute=true

And remove the "cmd.exe /c" from your hook it should mean the full INO filename is passed through to your program.

Does this get it working again?
« Last Edit: Sep 3rd, 2024 at 8:54am by Simon@Visual Micro »  
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Problem with external macro call on new Win11/VS2022 PC
Reply #2 - Sep 4th, 2024 at 12:49am
Print Post  
Simon@Visual Micro wrote on Sep 3rd, 2024 at 8:54am:
Thanks for the report.

The {vm.runtime.build.intermediate_output_path} wiill work if you Enable the below option, we will check why this behaviour has changed:
vMicro > Compiler > Always Copy Build Output to Intermediate}

If you add the use_shell_execute=true property for your hook:
recipe.hooks.postbuild.1.use_shell_execute=true

And remove the "cmd.exe /c" from your hook it should mean the full INO filename is passed through to your program.

Does this get it working again?


I enabled 'vMicro > Compiler > Always Copy Build Output to Intermediate'

I added  the recipe.hooks.postbuild.1.use_shell_execute=true line and changed the 'preupload.1.pattern to

'recipe.hooks.deploy.preupload.1.pattern="c:\Program Files (x86)\teraterm\ttpmacro.exe" /v "{build.project_path}\TeensyOTA1.ttl" "{vm.runtime.build.intermediate_output_path}" {serial.port} {build.project_name}'

Now my board.txt file is:

# Teensy OTA Demo build property overrides
# 10/05/21 gfp - trying to run a post-build command
# 10/15/21 gfp - change to use Tera Term macro vs custom C# program
# 10/30/21 gfp - change to use {build.project_path}\TeensyOTA1.ttl instead of hard-coded path
# 10/31/21 gfp - rev to use 'recipe.hooks.deploy.preupload' vs 'recipe.hooks.postbuild' so only runs on F5
# 11/01/21 gfp - added enclosing "s as workaround for Visual Micro parsing problem

#02/15/22 double sets of " marks no longer required
#recipe.hooks.deploy.preupload.1.pattern=cmd.exe /c ""c:\Program Files (x86)\teraterm\ttpmacro.exe" /v "{build.project_path}\TeensyOTA1.ttl" "{vm.runtime.build.final_output_path}" {serial.port} {build.project_name}" 
#recipe.hooks.deploy.preupload.1.pattern=cmd.exe /c "c:\Program Files (x86)\teraterm\ttpmacro.exe" /v "{build.project_path}\TeensyOTA1.ttl" "{vm.runtime.build.final_output_path}" {serial.port} {build.project_name}

#12/13/22 per this thread (https://www.visualmicro.com/forums/YaBB.pl?num=1670959583/3#3), now using 'intermediate_output_path' vs 'final_output_path'
#recipe.hooks.deploy.preupload.1.pattern=cmd.exe /c "c:\Program Files (x86)\teraterm\ttpmacro.exe" /v "{build.project_path}\TeensyOTA1.ttl" "{vm.runtime.build.intermediate_output_path}" {serial.port} {build.project_name}

#09/03/24 added per response to my post regarding {vm.runtime.build.intermediate_output_path} not being replaced with actual path
recipe.hooks.deploy.preupload.1.pattern="c:\Program Files (x86)\teraterm\ttpmacro.exe" /v "{build.project_path}\TeensyOTA1.ttl" "{vm.runtime.build.intermediate_output_path}" {serial.port} {build.project_name}
recipe.hooks.postbuild.1.use_shell_execute=true

Then I compiled my code and it all worked properly - yay!!

Thanks for the help.  But now I'm curious as to why it works on my old system and not on the new one.  Looking at the vMicro versions, I have 2024.722.2208 on my new PC, and 2024.620.2203 on my old PC (both these version numbers were taken from the 'Extensions->Manage Extensions->Arduino IDE for Visual Studio 2022' selection).  I did note that on my old PC an update is offered for VM - could that be the reason it still works on my old PC?

Thanks again for getting me back in business!

Frank


  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint