To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.pbforthOpen lugnet.robotics.rcx.pbforth in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / pbFORTH / 322
321  |  323
Subject: 
Factor upload script for user extensions
Newsgroups: 
lugnet.robotics.rcx.pbforth
Date: 
Sat, 13 May 2000 10:36:50 GMT
Reply-To: 
sjm@judgement.com{AvoidSpam}
Viewed: 
1355 times
  
Ralph,

I suggest that you factor a proceedure out of the tcl uploadScript
that sends a string to the RCX. This could then be used for additional
menu or tcl commands that send Forth code to the RCX. Here is a
potential
implementation used to power down the RCX:


$::rcxtk::wMenu.mpbForth add separator
$::rcxtk::wMenu.mpbForth add command -label "Power down"        \
                                     -command {::rcxtk::powerDownRCX}

#-----------------------------------------------------------------------------

# proc ::rcxtk::powerDownRCXRCX { }
#
#-----------------------------------------------------------------------------

proc ::rcxtk::powerDownRCX { } {

  catch {::pbx::closeConsole}

  ::pbx::openConsole $::rcxtk::portName 2400,n,8,1
  ::pbx::warmupConsole

  ::rcxtk::commandRCX "POWER_INIT POWER_OFF"

  ::pbx::closeConsole
}

#-----------------------------------------------------------------------------

# proc ::rcxtk::commandRCX { "command string" }
#
#-----------------------------------------------------------------------------

proc ::rcxtk::commandRCX { s } {

  set s [::pbx::stripComments $s]
  append s [binary format H2 "0D"]

  ::pbx::putConsole $s

  set ::pbx::rcvEvent RECEIVING

  while { 0 == [regexp {TIMEOUT|EOF} $::pbx::rcvEvent] } {
      vwait ::pbx::rcvEvent
  }

  foreach s [split [::pbx::readConsole] \n\r] {
      set s [string trimright $s]
      if { 0 != [string length $s] } {
        $::rcxtk::wText insert end [append s [binary format H2 "0A"]]
        $::rcxtk::wText yview moveto 1.0
        $::rcxtk::wText delete 0.0 "end -100 lines"
      }
  }
}



Message has 1 Reply:
  RE: Factor upload script for user extensions
 
(...) Ummm, great idea. How about an item that turns into a pulldown list of 1-liners? I've got the X close or AltF4 shell closing capture thing, and I've also got XMODEM working. If I can get enough time, a public beta is in order... Cheers, Ralph (...) (25 years ago, 13-May-00, to lugnet.robotics.rcx.pbforth)

2 Messages in This Thread:

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

Custom Search

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