Go Back   EcoModder Forum > EcoModding > Fossil Fuel Free > Open ReVolt: open source DC motor controller
Register Now
 Register Now
 

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 06-08-2009, 11:01 AM   #1631 (permalink)
EcoModding Lurker
 
Join Date: May 2009
Location: Bucharest,RO and Copenhagen,DK
Posts: 42
Thanks: 0
Thanked 1 Time in 1 Post
As I recall, we have had this debate a while back in this very thread.

It has been agreed, as far as I understand, to use the pre-defined names and macros from the gcc-avr include files allowing both human readability and portability between various controllers.

The refactored code (already in the svn) is now using these extensively and custom #define for most of the application specific constants. Why are we having this conversation again?

  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 06-08-2009, 11:28 AM   #1632 (permalink)
EcoModding Lurker
 
Join Date: Jul 2008
Location: Memphis, TN
Posts: 58

2010 Prius - '10 Toyota Prius IV
Last 3: 51.4 mpg (US)
Thanks: 0
Thanked 1 Time in 1 Post
I'm not sure either. The refactored code does not have any of the items people were posting about? Are you guys looking at the latest code? It's using the _BV(bit) macro to create bit masks. It's a lot more readable.

To set a bit you use:
PORTB |= _BV(PB1); // PORTB = PORTB | (00000010)

To clear a bit you use:
PORTB &= ~_BV(PB1); // PORTB = PORTB & (11111101)

Finally, you can set multiple bits at once:
PORTB |= | _BV(PB7) | _BV(PB1) | _BV(PB0); // PORTB = PORTB | (10000000) | 0000010) | (00000001)

FWIW,
Jay

Last edited by JayC; 06-08-2009 at 11:56 AM..
  Reply With Quote
Old 06-08-2009, 11:42 AM   #1633 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location: ÿ
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 269 Times in 212 Posts
See, you find a bit of code out in the wild, it is well suited to its task, and efficient, and you can even recognize its lineage in some of its quirks. Choose:

A. appreciate it's character? Noting the interesting change in it's plumage that you don't normally see at the zoo, because the zookeeper painted all the zoo animals pink, because that made the zookeeper feel important.

B. get your paintbrush because you don't like what you see, even though it isn't doing anyone a damn bit of harm.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!

Last edited by dcb; 06-08-2009 at 11:57 AM..
  Reply With Quote
Old 06-08-2009, 11:56 AM   #1634 (permalink)
EcoModding Lurker
 
Join Date: Jul 2008
Location: Memphis, TN
Posts: 58

2010 Prius - '10 Toyota Prius IV
Last 3: 51.4 mpg (US)
Thanks: 0
Thanked 1 Time in 1 Post
Um, are you just pontificating in general or are you directing those comments in any particular direction
  Reply With Quote
Old 06-08-2009, 12:30 PM   #1635 (permalink)
EcoModding Lurker
 
Join Date: Aug 2008
Location: Salt Lake City
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Where's the Wiki?

Hey, guys. I think I must have missed the internal memo. Where do I go to see the latest code and control board layout?

Thanks.

Bill
  Reply With Quote
Old 06-08-2009, 12:31 PM   #1636 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location: ÿ
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 269 Times in 212 Posts
Jay, it is In general, all the flibbertigibbeting drives me a little crazy

Oh, and here is the datasheet for the processor if any would-be development types would like to stop being spoon fed
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote
Old 06-08-2009, 12:33 PM   #1637 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location: ÿ
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 269 Times in 212 Posts
wj, try http://ecomoder.com/wiki for a starting point, or that link in Pauls signature. Don't know how "latest" it is though.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!

Last edited by dcb; 06-08-2009 at 12:46 PM..
  Reply With Quote
Old 06-08-2009, 12:42 PM   #1638 (permalink)
EcoModding Lurker
 
Join Date: Jul 2008
Location: Memphis, TN
Posts: 58

2010 Prius - '10 Toyota Prius IV
Last 3: 51.4 mpg (US)
Thanks: 0
Thanked 1 Time in 1 Post
Quote:
Originally Posted by wjdennis View Post
Hey, guys. I think I must have missed the internal memo. Where do I go to see the latest code and control board layout?

Thanks.

Bill
In the Wiki. No worries, I had to go find it a few times before I realized it's at the top of the page (wiki that is) and that there are a handful of wiki projects.

Direct link: software SVN. Going by age HighVoltageControllerRefactoredISRReorganized.c

Jay

Last edited by JayC; 06-08-2009 at 01:07 PM..
  Reply With Quote
Old 06-08-2009, 01:21 PM   #1639 (permalink)
EcoModder Student
 
esoneson's Avatar
 
Join Date: Nov 2008
Location: Youngsville, NC
Posts: 117
Thanks: 11
Thanked 14 Times in 13 Posts
Coding style vs Function

I am over joyed at all those who have been making great suggestions concerning the perfection of the controller code. Thanks to all who have contributed!!

I am one of those old f*arts who has lived through decades of debates concerning coding styles and best practices.

I suggest one Rule for the micro code. Let Paul assimilate all the proper FUNCTIONAL changes to the point where he and the testers are satisfied that the controller meets the functional needs of Beta Release 1.0 (or you pick a name).
Once that is done, anyone is free to take the code and run it through whatever "pretty" filter they want to make it look like they want. But for now, leave coding style out of the discussion to make it easier for Paul.

Paul is doing a great job with this project at the same time is taking care of his family in this tough economic time. He deserves all the help we can give, but lets focus on function for now and get this thing running.

Ok, I'll get off my soap-box now and think about more pleasant memories of coding and product release successes. OOOooooooohhhhhhhhhmmmmmm.
OOOoooooooohhhhhhhhhhhmmmmmmmmm. mantra....mantra.....mantra

Eric
__________________
1995 BMW 318i EV in the making
  Reply With Quote
Old 06-08-2009, 04:35 PM   #1640 (permalink)
EcoModding Lurker
 
Join Date: May 2009
Location: Bremerton, Wa
Posts: 41

That Big Gray Thing - '82 Mercury Capri
90 day: 19.33 mpg (US)
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to wolfraven
W000t! Go Paul GO! You can do it!

Also, I've seen crazier looking code in a great deal of very popular computer games, with absolutely TERRIBLE commenting...Paul's work is the only bit that's managed to make any sense without looking every little bit up and swapping between all 56 files of includes/c/etc that the thing has just to do a teeny-weenie mod or find out how to change a couple of settings...Pfff...the big-shots make it look crazier than a lot of code I've looked at...keep up the good work!

  Reply With Quote
Reply  Post New Thread


Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paul and Sabrina's Cheap 3 Phase Inverter (AC Controller) with Field Oriented Control MPaulHolmes Fossil Fuel Free 3480 05-04-2022 05:43 PM
Paul & Sabrina's Cheap EV Conversion MPaulHolmes Fossil Fuel Free 542 11-12-2016 09:09 PM
Three Dirt Cheap DIY Electric Cars - Part 5 SVOboy EcoModder Blog Discussion 0 12-12-2008 04:10 PM



Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com