giovedì 21 maggio 2020

Social Distancing WristBand

In questo periodo in cui c'e' la corsa a creare dispositivi per il distanziamento sociale ho voluto vedere quanto era difficile realizzare un dispositivo di questo tipo


Come base hardware ho provato la M5StickC dotata di ESP32, Bluetooth, display a colori e batteria integrata. Il costo e' di circa 15 euro



L'idea generale e' il dispositivo espone un servizio bluetooth "Social Distance" (in realta' si dovrebbe dire social distancing..ma il display e' troppo piccolo :>) e scansiona i dispositivi bluetooth vicini per trovare altri nomi uguali. Usando il parametro RSSI si ha una stima approssimativa di quanto i braccialetti siano vicini

Il problema maggiore riscontrato durante lo sviluppo e' che la scansione Bluetooth richiede molta energia e scarica rapidamente la piccola batteria del braccialetto; anche accendendo lo schermo al minimo necessario e diradando il tempo di scansione non sono riuscito a superare i 40 minuti continuativi di utilizzo 

Il display diventa rossso quando i dispositivi sono vicini. Il tasto serve a vedere lo stato di carica della batteria. Il led rosso e' acceso quando il braccialetto e' in carica ma non ha raggiunto il 100% di carica e quando e' disconnesso dalla ricarica  

Questo e' il codice   

=================================================
//Bluetooth
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEScan.h>
#include <BLEAdvertisedDevice.h>
#include <BLEServer.h>
#include <BLE2902.h>

//Grafica
#include <M5StickC.h>

//Power management
#include "AXP192.h"

//BLE
int scanTime = 2; //In seconds
BLEScan* pBLEScan;

// Speaker
//const int servo_pin = 26;
//int freq = 50;
//int ledChannel = 0;
//int resolution = 10;
//extern const unsigned char m5stack_startup_music[];

int contatore = 1;



// Immagini  formato XBitmap
#define batteria_reverse_width 80
#define batteria_reverse_height 160

static unsigned char logo_bits[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00,
   0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
   0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00,
   0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03,
   0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8,
   0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00,
   0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
   0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00,
   0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03,
   0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8,
   0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00,
   0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
   0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00,
   0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03,
   0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8,
   0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00,
   0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
   0x7c, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00,
   0xe0, 0x03, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0xe0, 0x03,
   0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xe0, 0x07, 0x00, 0xf8,
   0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
   0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
   0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff,
   0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff,
   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xe0, 0x00, 0x70, 0x00, 0x00,
   0x00, 0x00, 0xc0, 0x00, 0x00, 0xe0, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00,
   0xe0, 0x01, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03,
   0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x70,
   0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x70, 0x00, 0xe0,
   0x00, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x70, 0x00, 0xe0, 0x00, 0x00,
   0x00, 0x00, 0xfe, 0x1f, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
   0xfe, 0x1f, 0x00, 0xe0, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f,
   0x00, 0xe0, 0x00, 0x70, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0xc0,
   0x03, 0x3c, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x00, 0xc0, 0xff, 0x3f,
   0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x00, 0x80, 0xff, 0x1f, 0x00, 0x00,
   0x00, 0xe0, 0xff, 0xff, 0x01, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00,
   0xe0, 0x01, 0x00, 0x00, 0xf0, 0x00, 0xff, 0xff, 0xff, 0x01, 0xe0, 0x01,
   0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x03, 0xe0, 0x01, 0x00, 0x00,
   0x00, 0x00, 0xff, 0xff, 0xff, 0x03, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00,
   0xe0, 0x39, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3d,
   0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3d, 0x00, 0xe0,
   0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3d, 0x00, 0xe0, 0x01, 0x00,
   0x00, 0x00, 0x00, 0x00, 0xe0, 0x3d, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xf8,
   0xff, 0x03, 0xe0, 0x39, 0x00, 0x70, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x03,
   0xe0, 0x39, 0x00, 0x70, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0xe0, 0x39,
   0x00, 0x60, 0x00, 0x00, 0x00, 0xc7, 0xf1, 0x00, 0xe0, 0x39, 0x00, 0x60,
   0x00, 0x00, 0x80, 0xc3, 0xc1, 0x01, 0xe0, 0x79, 0x00, 0xe0, 0x00, 0x00,
   0x80, 0xc3, 0x81, 0x01, 0xe0, 0x79, 0x00, 0xc0, 0x01, 0x00, 0x80, 0xc3,
   0x81, 0x03, 0xe0, 0x79, 0x00, 0x80, 0x03, 0x00, 0x80, 0xc1, 0x01, 0x03,
   0xe0, 0x79, 0x00, 0xe0, 0xff, 0x7f, 0x80, 0xc1, 0x01, 0x03, 0xe0, 0x79,
   0x00, 0xe0, 0xff, 0x7f, 0x80, 0xc1, 0x81, 0x03, 0xe0, 0x79, 0x00, 0xe0,
   0xff, 0x7f, 0x80, 0xc3, 0x81, 0x03, 0xe0, 0x79, 0x00, 0x00, 0x00, 0x00,
   0x80, 0x83, 0xc3, 0x03, 0xe0, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83,
   0xff, 0x01, 0xe0, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0x01,
   0xe0, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0xe0, 0x79,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0xe0, 0x79, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x79, 0x00, 0x00, 0xf0, 0x7f,
   0x00, 0x00, 0x00, 0x00, 0xe0, 0x79, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00,
   0x00, 0x00, 0xe0, 0x79, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00,
   0xe0, 0x79, 0x00, 0xc0, 0x7b, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x79,
   0x00, 0xe0, 0x30, 0x38, 0x8f, 0xff, 0xff, 0x03, 0xe0, 0x79, 0x00, 0xe0,
   0x30, 0x30, 0x8f, 0xff, 0xff, 0x03, 0xe0, 0x79, 0x00, 0x70, 0x30, 0x60,
   0x8f, 0xff, 0xff, 0x01, 0xe0, 0x79, 0x00, 0x70, 0x30, 0x60, 0x00, 0x00,
   0x00, 0x00, 0xe0, 0x79, 0x00, 0x70, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
   0xe0, 0x79, 0x00, 0x70, 0x30, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x79,
   0x00, 0x70, 0x30, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x79, 0x00, 0x60,
   0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x79, 0x00, 0x60, 0xf0, 0x70,
   0x00, 0x03, 0x80, 0x01, 0xe0, 0x79, 0x00, 0xe0, 0xe0, 0x7f, 0x00, 0x03,
   0x80, 0x01, 0xe0, 0x79, 0x00, 0xc0, 0xc0, 0x3f, 0x80, 0x03, 0x80, 0x03,
   0xe0, 0x79, 0x00, 0x00, 0x80, 0x1f, 0x80, 0x03, 0x80, 0x03, 0xe0, 0x79,
   0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x79, 0x00, 0x00,
   0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xe0, 0x79, 0x00, 0x00, 0x00, 0x00,
   0x80, 0x01, 0x00, 0x03, 0xe0, 0x79, 0x00, 0x60, 0x00, 0x60, 0x80, 0x03,
   0x80, 0x03, 0xe0, 0x79, 0x00, 0x60, 0x00, 0x60, 0x80, 0x03, 0x80, 0x03,
   0xe0, 0x79, 0x00, 0x60, 0x00, 0x60, 0x80, 0x07, 0xc0, 0x01, 0xe0, 0x79,
   0x00, 0x60, 0x00, 0x60, 0x00, 0x0f, 0xe0, 0x01, 0xe0, 0x79, 0x00, 0x60,
   0x00, 0x60, 0x00, 0x7e, 0xfc, 0x00, 0xe0, 0x79, 0x00, 0x60, 0x00, 0x70,
   0x00, 0xfc, 0x7f, 0x00, 0xe0, 0x79, 0x00, 0xff, 0xff, 0x7f, 0x00, 0xf8,
   0x3f, 0x00, 0xe0, 0x79, 0x00, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0x0f, 0x00,
   0xe0, 0x79, 0x00, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x79,
   0x00, 0xfe, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x79, 0x00, 0x60,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x60, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
   0x1f, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00,
   0x00, 0x78, 0x00, 0x00, 0x00, 0x06, 0x00, 0xfe, 0xff, 0x00, 0x00, 0x78,
   0x00, 0xc0, 0x80, 0x1f, 0x00, 0x1f, 0xf0, 0x01, 0x00, 0x78, 0x00, 0xe0,
   0xc0, 0x3f, 0x00, 0x07, 0xc0, 0x01, 0xf8, 0xff, 0x7f, 0x60, 0xc0, 0x7b,
   0x80, 0x03, 0x80, 0x03, 0xf0, 0xff, 0x3f, 0x60, 0xe0, 0x70, 0x80, 0x03,
   0x80, 0x03, 0xf0, 0xff, 0x1f, 0x70, 0xe0, 0x60, 0x80, 0x01, 0x80, 0x03,
   0xe0, 0xff, 0x1f, 0x70, 0xe0, 0xe0, 0x80, 0x01, 0x00, 0x03, 0xc0, 0xff,
   0x0f, 0x70, 0x70, 0xe0, 0x80, 0x03, 0x80, 0x03, 0x80, 0xff, 0x07, 0x70,
   0x70, 0xe0, 0x80, 0x03, 0x80, 0x03, 0x80, 0xff, 0x07, 0x60, 0x70, 0x60,
   0x80, 0x07, 0xc0, 0x03, 0x00, 0xff, 0x03, 0xe0, 0x78, 0x60, 0x00, 0x0f,
   0xe0, 0x01, 0x00, 0xfe, 0x01, 0xe0, 0x3d, 0x60, 0x00, 0x3f, 0xf8, 0x01,
   0x00, 0xfc, 0x01, 0xc0, 0x3f, 0x70, 0x00, 0xfe, 0xff, 0x00, 0x00, 0xf8,
   0x00, 0x80, 0x1f, 0x70, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x78, 0x00, 0x00,
   0x02, 0x30, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x80, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03,
   0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfe, 0xff, 0x07, 0xc0, 0xe1,
   0xff, 0x7f, 0xfc, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xc0, 0xe3, 0xff, 0x7f,
   0x7c, 0x00, 0x00, 0xff, 0xff, 0x1f, 0xc0, 0xe1, 0xff, 0x7f, 0x7e, 0x00,
   0x80, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xc0, 0x7f,
   0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xc0, 0x3f, 0x80, 0x3f,
   0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xc0, 0x1f, 0x00, 0x3f, 0x00, 0x00,
   0x00, 0x00, 0x3f, 0x00, 0xe0, 0x0f, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
   0x1f, 0x00, 0xe0, 0x0f, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00,
   0xe0, 0x07, 0x00, 0x7c, 0xc0, 0xff, 0xff, 0x7f, 0x1f, 0x00, 0xe0, 0x07,
   0x00, 0x7c, 0xc0, 0xff, 0xff, 0x7f, 0x1f, 0x00, 0xf0, 0x07, 0x00, 0x7c,
   0xc0, 0xff, 0xff, 0x7f, 0x1f, 0x00, 0xf0, 0x03, 0x00, 0x7c, 0x00, 0x80,
   0x07, 0x1e, 0x1f, 0x00, 0xf0, 0x03, 0x00, 0x7c, 0x00, 0xc0, 0x01, 0x38,
   0x1f, 0x00, 0xf0, 0x03, 0x00, 0xfc, 0x00, 0xe0, 0x00, 0x70, 0x1f, 0x00,
   0xf0, 0x03, 0x00, 0xfc, 0x00, 0x60, 0x00, 0x60, 0x1f, 0x00, 0xf8, 0x03,
   0x00, 0x7c, 0x00, 0x60, 0x00, 0x60, 0x1f, 0x00, 0xf8, 0x01, 0x00, 0x7c,
   0x00, 0x70, 0x00, 0xe0, 0x3f, 0x00, 0xf8, 0x01, 0x00, 0x7c, 0x00, 0x70,
   0x00, 0xe0, 0x3e, 0x00, 0xfc, 0x01, 0x00, 0x7c, 0x00, 0x70, 0x00, 0x60,
   0x7e, 0x00, 0xfc, 0x01, 0x00, 0x7c, 0x00, 0xe0, 0x00, 0x70, 0xfe, 0x00,
   0xfe, 0x00, 0x00, 0x7c, 0x00, 0xe0, 0x01, 0x78, 0xfc, 0x01, 0xff, 0x00,
   0x00, 0x7e, 0x00, 0xc0, 0x0f, 0x3f, 0xfc, 0xc7, 0x7f, 0x00, 0x00, 0x3e,
   0x00, 0x80, 0xff, 0x1f, 0xf8, 0xff, 0x7f, 0x00, 0x00, 0x3e, 0x00, 0x00,
   0xff, 0x0f, 0xf8, 0xff, 0x3f, 0x00, 0x00, 0x3f, 0x00, 0x00, 0xf8, 0x01,
   0xf0, 0xff, 0x3f, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff,
   0x1f, 0x00, 0x80, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x07, 0x00,
   0x80, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x80, 0x1f,
   0x00, 0x00, 0x00, 0x00 };

static unsigned char batteria_reverse_full_bits[] = {
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0x5f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xaa,
   0xaa, 0xaa, 0xaa, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0xff, 0x7b, 0xef, 0xbd, 0xf7, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff };


static unsigned char batteria_reverse_34_bits[] = {
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0x5b, 0x00, 0x00, 0x00, 0x80, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xaa,
   0xaa, 0xaa, 0xaa, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3e, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3f, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3e, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xdd, 0xdd, 0xdd, 0xbd, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff };


static unsigned char batteria_reverse__mezzo_bits[] = {
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0x5b, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0x7f, 0x55, 0x55, 0x55, 0x55, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3e, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3e, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3e, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xbb, 0xbb, 0xbb, 0x7b, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff };

   static unsigned char batteria_reverse_14_bits[] = {
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
   0x56, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3f, 0x00,
   0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff,
   0xff, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00,
   0x7f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x7f, 0x80, 0xff, 0xff, 0x00, 0x7e, 0x00, 0x00, 0x00,
   0x00, 0x7e, 0x80, 0xff, 0xff, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7e,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xee, 0xee, 0xee, 0xee, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xfe, 0xff,
   0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
   0xff, 0x7f, 0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
   0x80, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff,
   0xff, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff };

static unsigned char batteria_charge_bits[] = {
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xaa, 0xaa, 0xaa,
   0xaa, 0xfa, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8,
   0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff,
   0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff,
   0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
   0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00,
   0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8,
   0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff,
   0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff,
   0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
   0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00,
   0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8,
   0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff,
   0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff,
   0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00,
   0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00,
   0x00, 0xf8, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0,
   0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0,
   0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xc0,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xc0,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0x07, 0xe0, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff,
   0xff, 0xff, 0x3f, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff,
   0x1f, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0x07, 0xe0,
   0x0f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff,
   0xff, 0xff, 0xc0, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0x7f,
   0xe0, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0xff, 0xff, 0x07, 0xf8, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff,
   0xff, 0x03, 0xf8, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0x01,
   0xfc, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0x00, 0xfc, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0x7f, 0x00, 0xfe, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0xff, 0x3f, 0x00, 0xfe, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0xff, 0x1f, 0x00, 0xfe, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff,
   0x0f, 0x00, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0x07, 0x00,
   0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0x03, 0x80, 0xff, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0x01, 0x80, 0xff, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0x7f, 0x00, 0xc0, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0x3f,
   0x00, 0xe0, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0x1f, 0x00, 0xe0,
   0xaf, 0xf8, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xfc,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0x07, 0x00, 0x00, 0x00, 0xfe, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0x03, 0x00, 0x00, 0x00, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0x01, 0x00, 0x00, 0x80, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0x00,
   0x00, 0x00, 0xc0, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0x7f, 0x00, 0x00, 0x00,
   0xe0, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0x3f, 0xe8, 0x0f, 0x00, 0xf0, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0x0f, 0x00, 0xf8, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0xff, 0x07, 0x00, 0xfc, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0xff, 0x07, 0x00, 0xfe, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff,
   0x03, 0x00, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0x03, 0x80,
   0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0x01, 0xc0, 0xff, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0x01, 0xe0, 0xff, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0x7f,
   0x00, 0xfc, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0x7f, 0x00, 0xfe,
   0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0x3f, 0x00, 0xff, 0xff, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0x1f, 0xe0, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0x1f,
   0xf0, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0x0f, 0xf8, 0xff,
   0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0x07, 0xfe, 0xff, 0xff, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0x83, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xc3,
   0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xe3, 0xff, 0xff,
   0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0x7f, 0xff,
   0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0,
   0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0x07, 0xe0, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0x07, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0,
   0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0,
   0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x2f, 0x49, 0x92, 0x24,
   0x49, 0x92, 0x24, 0x22, 0x91, 0xe4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff };

BLEServer* pServer = NULL;
BLECharacteristic* pCharacteristic = NULL;
bool deviceConnected = false;
bool oldDeviceConnected = false;
uint32_t value = 0;

#define SERVICE_UUID        "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"


class MyServerCallbacks: public BLEServerCallbacks {
    void onConnect(BLEServer* pServer) {
      deviceConnected = true;
    };

    void onDisconnect(BLEServer* pServer) {
      deviceConnected = false;
    }
};


class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
    void onResult(BLEAdvertisedDevice advertisedDevice) {
//      prova = 
      //Serial.printf("Advertised Device: %s \n", advertisedDevice.toString().c_str());
      
      //Serial.printf("%s : ",advertisedDevice.getAddress().toString().c_str());
      //Serial.printf("%s : ",advertisedDevice.getServiceUUID().toString().c_str());
      //Serial.printf("%i\n",advertisedDevice.getRSSI());
      
      String address = advertisedDevice.getAddress().toString().c_str();
      String name;
      if (advertisedDevice.haveName ())
            {
                name = advertisedDevice.getName().c_str();
                //Serial.printf("%s\n",name);
            }

      int rssi = advertisedDevice.getRSSI();
      if (name.equals("SocialDistance"))
        {
         //Serial.println(address);
         //Serial.println(rssi);
         //Serial.println("=="); 
            if (rssi > -55)
            {
                // Se e' vicino accende lo schermo di colore rosso
                M5.Axp.SetLDO2(true);
                //M5.Axp.SetLDO3(true);
                M5.Lcd.fillScreen(RED);
                // ed emette suono
                //ledcWriteTone(ledChannel, 1250);
                //delay(500);
                //ledcWriteTone(ledChannel, 0);
            }
            else
            {
                // turn off screen
                M5.Axp.SetLDO2(false);
                //M5.Axp.SetLDO3(false);
                //M5.Lcd.fillScreen(GREEN);
            }
        }
        
      
    }
};

// Non usata
void blink_led()
  {
    pinMode(M5_LED,OUTPUT);
    digitalWrite(M5_LED,HIGH);
    //delay(100);
    //digitalWrite(M5_LED,LOW);
    //delay(100);
  }


double getBatteryLevel(void)
{
  uint16_t vbatData = M5.Axp.GetVbatData();
  double vbat = vbatData * 1.1 / 1000;
  Serial.print("Livello Batteria % ");
  Serial.println(100.0 * ((vbat - 3.14) / (4.14 - 3.14)));
  //M5.Lcd.setCursor(0, 0);
  //M5.Lcd.println(vbat);
  return 100.0 * ((vbat - 3.14) / (4.14 - 3.14));
}

/*// genera il tono

void playMusic(const uint8_t* music_data, uint16_t sample_rate) {
  uint32_t length = strlen((char*)music_data);
  uint16_t delay_interval = ((uint32_t)1000000 / sample_rate);
    for(int i = 0; i < length; i++) {
      ledcWriteTone(ledChannel, music_data[i]*50);
      delayMicroseconds(delay_interval);
    } 
}*/

void setup() {
  M5.begin();  
  pinMode(M5_LED,OUTPUT);
  // al contrario di quanto si puo' pensare
  // LOW accende il LED mentre HIGH lo spenge
  digitalWrite(M5_LED,LOW);

  // Setup Speaker 
  //ledcSetup(ledChannel, freq, resolution);
  //ledcAttachPin(servo_pin, ledChannel);
  //ledcWrite(ledChannel, 256);//0°
  
  // mostra il logo
  M5.Lcd.fillScreen(WHITE);
  M5.Lcd.drawXBitmap (0, 0, logo_bits, batteria_reverse_width, batteria_reverse_height, TFT_BLACK); 
  delay(4000);
  M5.Axp.SetLDO2(false);
  //M5.Axp.SetLDO3(false);


  //M5.Lcd.setTextSize(2);


  //controllo della luminosita' dello schermo
  //per risparmiare energia (valori da 7 a 15)
  M5.Axp.ScreenBreath(15);


  M5.Axp.EnableCoulombcounter();

  Serial.begin(9600);
  //Serial.println("Scanning...");

  BLEDevice::init("SocialDistance");

  // Advertise
  pServer = BLEDevice::createServer();
  pServer->setCallbacks(new MyServerCallbacks());
  BLEService *pService = pServer->createService(SERVICE_UUID);
  pCharacteristic = pService->createCharacteristic(
                      CHARACTERISTIC_UUID,
                      BLECharacteristic::PROPERTY_READ   |
                      BLECharacteristic::PROPERTY_WRITE  |
                      BLECharacteristic::PROPERTY_NOTIFY |
                      BLECharacteristic::PROPERTY_INDICATE
                    );
  pCharacteristic->addDescriptor(new BLE2902());
  pService->start();
  BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
  pAdvertising->addServiceUUID(SERVICE_UUID);
  pAdvertising->setScanResponse(false);
  pAdvertising->setMinPreferred(0x0); 
  BLEDevice::startAdvertising();

  
  pBLEScan = BLEDevice::getScan(); //create new scan
  pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
  pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster
  pBLEScan->setInterval(5000); // in millisecondi default 100
  pBLEScan->setWindow(2500);  // less or equal setInterval value default 99
}

void loop() {
  BLEScanResults foundDevices = pBLEScan->start(scanTime, false);
  //Serial.print("Devices found: ");
  //Serial.println(foundDevices.getCount());
  //Serial.println("Scan done!");
  pBLEScan->clearResults();   // delete results fromBLEScan buffer to release memory
  delay(1000);

  //controllo dello stato batteria
  // 4.1 V Full
  // 3.4 V Dead
  // 3.7 V Good
  //Serial.println(M5.Axp.GetBatVoltage());
  //controllo amper corrente
  //se negativo in scarica
  
  // Battery 
  //Serial.println("Battery Level "); 
  //Serial.println(getBatteryLevel());
  //Serial.print("Ampere ");
  //Serial.println(M5.Axp.GetBatCurrent());
  int bat = (int) getBatteryLevel();
  if (bat >= 99)
      {
          // la ricarica e' finita spenge il led
          digitalWrite(M5_LED,HIGH);
      }
      else
      {
          // altrimenti se e' in ricarica od in uso
          // tiene il led acceso 
          digitalWrite(M5_LED,LOW);
      }
      
  M5.update();
  // se si preme il tasto mette le informazioni sulla batteria
  if(M5.BtnA.wasPressed())
    {
                M5.Axp.SetLDO2(true);
                M5.Lcd.fillScreen(WHITE);
                if (bat > 100) bat = 100;
                if (M5.Axp.GetBatCurrent() > 0)
                    {
                     M5.Lcd.drawCentreString("Chg", 40, 10, 1);
                     M5.Lcd.drawXBitmap (0, 0, batteria_charge_bits, batteria_reverse_width, batteria_reverse_height, TFT_BLACK); 
                    }
                    else
                    {
                    M5.Lcd.drawCentreString(String(bat), 40, 10, 1);
                    if (getBatteryLevel() > 75)
                            M5.Lcd.drawXBitmap (0, 0, batteria_reverse_full_bits, batteria_reverse_width, batteria_reverse_height, TFT_BLACK); 
    
                    if ((getBatteryLevel() <= 75) && (getBatteryLevel() > 50))
                            M5.Lcd.drawXBitmap (0, 0, batteria_reverse_34_bits, batteria_reverse_width, batteria_reverse_height, TFT_BLACK); 
    
                    if ((getBatteryLevel() <= 50) && (getBatteryLevel() > 25))
                            M5.Lcd.drawXBitmap (0, 0,batteria_reverse__mezzo_bits , batteria_reverse_width, batteria_reverse_height, TFT_BLACK); 
                  
                    if (getBatteryLevel() <= 25)
                            M5.Lcd.drawXBitmap (0, 0, batteria_reverse_14_bits, batteria_reverse_width, batteria_reverse_height, TFT_BLACK); 
                    }
                delay(2000);
                M5.Axp.SetLDO2(false);
    }
}


Salutiamo il vecchio tema .....

... e diamo il benvenuto al Dark Theme



sabato 16 maggio 2020

ISS Docking

SpaceX ha reso pubblico un simulatore per il docking alla ISS e non potevo non provare


Non e' stato banalissimo piu' che altro per il controllo della velocita' anche perche' non ci sono istruzioni su tasti funzione

Le cose piu' divertenti sono gli easter eggs:
La modalita' Terra piatta




e la macchina Tesla che si trova ruotando la visuale all'indietro rispetto all'orientamento iniziale


giovedì 14 maggio 2020

MicroPython Bluetooth su Esp-Wroom-32

Ho provato a convertire la mia ESP32 DevKit V2 Esp-Wroom-32 per utilzzare Micropython



Per fare cio' per prima cosa si deve eliminare il firmware esistente

esptool.py --chip esp32 --port /dev/ttyUSB0 erase_flash

e poi flashare il firmware con MicroPython da questo link. Ne esistono due: il primo con il supporto completo indicato da V3 ed uno con il solo supporto BLE indicato da V4

esptool.py --chip esp32 --port /dev/ttyUSB0 write_flash -z 0x1000 /home/luca/Downloads/esp32-idf4-20191220-v1.12.bin 

Al termine, per vedere se ha funzionato si puo' aprire un terminale seriale come Minicom. Attenzione che devono disabilitati Hardware Flow e Software Flow

minicom -s
CTRL+A+Z
Serial Port Setup  115200 8N1 
Hardware Flow NO 
Software Flow NO

ci si trova davanti al prompt REPL di Python 

al posto di scrivere sulla shell tramite Minicom si puo' effettuare l'upload di un file tramite

pip install adafruit-ampy

per copiare un file sulla scheda si usa
ampy --port=/dev/ttyUSB0 put ble_advertising.py 

mentre per eseguirlo
ampy --port=/dev/ttyUSB0 run ble_advertising.py 

i comandi completi sono i seguenti

  get    Retrieve a file from the board.
  ls     List contents of a directory on the board.
  mkdir  Create a directory on the board.
  put    Put a file or folder and its contents on the board.
  reset  Perform soft reset/reboot of the board.
  rm     Remove a file from the board.
  rmdir  Forcefully remove a folder and all its children from the board.
  run    Run a script and print its output.

(questi codici erano gia' stati visti con M5Stack)

per avere gli esempi di MicroPython si puo' clonare

git clone https://github.com/micropython/micropython


un altro comodo sistema per gestire il dispotivo e' RShell con cui si puo' interagire con  il  file system


root@debian:~# rshell --buffer-size=30 -p /dev/ttyUSB0
Using buffer-size of 30
Connecting to /dev/ttyUSB0 (buffer-size 30)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /boot.py/ /ble_temperature.py/ /advertise.py/ /socialdistance.py/ /ble_temperature_central.py/ /scan.py/
Setting time ... May 12, 2020 19:08:12
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 2000
Welcome to rshell. Use Control-D (or the exit command) to exit rshell.
/root> 


gli script python si trovano nella directory /pyboard quindi basta fare 

cd /pyboard
ls

per osservarli 

edit nome_file.py

apre vi per permettere l'editing (l'editor non si trova sull'ESP32 ma sul computer)

per fare un scansione di dispositivi BLE con Micropython si puo' usare 

--------------------------------------------------------------------
import bluetooth
from micropython import const
import time

_IRQ_CENTRAL_CONNECT                 = const(1 << 0)
_IRQ_CENTRAL_DISCONNECT              = const(1 << 1)
_IRQ_GATTS_WRITE                     = const(1 << 2)
_IRQ_GATTS_READ_REQUEST              = const(1 << 3)
_IRQ_SCAN_RESULT                     = const(1 << 4)
_IRQ_SCAN_COMPLETE                   = const(1 << 5)
_IRQ_PERIPHERAL_CONNECT              = const(1 << 6)
_IRQ_PERIPHERAL_DISCONNECT           = const(1 << 7)
_IRQ_GATTC_SERVICE_RESULT            = const(1 << 8)
_IRQ_GATTC_CHARACTERISTIC_RESULT     = const(1 << 9)
_IRQ_GATTC_DESCRIPTOR_RESULT         = const(1 << 10)
_IRQ_GATTC_READ_RESULT               = const(1 << 11)
_IRQ_GATTC_WRITE_STATUS              = const(1 << 12)
_IRQ_GATTC_NOTIFY                    = const(1 << 13)
_IRQ_GATTC_INDICATE                  = const(1 << 14)


def bt_irq(event, data):
    if event == _IRQ_SCAN_RESULT:
        addr_type, addr, connectabt, rssi, adv_data = data
        print(data)
       
    elif event == _IRQ_SCAN_COMPLETE:
        print("scan complete")

bt = bluetooth.BLE()
bt.active(True) 
bt.gap_scan(10000, 10000, 10000)
bt.irq(bt_irq)

time.sleep(20)

--------------------------------------------------------------------

per creare un dispositivo che fa solo l'advertise in BLE

---------------------------------------------------------------------
import bluetooth
import struct
import time
from ble_advertising import advertising_payload
from micropython import const

_ENV_SENSE_UUID = bluetooth.UUID(0x181A)
_ADV_APPEARANCE_GENERIC_THERMOMETER = const(768)


class BLETemperature:
    def __init__(self, ble, name="SocialDistance"):
        self._ble = ble
        self._ble.active(True)
        self._payload = advertising_payload(
            name=name, services=[_ENV_SENSE_UUID], appearance=_ADV_APPEARANCE_GENERIC_THERMOMETER
        )
        self._advertise()
    def _advertise(self, interval_us=500000):
        self._ble.gap_advertise(interval_us, adv_data=self._payload)


def demo():
    ble = bluetooth.BLE()
    temp = BLETemperature(ble)
    while True:
print("Sociale")

if __name__ == "__main__":
    demo()
---------------------------------------------------------------------


martedì 12 maggio 2020

Damn Vulnerable Web Application

Mi sto leggendo avanza tempo il libro HackLog  Manuale di Sicurezza Informatica ed Hacking Etico di Stefano Novelli. Nel libro viene  DVWA - Damn Vulnerable Web Application, una applicazione web studiata appositamente per fare pratica con le vulnerabilita' principalmente di webserver

Si puo' ottenere la DVWA da questo link in formato iso o docker. Ho scelto la ISO ma ho scoperto su Debian Testing VirtualBox non ne vuole sapere di installarsi....sono passato a QEmu

qemu-system-x86_64 -cdrom  DVWA-1.0.7.iso -m 2G -enable-kvm -net user,hostfwd=tcp::8080-:80 -net nic

a questo punto basta puntare il browser su  http://localhost:8080/login.php con credenziali admin/password



Di esempi ce ne sono tanti ma molto semplici ad impegnativi.

Debugger integrato ESP32S3

Aggiornamento In realta' il Jtag USB funziona anche sui moduli cinesi Il problema risiede  nell'ID USB della porta Jtag. Nel modulo...