1. 20 Jan, 2015 18 commits
    • Jeroen Vreeken's avatar
      Merge ../dt_ctrl-pand into beaglebone · 86c7cdc6
      Jeroen Vreeken authored
      Also add test for different linking variants (late, immediate, not-chained).
      All expected/assumed behaviour should get explicit tests.
      Same for blocks. Block behaviour must be testable without the real application.
      (or real hardware, which is the bigger problem)
      
      Conflicts:
      	controller/controller/controller_block.c
      86c7cdc6
    • Jeroen Vreeken's avatar
      term_type_str implements the same function as existing enum2str function. · 17f4d979
      Jeroen Vreeken authored
      Use one version everywhere, and make sure that one version is complete.
      This version also uses a switch with the actuall enum types, which is safer.
      17f4d979
    • Daan Vreeken's avatar
    • 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
    • Jeroen Vreeken's avatar
      Merge ../dt_ctrl-pand into beaglebone · ab83cffc
      Jeroen Vreeken authored
      ab83cffc
    • 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
      Fix error reporting when connecting inputs/outputs of differt types together. · 3b95f7cc
      Daan Vreeken authored
      Untill now, connecting e.g. a 'bool' output to a 'float' input would give:
      
       ERROR: Input terminal x.y not found
      
      .. although both the input and the output existed.
      With this commit, the error will read :
      
       ERROR: Type mismatch. Can't connect output terminal a.b (of type 'bool') to
       input terminal x.y (of type 'float')
      
      	modified:   controller/controller_block.c
      	modified:   controller/controller_block.h
      3b95f7cc
    • Daan Vreeken's avatar
      More de-indenting. Still no functional changes. · 680e0017
      Daan Vreeken authored
      	modified:   controller/controller_block.c
      680e0017
    • Daan Vreeken's avatar
      De-indent code a bit by reversing the order of the outer if (..). · 5935bba9
      Daan Vreeken authored
      (No functional changes.)
      There's an error in the error reporting of this routine, but we'll fix that in
      a separate commit.
      
      	modified:   controller/controller_block.c
      5935bba9
    • Jeroen Vreeken's avatar
      Add a few extra test cases. · feb47c82
      Jeroen Vreeken authored
      feb47c82
    • Jeroen Vreeken's avatar
      Merge ../dt_ctrl-pand into beaglebone · 66e580bd
      Jeroen Vreeken authored
      66e580bd
    • 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
      Add missing checks for controller_block_add()'s return value. · ff394fc1
      Daan Vreeken authored
      	modified:   dt_azimuth/dt_az_safety.c
      	modified:   dt_elevation/dt_el_safety.c
      ff394fc1
    • Daan Vreeken's avatar
      Fix long-standing copy/pasto. · a454f2d6
      Daan Vreeken authored
      Don't intialize bool or uint32_t with float value.
      
      	modified:   block/block_value_bool.c
      	modified:   block/block_value_uint32.c
      a454f2d6
    • Daan Vreeken's avatar
      Also add the optional initial value argument to 'value_bool' and 'value_uint32'. · 6d0a8b7b
      Daan Vreeken authored
      My .ctrl file is so much cleaner this way :)
      
      	modified:   block/block_value_bool.c
      	modified:   block/block_value_uint32.c
      6d0a8b7b
    • Daan Vreeken's avatar
      Add optional initial value to argument list of the 'value' block. · ca041574
      Daan Vreeken authored
      Before, a value of '1.0' had to be created like this :
      
      	blocks(..) {
      		{ "value", "one" }
      	}
      	params {
      		{ "one", "value", 1.0 }
      	}
      
      Now you can simply instantiate the same block with :
      
      	blocks(..) {
      		{ "value", "one", 1.0 }
      	}
      
      I've finally found a good use for fully specified multiple choice argument
      lists :)
      
      	modified:   block/block_value.c
      ca041574
    • 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
  2. 19 Jan, 2015 10 commits
  3. 18 Jan, 2015 12 commits