Jack, I do appreciate you taking an interest in the code snippet I sent out. ?You will likely see a fair bit more hideous code from me in the near future. I agree about the 50L vs 50l, was minimizing hacks to Ashhar's original. ?I might agree with #define's for 5 and 50L, especially since they get used in more than one place and are constants somebody might want to twiddle. ?But I'd put those #define's just above where they get used, if they only get used in one area of code. ?Otherwise it takes me an hour to connect the dots, and figure out what all those stupid names are. ? Could be just a number, could be some humongous macro. ?A real programmer hits some key sequence and his editor jumps to the definition off in some *.h file, I've never learned those vi tricks. We'll probably butt heads here some on coding style. ?I'm a digital hardware engineer (FPGA's and VHDL mostly these days) firmly set in my ways, learned to code in C nearly 40 years ago from the K&R book. ? ?When I write code for a uC, I want to know what every line will compile down to. ?(Arduino is new to me, I can see where me and random Arduino libraries are not going to get along very well.) ?Your conventions are the more conventional, and it's ok with me if you rewrite my code into something you are comfortable with. ?Just keep in mind, whoever touches it last gets to maintain it. ? ?;-) And no, it really should be a "+" in ? ??frequency = baseTune + (50l * knob); Jerry, KE7ER On Tue, Feb 21, 2017 at 06:31 am, Jack Purdum wrote:
I'm not a fan of "magic numbers" in code, as it makes it harder to read and understand what's going on. So, near the top of the code file, perhaps around line 100, and after the #include preprocessor directives, I'd write: ? |