Macro for cleaning and purging nozzle
-
@fcwilt said in Macro for cleaning and purging nozzle:
atm??? Automatic Teller Machine???
At The Moment
The syntax editor has predefined palettes which are crafted with usage in mind, not colors, so much.
If you read about the issue in the help for the Syntax Coloring Scheme Editor they talk about the rational behind their system.
Can't look at the Syntax Coloring Scheme Editor since it's not included in the demo.
The reason i want it to look like it does in DWC is mainly so that i have one "reference" so to say. Between what i make in my editor and what DWC / RRF does.
-
@exerqtor said in Macro for cleaning and purging nozzle:
Can't look at the Syntax Coloring Scheme Editor since it's not included in the demo.
Yet another great reason to take me up on my offer.
I just discovered a small "bug" in my scheme - but the scheme editor will make short work of it - I think.
The system is based on regular expressions which I have not done a lot with - so I am learning as I go.
Frederick
-
@fcwilt
Yeah it's getting more and more tempting, not gonna lie!I saw your syntax profile has some minor bugs that should be pretty easy to iron out i guess. Don't know how "translateable" the syntax highlighting part is from the DWC sourcecode over to that of EditPad though.
Would be nice to make a "solid" RRF syntax and have it uploaded to the database
-
@exerqtor said in Macro for cleaning and purging nozzle:
@fcwilt
Yeah it's getting more and more tempting, not gonna lie!I saw your syntax profile has some minor bugs that should be pretty easy to iron out i guess. Don't know how "translateable" the syntax highlighting part is from the DWC sourcecode over to that of EditPad though.
Actually I was mistaken. It's the DWC Editor that has it wrong. It threw me off for a bit because mine worked differently. A little more study shows mine is correct - or at least "less wrong".
Consider this from the DWC editor:
The text global.g_tool_exists is the name of a variable and should be all one color - the color assigned to variables.
But the global part seems to be treated the same as if. Both assigned the color for reserved words.
The 0 seems to be treated as a number even though it is part of the variable name
The exists seems to be treated as a function even thought it is part of the variable name.
Now here it is in EditPad Pro
In the second line you can see exists is recognized as a function but works fine as part of the variable name
Frederick
-
@fcwilt said in Macro for cleaning and purging nozzle:
@exerqtor said in Macro for cleaning and purging nozzle:
@fcwilt
Yeah it's getting more and more tempting, not gonna lie!I saw your syntax profile has some minor bugs that should be pretty easy to iron out i guess. Don't know how "translateable" the syntax highlighting part is from the DWC sourcecode over to that of EditPad though.
Actually I was mistaken. It's the DWC Editor that has it wrong. It threw me off for a bit because mine worked differently. A little more study shows mine is correct - or at least "less wrong".
Consider this from the DWC editor:
The text global.g_tool_exists is the name of a variable and should be all one color - the color assigned to variables.
But the global part seems to be treated the same as if. Both assigned the color for reserved words.
The 0 seems to be treated as a number even though it is part of the variable name
The exists seems to be treated as a function even thought it is part of the variable name.
Now here it is in EditPad Pro
In the second line you can see exists is recognized as a function but works fine as part of the variable name
Hm yeah i see what you mean, i must admit i prefer the way it's shown in DWC though.
The operators are different in DWC too:
While in EditPad they are all one color.
Given that you're an actual programmer, have you taken a look at the DWC source code for any "pointers"?
-
@exerqtor said in Macro for cleaning and purging nozzle:
Hm yeah i see what you mean, i must admit i prefer the way it's shown in DWC though.
You don't mind that one thing, a variable name, is incorrectly identified and has colors applied to it for four different things - reserved word, variable name, numeric value and function?
Frederick
-
@fcwilt
Clearly not to the extent it does youFor the record:
@chrishamm said in Making Notepad++ look like DWC g-code editor?:@exerqtor You can have a look at https://github.com/Duet3D/DuetWebControl/tree/master/src/components/dialogs/FileEditDialog for details about the syntax parsing/highlighting in DWC. Because the current CodeMirror component is rather outdated now, I may eventually replace it with something else in v3.5.
So that behaviour might be something that get's reworked in v3.5.
-
@exerqtor said in Macro for cleaning and purging nozzle:
So that behaviour might be something that get's reworked in v3.5.
That is interesting. Thanks for the info.
It does need to be worked on, as it failing to correctly analyze the code and to properly highlight the syntactical elements.
I could create a scheme which duplicated the way the DWC editor works - but then they would both be wrong.
And then that would be two things that needed fixing instead of just one! >>
Frederick
-
@fcwilt
Yeah i totally agree with what your saying.And just to clarify i prefer how it LOOKS in DWC, as it makes it easier for my peasant brain to break up/visualise the different parts of the code.
I think we have a somewhat different view of this since you actually know what you're looking at, while i'm trying to make best of what i'm seeing based on self thought knowledge learned by trial and error.
-
@exerqtor said in Macro for cleaning and purging nozzle:
And just to clarify i prefer how it LOOKS in DWC, as it makes it easier for my peasant brain to break up/visualise the different parts of the code.
You don't have a "peasant" brain - that much is obvious.
But can you explain how applying four different colors, three of them wrong, to that one variable name helps you?
The goal is to identify syntactical elements as clearly as possible without overly cluttering the display with too many colors.
For example, RRF has a handful each of reserved words and functions. You wouldn't want to color each reserved word or function differently. All reserved words should be of one color, all functions of perhaps another color.
These are the elements I am currently identifying (sorry it's so small - it's a screen shot):
Notice that I am picking out three types of numbers: hexadecimal, float and integer. Now the syntax editor allows assigning a different color to every identified kind of element but the default palette colors them all the same - to reduce clutter.
You have a large selection of palettes to chose from - and you can create your own:
So between being able to design you own syntax identification scheme and your own palette you should be happy as a clam at high tide!
Frederick
-
But can you explain how applying four different colors, three of them wrong, to that one variable name helps you?
The goal is to identify syntactical elements as clearly as possible without overly cluttering the display with too many colors.Probably me looking at it in the wrong light with the if global.g_tool_0_exists example from the get-go so to say I get what you mean now!
For example, RRF has a handful each of reserved words and functions. You wouldn't want to color each reserved word or function differently. All reserved words should be of one color, all functions of perhaps another color.
These are the elements I am currently identifying (sorry it's so small - it's a screen shot):And it's no problem with small text (yet), i'm still relatively young and my eyesight haven't went all to shit yet lol.
For instance, in DWC declaring a variable or global shows the global/var in yellow and the variable that's getting created as white.
But with your syntax scheme all they are put in one color, is that also "correct" so to say? (trying to get a grasp of things here, so sorry if the questions are odd at times).Shouldn't / couldn't there be a element in the syntaxing scheme called Variable type that makes global/var definable as it's own color.
I think that would make spotting an error like forgetting to put a space between var/global and the variable itself way more easy to spot, for trouble shoting etc.
So between being able to design you own syntax identification scheme and your own palette you should be happy as a clam at high tide!
FrederickRegarding the color palette, i'm at full tilt playing with it as we speak, trying it out. I'm about to jump the gun on acquiring a license so i can play with it more.
__
EditPad, syntaxing & highlightingspeak aside
(we should much rather start a thread in "General Discussion" or "Third-party software" for that subject and reference this thread so we don't clutter it up to muchπ)
.I've made v2.0 of the macro with left/right purge position done conditionally (in EditPad) :
nozzle_scrub_v2.0.g -
@fcwilt
I created a new thread for the EditPad syntaxing and coloring discussionπ
-
-
-
@exerqtor said in Macro for cleaning and purging nozzle:
For instance, in DWC declaring a variable or global shows the global/var in yellow and the variable that's getting created as white.
But with your syntax scheme all they are put in one color, is that also "correct" so to say? (trying to get a grasp of things here, so sorry if the questions are odd at times).
Shouldn't / couldn't there be a element in the syntaxing scheme called Variable type that makes global/var definable as it's own color.
You certainly could do it that way. That is one of the grand things about EditPad - giving you access and the tools to control the syntax highlighting.
I took the simple approach and used global and var as the identifier that indicated a variable name was about to follow. And that meant the same color for both parts.
But you will notice that I have a separated Variable Declaration from Variables so it's just a question of changing Variable Declaration part. It may need to be two parts - one to find and color global and var - the other to find and color the name that follows.
There are things in the syntax coloring editor called sub-schemes - I have looked at them yet and what they are for.
With regular expressions you can do an awful lot, far more than I can do without more study.
I've made v2.0 of the macro with left/right purge position done conditionally (in EditPad) :
nozzle_scrub_v2.0.gI will take a look.
Frederick
-
Found a bug that's been driving me crazy and polished the rest a bit, so now i think it's more or less done:
nozzle_scrub_v2.1.gBeen tested both cold and hot, and now finally works like expected
ππ
-
@exerqtor said in Macro for cleaning and purging nozzle:
Found a bug that's been driving me crazy and polished the rest a bit, so now i think it's more or less done:
nozzle_scrub_v2.1.gBeen tested both cold and hot, and now finally works like expected
ππ
Glad to hear you got it sorted - knew you would - good job.
Returning to what I mentioned in the near past: an example of using conditional code, instead of math, to make code comprehension a bit easier. Basically it computes and saves the two X positions that are used once before the loop and in the loop itself.
; Position for wipe. Either left or right of brush based on var.pos to avoid unnecessary travel after purging var pos1 = 0 var pos2 = 0 if var.pos = 0 set var.pos1 = var.brush_start set var.pos2 = var.brush_start + var.brush_width else set var.pos1 = var.brush_start + var.brush_width set var.pos2 = var.brush_start G1 Z{var.brush_top + var.clearance_z} F{var.prep_spd_z} G1 X{var.pos1} F{var.prep_spd_xy} ; Move in to the brush. G1 Y{var.brush_front + (var.brush_depth / 2)} ; Move nozzle down into brush. G1 Z{var.brush_top} F{var.prep_spd_z} ; Perform wipe. Wipe direction based off pos for cool random scrubby routine. while true G1 X{var.pos2} F{var.wipe_spd_xy} G1 X{var.pos1} if iterations = var.wipe_qty + 1 break
-
@fcwilt
You couldn't be more correct!
nozzle_scrub_v2.2.g