view src/cs/drivers/drv_app/r2d/lcds/D_Sample/custom_process.pl @ 303:f76436d19a7a default tip

!GPRS config: fix long-standing AT+COPS chance hanging bug There has been a long-standing bug in FreeCalypso going back years: sometimes in the AT command bring-up sequence of an ACI-only MS, the AT+COPS command would produce only a power scan followed by cessation of protocol stack activity (only L1 ADC traces), instead of the expected network search sequence. This behaviour was seen in different FC firmware versions going back to Citrine, and seemed to follow some law of chance, not reliably repeatable. This bug has been tracked down and found to be specific to !GPRS configuration, stemming from our TCS2/TCS3 hybrid and reconstruction of !GPRS support that was bitrotten in TCS3.2/LoCosto version. ACI module psa_mms.c, needed only for !GPRS, was missing in the TCS3 version and had to be pulled from TCS2 - but as it turns out, there is a new field in the MMR_REG_REQ primitive that needs to be set correctly, and that psa_mms.c module is the place where this initialization needed to be added.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 08 Jun 2023 08:23:37 +0000
parents 4e78acac3d88
children
line wrap: on
line source

#!perl

# Mode os scanning (vertical or horizontal)
$mode=$ARGV[0];

# Name of file used to transfer data between this script and the r2d_font_tool
$data=$ARGV[1];

if (($#ARGV+1)>2)
{
   $x=$ARGV[3];
   open(DATA,">$data") or die "Cannot create data file : $!\n";
   $words = int($x/2)+1;

# One word must be added because the alignement is done by excess   
   print DATA $words;
   close(DATA);

   
}
     else
     {
# Open the data file to import glyph bit matrix generated by r2d_font_tool
open(DATA,"$data") or die "Cannot open input file : $!\n";

# It is the size unmodified by r2d_font_tool (width in vertical mode and
# height in horizontal mode). It corresponds to the width/height for the
# current glyph
$matrix_size=int(<DATA>);

# It is the size which is word aligned by r2d_font_tool (height in 
# vertical mode and width in horizontal one)
# It corresponds to the max width/height on all fonts.
$matrix_aligned_size=int(<DATA>);

# Original value before word alignment
# (Max value on all glyphs before alignment) 
$matrix_max_size=int(<DATA>);

# Width of the glyph image in the bitmap
$matrix_image_width=int(<DATA>);

# Height of the glyph in the bitmap
$matrix_image_height=int(<DATA>);

if ($mode =~ /vertical/)
{
   # Scanning of the glyph bit matrix done column per column
   # (since datas are saved column per column by r2d_font_tool
   # when in horizontal mode)
   for($i=0;$i<$matrix_size;$i++)
   {
      for($j=0;$j<$matrix_aligned_size;$j++)
      {
         $matrix{$i.".".$j}=int(<DATA>); 
      }
   }
}
else
{
   # Scanning of the glyph bit matrix done line per line
   for($i=0;$i<$matrix_aligned_size;$i++)
   {
      for($j=0;$j<$matrix_size;$j++)
      {
         $matrix{$i.".".$j}=int(<DATA>); 
      }
   }
}
close(DATA);


# That part of the code is translating the glyph (initially represented
# as a bit matrix) to a format which is compatible with the current LCD.
#
# In this example, the LCD is a 24 bpp one. So, a bit 0 (correponding to black)
# must be converted to 0, and 1 (for white) to 0xFFFFFF.
#
# The scanning must use the IMAGE width in  vertical mode
# and the IMAGE height in horizontal mode.

# In vertical mode, the height must use max_size on all glyph
# In horizontal mode, the width must use the max_size.
# You can either use the aligned_version if you LCD is a 1bpp one and
# or you can use the non aligned one (matrix_max_size) and do the alignment 
# yourself.

# In our case, the LCD is a 24bpp, so no alignment is required and the
# max_size is used directly.

$words=int(($matrix_max_size/2)) +1;
$aligned=$words*2;

open(DATA,">$data") or die "Cannot create data file : $!\n";
  if ($mode =~ /vertical/)
  {
    # Scanning column per column
    for($i=0;$i<$matrix_image_width;$i++)
    {
      for($j=0;$j<$matrix_max_size;$j++)
      {
         $r=$matrix{$i.".".$j};
         # Convertion of bit to color value
         if ($r == 0)
         {
            print DATA "0\n";
         }
         else
         {
            print DATA "0x00FFFFFF\n";
         }
      }
    }
  }
  else
  {
    $k=0;
    # Scanning line per line
    for($j=0;$j<$matrix_image_height;$j++)
    {
      for($i=0;$i<$aligned/2;$i++)
      {
         
         $k=2*$i;
         $ra=$matrix{$k.".".$j};
         

         # Conversion of bit to color value
         if ($ra != 0)
         {
            $ra=0x0FFFF;
         }
         else
         {
            $ra=0;
         }
         
         
         
         
         $k++;
         $rb=$matrix{$k.".".$j};
         

         # Conversion of bit to color value
         if ($rb != 0)
         {
            $rb=0x0FFFF0000;
         }
         else
         {
            $rb=0;
         }
         

         $rb=$rb | $ra;

    
         $res=sprintf "0x%08X\n",$rb;
         
         print DATA $res;
      }
    }
  }
close(DATA);
}