Reason is in timer.h. The script commands, that should overwrite the prescaler contants in case of existance of a register named TCNT1 (that indicates the different timer1 in an attiny) does not work anymore.
Since the bug is introduced 27/11/23 the workaround is to remove "#ifdef AVR ... #endif" around the #defines for the standard prescalers.
Regarding this bug, I found two issues:
1. Scripts should be the highest priority, but can not overwrite constant-values that are #defined inside a #ifdef block.
2. The conditions inside a #script are different if a separation-blank is used: "if var(TCNT1) then" works as expected; "if var (TCNT1) then" never gets true (note the blank after "var") .
I added a revised timer.h. In this library I have also adapted the prescaler for AVR Timer 2 (the old state was "needs work").
IFDEFs need to check the Constant does not exist. There is now a precedence and the scripts do have the priority. The changes in precedence were needed to properly support real conditional compilation.
Re the VAR[SPACE] issue. That is a bug and I will resolve.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is test program I have used to fix the script with space issue.
The next build will have this fix.
#chip mega328p#define TestConstant1#define TestConstant2 2portc=TestConstant2doloop#scriptwarningTestConstant1warningTestConstant2" = 2"ifDEF(TestConstant1)Thenwarning"Def(TestConstant1) test 1"endififDEF(TestConstant1)Then'with spacewarning"Def (TestConstant1) test 2"endififDEF(TestConstant2)Thenwarning"Def(TestConstant2) test 3"endififDEF(TestConstant2)Then'with spacewarning"Def (TestConstant2) test 4"endififVar(TestConstant2)="2"Thenwarning"Var(TestConstant2) test 5"endififVar(TestConstant2)="2"Then'with spacewarning"Var(TestConstant2) test 6"endififvar(PORTC)Then'with spaceswarning"PORTC Exists"endififnovar(PORTG)Then'with spacewarning"PORTG does not Exists"endif#endscript
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi All!
If I try to compile code for ATTiny I get this errormessage:
Reason is in timer.h. The script commands, that should overwrite the prescaler contants in case of existance of a register named TCNT1 (that indicates the different timer1 in an attiny) does not work anymore.
Since the bug is introduced 27/11/23 the workaround is to remove "#ifdef AVR ... #endif" around the #defines for the standard prescalers.
Regarding this bug, I found two issues:
1. Scripts should be the highest priority, but can not overwrite constant-values that are #defined inside a #ifdef block.
2. The conditions inside a #script are different if a separation-blank is used: "if var(TCNT1) then" works as expected; "if var (TCNT1) then" never gets true (note the blank after "var") .
I added a revised timer.h. In this library I have also adapted the prescaler for AVR Timer 2 (the old state was "needs work").
Frank
I will move to released code.
Re the comments.
Here is test program I have used to fix the script with space issue.
The next build will have this fix.