1. 30 Aug, 2016 1 commit
  2. 16 Apr, 2015 1 commit
  3. 13 Feb, 2015 1 commit
  4. 20 Jan, 2015 6 commits
    • Daan Vreeken's avatar
      Initialize extra->filename to "shell" when executing a shell command. · 6109b567
      Daan Vreeken authored
      The 'filename' parameter wasn't initialized here, so when extra->filename is
      used to generate e.g. log messages, garbage entered the log.
      
      	modified:   controller/controller_load.c
      6109b567
    • Daan Vreeken's avatar
      Fix forward-declarations of links to blocks that don't exist yet. · 0c5baa5e
      Daan Vreeken authored
      We do this by checking the final state of all links after loading the top-most
      controller file. The new code will allow an included file to create links to
      blocks that will only exist later on during the load process, and it will
      successfully error out when links are defined for non-existing block.
      
      Furthermore, controller_block_link() will now bail out immediately when it
      hits an unrecoverable linker error. With this change, the error mesaage of the
      linker step that failed will remain at the end of the output instead of being
      flushed off the screen by e.g. 100+ 'Linked x to y (chained)' lines.
      
      	modified:   controller/controller/controller_block.c
      	modified:   controller/controller/controller_load.c
      0c5baa5e
    • Daan Vreeken's avatar
      Fix missing check of return value of controller_block_link(). · ba967183
      Daan Vreeken authored
      This caused all my .ctrl files with typos or non-existing block names in their
      'links { }' section to 'just run' instead of failing with an error.
      We will now halt with an error like :
      
       DEBUG: Input block 'digg_out2' does not (yet) exist, will try to link later
       ERROR: Failed to link controller!
       ERROR: Could not load controller file
      
      	modified:   controller/controller_load.c
      ba967183
    • Daan Vreeken's avatar
      Keep controller_load_check_arg() from crashing when filename doesn't contain '/'. · 8cd6afe9
      Daan Vreeken authored
      'slash' would be used uninitialized in this case. While we're here, change
      code to use strrchr() instead of rolling our own and only stat() a filename if
      we've found a '/', since we know 'extern->filename' will not contain a
      directory name otherwise.
      
      	modified:   controller/controller_load.c
      8cd6afe9
    • Daan Vreeken's avatar
      Explicitly show that an empty argument type string ("") means 'no arguments'. · a9a42203
      Daan Vreeken authored
      (You'll see why in the next commit..)
      
      	modified:   controller/controller_load.c
      a9a42203
    • Daan Vreeken's avatar
      Don't try to load directories as blocks. · 73a5252d
      Daan Vreeken authored
      When the .ctrl file contains a line to create an 'ec' block with incorrect
      arguments, the following errors would be emitted :
      
       ERROR: Invalid arguments trying to create block 'ethercat'
       DEBUG: Load module 'ec' with prefix 'ethercat'
       ERROR: ec:1: syntax error, unexpected $end
       DEBUG: End of module 'ec': 1
       ERROR: pand.ctrl:50: Error creating block
       ERROR: Could not load controller file
      
      The code would first try to load the dynamically loadable 'ec' block's module.
      This would fail, because of incorrect arguments. controller_load_block_create()
      would then try to stat() the file 'ec'. When found, it is opened and loaded as
      a module block.
      The code didn't check for the file to be a regular file and my build system
      contains a directory with the name 'ec'. On FreeBSD, directories can be opened
      and read as if they were regular files, but the .ctrl file parser would fail
      to load the directory.
      Change the code to *not* try to parse directories.
      
      (It would be even better if we just stopped trying to load blocks when
      controller_block_create() tells us that the block does exist, but the user has
      made an error. At this moment though, controller_block_create() has no way of
      telling the caller that.)
      
      The new code bails out with :
      
       ERROR: Invalid arguments trying to create block 'ethercat'
       ERROR: Could not load or create block 'ec'
       ERROR: pand.ctrl:50: Error creating block
       ERROR: Could not load controller file
      
      	modified:   controller/controller/controller_load.c
      73a5252d
  5. 19 Jan, 2015 4 commits
    • Daan Vreeken's avatar
      Fix error reporting when an incorrect argument is passed to a new block. · 062fc0fe
      Daan Vreeken authored
      The incorrect error was line 3 of the following example:
      
       ERROR: Too many arguments supplied! This function doesn't accept arguments.
       ERROR: Invalid arguments trying to create block 'heater3'
       ERROR: Could not find create function or struct for block bridge_pwm
       ERROR: pand.ctrl:36: Error creating block
      
      Both the create function and the create struct were found, but the block
      wasn't created because the arguments didn't match. This version reports:
       ..
       ERROR: Could not load or create block 'bridge_pwm'
      
      	modified:   controller/controller/controller_load.c
      062fc0fe
    • Daan Vreeken's avatar
      Only tell the user that there are possibly multiple choices when there really · 0a2c1d49
      Daan Vreeken authored
      are.
      
      	modified:   controller/controller/controller_load.c
      0a2c1d49
    • Daan Vreeken's avatar
      o Add my copyright statement. · bd302ce0
      Daan Vreeken authored
      o My two cents: If you can give explicit errors that tell the user exactly
        what is wrong with a minimal amount of code, please do.
      
      	modified:   controller/controller/controller_load.c
      bd302ce0
    • Jeroen Vreeken's avatar
      Use char ** list for argument checks instead of va_list. · bd3699cb
      Jeroen Vreeken authored
      Move parameter argument check to block_parameter file.
      Remove arugment number check. (Full type check makes it redundant)
      Rename check function with controller_load prefix.
      Don't treat 1 argument option different from multiple options.
      bd3699cb
  6. 18 Jan, 2015 7 commits
    • Daan Vreeken's avatar
      Disable some debug output now that the code has had a fair bit of testing. · f696cab1
      Daan Vreeken authored
      	modified:   controller/controller_load.c
      f696cab1
    • Daan Vreeken's avatar
      Introduce argument type checking for triggers. · 547c6453
      Daan Vreeken authored
      This will produce error messages like:
      
      ERROR: Argument mismatch in argument 1. Expected argument of type 'double'
       instead of 'char*'
      ERROR: Invalid arguments trying to create trigger 'prestart'
      ERROR: pand.ctrl:7: Error in trigger
      ERROR: Could not load controller file
      
      	modified:   controller/controller_load.c
      	modified:   controller/controller_sample.c
      	modified:   controller/controller_sample.h
      547c6453
    • Daan Vreeken's avatar
      Add argument type checking on block creation. · 59310594
      Daan Vreeken authored
      This will produce errors like:
      
      ERROR: Argument mismatch in argument 2. Expected argument of type 'int'
       instead of 'double'
      ERROR: Invalid arguments trying to create block 'daan_1'
      ERROR: pand.ctrl:52: Error creating block
      
      	modified:   controller/controller_block.c
      	modified:   controller/controller_block.h
      	modified:   controller/controller_load.c
      59310594
    • Daan Vreeken's avatar
      Implement argument type checking for functions that accept multiple argument · 0b5f1cfc
      Daan Vreeken authored
      type lists.
      The code will generate errors like:
      
      ERROR: Invalid arguments! This function accepts any of the following:
      ERROR:  int,float
      ERROR:  char*,char*
      ERROR: Argument mismatch while trying to set 'test_arg' param on block 'daan_1'
      ERROR: pand.ctrl:207: Error setting parameter
      
      	modified:   controller/controller_load.c
      0b5f1cfc
    • Daan Vreeken's avatar
      Remove debug code. · 5dcefc23
      Daan Vreeken authored
      	modified:   controller/controller_load.c
      5dcefc23
    • Daan Vreeken's avatar
      Correctly handle the '*' wildcard argument type. · 618dba77
      Daan Vreeken authored
      We now interpret it as 'from this point on, zero or more arguments of any type
      will do'.
      
      	modified:   controller/controller_load.c
      618dba77
    • Daan Vreeken's avatar
      Implement full argument type checking for parameters. The code could also be · ebdd92b7
      Daan Vreeken authored
      used to verify the arguments and types of block create functions, etc., but
      start by validating parameters for now. This helps a lot when writing .ctrl
      files as the parser will now stop with a sensible error instead of a segfault
      when arguments are mismatched.
      
      Some example output:
      ERROR: Invalid number of arguments! Expecting 1 argument instead of 3.
      ERROR: Argument mismatch while trying to set 'divider' param on block 'heater'
      ERROR: pand-test.ctrl:169: Error setting parameter
      
      ERROR: Argument mismatch in argument 1. Expected argument of type 'int' instead of 'char*'
      ERROR: Argument mismatch while trying to set 'divider' param on block 'heater'
      ERROR: pand-test.ctrl:169: Error setting parameter
      
      	modified:   controller/controller_load.c
      ebdd92b7
  7. 17 Jan, 2015 2 commits
  8. 06 Jan, 2015 1 commit
  9. 03 Jan, 2015 1 commit
  10. 30 Dec, 2014 1 commit
    • Jeroen Vreeken's avatar
      Add multifrequency support · 9634b339
      Jeroen Vreeken authored
      The frequency keyword has been removed.
      The blocks keyword now needs two arguments: frequency (Hz) and delay (seconds)
      9634b339
  11. 03 Dec, 2014 1 commit
  12. 01 Dec, 2014 1 commit
  13. 30 Nov, 2014 1 commit
  14. 04 Sep, 2014 1 commit
    • Jeroen Vreeken's avatar
      New state machine block · 574ed079
      Jeroen Vreeken authored
      Added integer variables (nice for defining named states in the state machine)
      Various improvements to a few blocks
      	joystick uses controller bus
      	multiplexer and trajectplayer can handle non existing selects
      (cherry picked from commit 82abe0ef)
      574ed079
  15. 21 Aug, 2014 1 commit
  16. 11 Dec, 2013 2 commits
  17. 09 Dec, 2013 1 commit
  18. 04 Jun, 2013 1 commit
  19. 03 Jun, 2013 1 commit
  20. 18 Mar, 2013 1 commit
  21. 15 Mar, 2013 1 commit
  22. 12 Mar, 2013 1 commit
    • Jeroen Vreeken's avatar
      Add 'context' to each block. · 6ea41c1a
      Jeroen Vreeken authored
      The controller_load functions will set it to the .ctrl filename.
      Modifiy dumpdot to use it to make subgraphs. This way we get a nice
      grouping of blocks per file.
      6ea41c1a
  23. 08 Mar, 2013 1 commit
  24. 21 Feb, 2013 1 commit