To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 3612
3611  |  3613
Subject: 
Re: Motor Display
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Mon, 5 Jan 2004 23:45:41 GMT
Viewed: 
7065 times
  
In lugnet.robotics.rcx.legos, Steve Hassenplug wrote:
> For some silly reason, I was browsing through the BrickOS code and I noticed
> this:
> 
> void motor_a_dir(MotorDirection dir)
> {
>   dm_a.dir = dm_a_pattern[dir];
>   dlcd_hide(LCD_A_LEFT);
>   dlcd_hide(LCD_A_RIGHT);
>   if (dir == fwd || dir == brake)
>     dlcd_show(LCD_A_RIGHT);
>   else if (dir == rev || dir == brake)
>     dlcd_show(LCD_A_LEFT);
> }
> 
> Is that right, or has a problem already been found and corrected, here?
> 
> Problem: what if (dir==brake)?
> I think only the right LCD arrow comes on.  There should be no "else".  The 2nd
> to last line should start with 'if' not 'else if'

This problem has been fixed in the most recent CVS source file (dmotor.c), but
as far as I can tell it hasn't been part of an offical release yet:

http://cvs.sourceforge.net/viewcvs.py/brickos/brickos/kernel/dmotor.c?r1=1.7&r2=1.8

Mark



Message is in Reply To:
  Motor Display
 
For some silly reason, I was browsing through the BrickOS code and I noticed this: void motor_a_dir(MotorDirection dir) { dm_a.dir = dm_a_pattern[dir]; dlcd_hide(LCD_A_LEFT); dlcd_hide(LCD_A_RIGHT); if (dir == fwd || dir == brake) (...) (23 years ago, 5-Jan-04, to lugnet.robotics.rcx.legos)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR