Olli Graf
8 months ago
3 changed files with 35 additions and 19 deletions
@ -0,0 +1,24 @@ |
|||||
|
import logging |
||||
|
|
||||
|
class SourceGenerator: |
||||
|
|
||||
|
|
||||
|
def generate_source(self,field): |
||||
|
source = 'byte frame[8][12] ={\n' |
||||
|
|
||||
|
logging.debug(f'frame= {field.frame}') |
||||
|
for line in range(0,len(field.frame)): |
||||
|
logging.debug(f'proccessing line {line}') |
||||
|
curline = field.frame[line] |
||||
|
sourceline = '{ ' |
||||
|
logging.debug(f'initialized sourceline= {sourceline}') |
||||
|
for col in range(0,len(curline)): |
||||
|
logging.debug(f'processing column {col},adding {curline[col]}') |
||||
|
sourceline += '1, ' if curline[col] == 1 else '0, ' |
||||
|
logging.debug(f'sourceline for ({line},{col})={sourceline}') |
||||
|
sourceline += '},\n' #if col < len(curline) else '}\n' |
||||
|
logging.debug(f'appending sourceline {sourceline}') |
||||
|
source = source + sourceline |
||||
|
source = source + '\n};' |
||||
|
return source |
||||
|
|
Loading…
Reference in new issue