I did not use auto-format and was left with some weird code that ran but did not give the desired results.
Auto format changes the layout of the code not its logic, order of statements etc so it cannot fix problems
Do you mean that Auto format revealed problems with your code that you subsequently fixed ? I find that having each { and } on its own line in the program is helpful is showing up code blocks and have Auto format set up to do that for me.
When examining code posted here it is the first thing that I do once the code has been posted into the IDE. This often reveals logical flaws in the program or orphan code not inside the code block of for loops and while loops.
UKHeliBob:
I find that having each { and } on its own line in the program is helpful is showing up code blocks and have Auto format set up to do that for me.
How do you alter the default behavior of Auto Format?
Open the folder where preferences.txt is situated. You can get there from File/Preferences in the IDE and clicking on filename near the bottom of the screen
In that folder you will find a file named formatter.conf which can be edited. Here is mine that I have changed to suit me
# This configuration file contains a selection of the available options provided by the formatting tool "Artistic Style"
# http://astyle.sourceforge.net/astyle.html
#
# If you wish to change them, don't edit this file.
# Instead, copy it in the same folder of file "preferences.txt" and modify the copy. This way, you won't lose your custom formatter settings when upgrading the IDE
# If you don't know where file preferences.txt is stored, open the IDE, File -> Preferences and you'll find a link
# 2 spaces indentation
indent=spaces=2
# also indent macros
indent-preprocessor
# indent classes, switches (and cases), comments starting at column 1
indent-classes
indent-switches
indent-cases
indent-col1-comments
# put a space around operators
pad-oper
# put a space after if/for/while
pad-header
# Move opening brackets onto new line
--style=allman --style=bsd --style=break -A1
# delete empty lines in functions
--delete-empty-lines
# Insert space padding around operators.
--pad-oper
From the comment in the file it may originally have been situated somewhere else
Visit the url near the top of the file for more options
UKHeliBob:
In that folder you will find a file named formatter.conf which can be edited. Here is mine that I have changed to suit me
//...
From the comment in the file it may originally have been situated somewhere else
Visit the url near the top of the file for more options
Thanks. I did not have that file, but did locate it in the install directory ..\Arduino\lib\formatter.conf