Hi Paul,

I just tested the feature, sorry for the delay, and it does not work.

The attached patch correct the problems :

1. as specified in the documentation I set redefchar and redefchar_hex
under LCD_H directory, as LCD did not exist;

2. redefchar_hex was not declared with the correct data length
(LCD_REDEFCHAR_LENGTH_HEX);

3. in FS_redefchar_hex the buffer passed to OW_redefchar was not the
converted one.

Best regards,

Max.

Le 27.05.2012 00:11, Paul Alfille a écrit :
> Thank you. It's always great to get a patch, especially for a new
> feature like this.
> 
> Added to the next release, with a slight change. Instead of a single
> string that includes the character number, we will have an array of 8,
> one for each user-redefinable character. This matches owfs style better.
> 
> Paul Alfille
> 
> On Sun, Mar 11, 2012 at 7:48 AM, Maxime Soulé <[email protected]
> <mailto:[email protected]>> wrote:
> 
>     Hi,
> 
>     This patch add a new file to the DS2408 LCD_H/ directory: redefchar
> 
>     It allows to redefine up to 8 chars corresponding to the ASCII codes
>     0 to 7. Once the chars are redefined, they can be displayed with
>     screen* functions.
> 
>     The format of the entry follows:
>     - each character definition is 17 bytes long (several characters can
>     be defined at one time by concatenating their definition)
>     - first char is the index of the redefined character: '0' -> '7'
>     (human form) or '\0' -> '\10' (binary form)
>     - 16 others define the 8 lines of each character, a pair of
>     hexadecimal digit for each char between "00" and "1F" (or "1f", but
>     see the note at the end). When a bit is set the corresponding pixel
>     is on. For example:
> 
>     18421 <- bits columns
>     ..... => "00"
>     ..#.. => "04"
>     .#.#. => "0A" (because 8 + 2)
>     #...# => "11"
>     #...# => "11"
>     .#.#. => "0A" (because 8 + 2)
>     ..#.. => "04"
>     ..... => "00"
> 
>     So to define this character on ascii code '\1', we will use the
>     string: "100040A11110A0400"
> 
>     Other examples:
>     - an empty square on char '\6': "61F1111111111111F"
>     ##### => "1F"
>     #...# => "11"
>     #...# => "11"
>     #...# => "11"
>     #...# => "11"
>     #...# => "11"
>     #...# => "11"
>     ##### => "1F"
> 
>     - a hourglass on char '\3' : "31F1F0E04040E1F1F"
>     ##### => "1F"
>     ##### => "1F"
>     .###. => "0E"
>     ..#.. => "04"
>     ..#.. => "04"
>     .###. => "0E"
>     ##### => "1F"
>     ##### => "1F"
> 
>     - both in one write : "__61F1111111111111F31F1F0E04040E__1F1F"
> 
>     Note that if redefined chars are already displayed on the LCD,
>     redefining them again will change all of them on the display. This
>     behavior is hard-coded in the LCD.
> 
>     Note that one can redefine the character '\0' but it is not always
>     easy to manipulate it and/or to display it due to libraries or
>     interfaces constraints (like null terminated string handling)...
> 
>     Lastly, this code use the function hex_digit() in ow_bae.c. This
>     function does not work well for lower case hexadecimal digits,
>     except if you apply the "ow_bae.c patch" I posted this morning.
> 
>     Best regards,
> 
>     Max.
> 
>     
> ------------------------------------------------------------------------------
>     Virtualization & Cloud Management Using Capacity Planning
>     Cloud computing makes use of virtualization - but cloud computing
>     also focuses on allowing computing to be delivered as a service.
>     http://www.accelacomm.com/jaw/sfnl/114/51521223/
>     _______________________________________________
>     Owfs-developers mailing list
>     [email protected]
>     <mailto:[email protected]>
>     https://lists.sourceforge.net/lists/listinfo/owfs-developers
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> 
> 
> 
> _______________________________________________
> Owfs-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
> 
--- owfs-2.8p20/module/owlib/src/c/ow_2408.c.orig       2012-11-01 
19:01:21.000000000 +0100
+++ owfs-2.8p20/module/owlib/src/c/ow_2408.c    2012-11-01 19:07:53.000000000 
+0100
@@ -120,8 +120,8 @@
        {"LCD_H/screenyx", PROPERTY_LENGTH_LCD_MESSAGE, NON_AGGREGATE, 
ft_ascii, fc_stable, NO_READ_FUNCTION, FS_Hscreenyx, VISIBLE, NO_FILETYPE_DATA, 
},
        {"LCD_H/message", PROPERTY_LENGTH_LCD_MESSAGE, NON_AGGREGATE, ft_ascii, 
fc_stable, NO_READ_FUNCTION, FS_Hmessage, VISIBLE, NO_FILETYPE_DATA, },
        {"LCD_H/onoff", PROPERTY_LENGTH_UNSIGNED, NON_AGGREGATE, ft_unsigned, 
fc_stable, NO_READ_FUNCTION, FS_Honoff, VISIBLE, NO_FILETYPE_DATA, },
-       {"LCD/redefchar", LCD_REDEFCHAR_LENGTH, &A2408c, ft_binary, fc_stable, 
NO_READ_FUNCTION, FS_redefchar, VISIBLE, NO_FILETYPE_DATA, },
-       {"LCD/redefchar_hex", LCD_REDEFCHAR_LENGTH, &A2408c, ft_binary, 
fc_stable, NO_READ_FUNCTION, FS_redefchar_hex, VISIBLE, NO_FILETYPE_DATA, },
+       {"LCD_H/redefchar", LCD_REDEFCHAR_LENGTH, &A2408c, ft_binary, 
fc_stable, NO_READ_FUNCTION, FS_redefchar, VISIBLE, NO_FILETYPE_DATA, },
+       {"LCD_H/redefchar_hex", LCD_REDEFCHAR_LENGTH_HEX, &A2408c, ft_binary, 
fc_stable, NO_READ_FUNCTION, FS_redefchar_hex, VISIBLE, NO_FILETYPE_DATA, },
 };
 
 DeviceEntryExtended(29, DS2408, DEV_alarm | DEV_resume | DEV_ovdr, 
NO_GENERIC_READ, NO_GENERIC_WRITE);
@@ -630,7 +630,7 @@
        struct parsedname *pn = PN(owq);
        BYTE data[LCD_REDEFCHAR_LENGTH] ;
        
-       if ( OWQ_size(owq) != LCD_REDEFCHAR_LENGTH * 2 ) {
+       if ( OWQ_size(owq) != LCD_REDEFCHAR_LENGTH_HEX ) {
                return -ERANGE ;
        }
        if ( OWQ_offset(owq) != 0 ) {
@@ -638,7 +638,7 @@
        }
        string2bytes( OWQ_buffer(owq), data, LCD_REDEFCHAR_LENGTH ) ;
                
-       return GB_to_Z_OR_E( OW_redefchar( OWQ_buffer(owq), pn ) ) ;
+       return GB_to_Z_OR_E( OW_redefchar( data, pn ) ) ;
 }
 
 /* Read 6 bytes --
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to