def init(): try: # Init the module configuration command.send_at_command("AT#SELINT=2") # Set the command mode command.send_at_command("AT&K0") # Configure GPS speed # command.send_at_command("AT$GPSS=57600") except Exception, err: SER.send("Erro ao iniciar o modulo: %s\n"%err)
gps_log_file = None init() log_filename = '' while(log_filename == ''): log_filename = get_new_log_filename() if log_filename == '': SER.send("Nome de arquivo de log nao criado.\n") MOD.sleep(40) else: MOD.watchdogReset() # Configure the GPS Serial speed command.send_at_command("AT$GPSS=57600") try: # TODO: O Erro esta aqui nao cria arquivos com nome editado em runtime SER.send("Novo log: %s\n"%log_filename) gps_log_file = open("%s"%log_filename, 'w') # gps_log_file = open(log_filename, 'w') gps_log_file.write("Nova sessao: %d"%MOD.secCounter()) gps_log_file.flush() except Exception, err: SER.send("Nao foi possivel abrir o arquivo de log: %s\n"%err) if gps_log_file != None: try: start_time = MOD.secCounter()