Commit 37b9536f by karudu

Mõõtepiirkonna muutmine, pinge hoiatus

parent beb6ac6c
Showing with 1187 additions and 40 deletions
const char FLASH_VoltageTable[1024 * 3] PROGMEM = const char FLASH_VoltageTable1x[1024 * 3] PROGMEM =
{ {
'0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0',
...@@ -1025,3 +1025,1031 @@ const char FLASH_VoltageTable[1024 * 3] PROGMEM = ...@@ -1025,3 +1025,1031 @@ const char FLASH_VoltageTable[1024 * 3] PROGMEM =
'4', '8', '0', '4', '8', '0',
'4', '8', '0', '4', '8', '0',
}; };
const char FLASH_VoltageTable10x[1024 * 4] PROGMEM = // TODO
{
0, '0', '0', '0',
0, '0', '0', '5',
0, '0', '0', '9',
0, '0', '1', '4',
0, '0', '1', '9',
0, '0', '2', '3',
0, '0', '2', '8',
0, '0', '3', '3',
0, '0', '3', '8',
0, '0', '4', '2',
0, '0', '4', '7',
0, '0', '5', '2',
0, '0', '5', '6',
0, '0', '6', '1',
0, '0', '6', '6',
0, '0', '7', '0',
0, '0', '7', '5',
0, '0', '8', '0',
0, '0', '8', '4',
0, '0', '8', '9',
0, '0', '9', '4',
0, '0', '9', '9',
0, '1', '0', '3',
0, '1', '0', '8',
0, '1', '1', '3',
0, '1', '1', '7',
0, '1', '2', '2',
0, '1', '2', '7',
0, '1', '3', '1',
0, '1', '3', '6',
0, '1', '4', '1',
0, '1', '4', '5',
0, '1', '5', '0',
0, '1', '5', '5',
0, '1', '6', '0',
0, '1', '6', '4',
0, '1', '6', '9',
0, '1', '7', '4',
0, '1', '7', '8',
0, '1', '8', '3',
0, '1', '8', '8',
0, '1', '9', '2',
0, '1', '9', '7',
0, '2', '0', '2',
0, '2', '0', '6',
0, '2', '1', '1',
0, '2', '1', '6',
0, '2', '2', '1',
0, '2', '2', '5',
0, '2', '3', '0',
0, '2', '3', '5',
0, '2', '3', '9',
0, '2', '4', '4',
0, '2', '4', '9',
0, '2', '5', '3',
0, '2', '5', '8',
0, '2', '6', '3',
0, '2', '6', '7',
0, '2', '7', '2',
0, '2', '7', '7',
0, '2', '8', '2',
0, '2', '8', '6',
0, '2', '9', '1',
0, '2', '9', '6',
0, '3', '0', '0',
0, '3', '0', '5',
0, '3', '1', '0',
0, '3', '1', '4',
0, '3', '1', '9',
0, '3', '2', '4',
0, '3', '2', '8',
0, '3', '3', '3',
0, '3', '3', '8',
0, '3', '4', '3',
0, '3', '4', '7',
0, '3', '5', '2',
0, '3', '5', '7',
0, '3', '6', '1',
0, '3', '6', '6',
0, '3', '7', '1',
0, '3', '7', '5',
0, '3', '8', '0',
0, '3', '8', '5',
0, '3', '8', '9',
0, '3', '9', '4',
0, '3', '9', '9',
0, '4', '0', '4',
0, '4', '0', '8',
0, '4', '1', '3',
0, '4', '1', '8',
0, '4', '2', '2',
0, '4', '2', '7',
0, '4', '3', '2',
0, '4', '3', '6',
0, '4', '4', '1',
0, '4', '4', '6',
0, '4', '5', '0',
0, '4', '5', '5',
0, '4', '6', '0',
0, '4', '6', '5',
0, '4', '6', '9',
0, '4', '7', '4',
0, '4', '7', '9',
0, '4', '8', '3',
0, '4', '8', '8',
0, '4', '9', '3',
0, '4', '9', '7',
0, '5', '0', '2',
0, '5', '0', '7',
0, '5', '1', '1',
0, '5', '1', '6',
0, '5', '2', '1',
0, '5', '2', '6',
0, '5', '3', '0',
0, '5', '3', '5',
0, '5', '4', '0',
0, '5', '4', '4',
0, '5', '4', '9',
0, '5', '5', '4',
0, '5', '5', '8',
0, '5', '6', '3',
0, '5', '6', '8',
0, '5', '7', '2',
0, '5', '7', '7',
0, '5', '8', '2',
0, '5', '8', '7',
0, '5', '9', '1',
0, '5', '9', '6',
0, '6', '0', '1',
0, '6', '0', '5',
0, '6', '1', '0',
0, '6', '1', '5',
0, '6', '1', '9',
0, '6', '2', '4',
0, '6', '2', '9',
0, '6', '3', '3',
0, '6', '3', '8',
0, '6', '4', '3',
0, '6', '4', '8',
0, '6', '5', '2',
0, '6', '5', '7',
0, '6', '6', '2',
0, '6', '6', '6',
0, '6', '7', '1',
0, '6', '7', '6',
0, '6', '8', '0',
0, '6', '8', '5',
0, '6', '9', '0',
0, '6', '9', '4',
0, '6', '9', '9',
0, '7', '0', '4',
0, '7', '0', '9',
0, '7', '1', '3',
0, '7', '1', '8',
0, '7', '2', '3',
0, '7', '2', '7',
0, '7', '3', '2',
0, '7', '3', '7',
0, '7', '4', '1',
0, '7', '4', '6',
0, '7', '5', '1',
0, '7', '5', '5',
0, '7', '6', '0',
0, '7', '6', '5',
0, '7', '7', '0',
0, '7', '7', '4',
0, '7', '7', '9',
0, '7', '8', '4',
0, '7', '8', '8',
0, '7', '9', '3',
0, '7', '9', '8',
0, '8', '0', '2',
0, '8', '0', '7',
0, '8', '1', '2',
0, '8', '1', '6',
0, '8', '2', '1',
0, '8', '2', '6',
0, '8', '3', '0',
0, '8', '3', '5',
0, '8', '4', '0',
0, '8', '4', '5',
0, '8', '4', '9',
0, '8', '5', '4',
0, '8', '5', '9',
0, '8', '6', '3',
0, '8', '6', '8',
0, '8', '7', '3',
0, '8', '7', '7',
0, '8', '8', '2',
0, '8', '8', '7',
0, '8', '9', '1',
0, '8', '9', '6',
0, '9', '0', '1',
0, '9', '0', '6',
0, '9', '1', '0',
0, '9', '1', '5',
0, '9', '2', '0',
0, '9', '2', '4',
0, '9', '2', '9',
0, '9', '3', '4',
0, '9', '3', '8',
0, '9', '4', '3',
0, '9', '4', '8',
0, '9', '5', '2',
0, '9', '5', '7',
0, '9', '6', '2',
0, '9', '6', '7',
0, '9', '7', '1',
0, '9', '7', '6',
0, '9', '8', '1',
0, '9', '8', '5',
0, '9', '9', '0',
0, '9', '9', '5',
0, '9', '9', '9',
'1', '0', '0', '4',
'1', '0', '0', '9',
'1', '0', '1', '3',
'1', '0', '1', '8',
'1', '0', '2', '3',
'1', '0', '2', '8',
'1', '0', '3', '2',
'1', '0', '3', '7',
'1', '0', '4', '2',
'1', '0', '4', '6',
'1', '0', '5', '1',
'1', '0', '5', '6',
'1', '0', '6', '0',
'1', '0', '6', '5',
'1', '0', '7', '0',
'1', '0', '7', '4',
'1', '0', '7', '9',
'1', '0', '8', '4',
'1', '0', '8', '9',
'1', '0', '9', '3',
'1', '0', '9', '8',
'1', '1', '0', '3',
'1', '1', '0', '7',
'1', '1', '1', '2',
'1', '1', '1', '7',
'1', '1', '2', '1',
'1', '1', '2', '6',
'1', '1', '3', '1',
'1', '1', '3', '5',
'1', '1', '4', '0',
'1', '1', '4', '5',
'1', '1', '5', '0',
'1', '1', '5', '4',
'1', '1', '5', '9',
'1', '1', '6', '4',
'1', '1', '6', '8',
'1', '1', '7', '3',
'1', '1', '7', '8',
'1', '1', '8', '2',
'1', '1', '8', '7',
'1', '1', '9', '2',
'1', '1', '9', '6',
'1', '2', '0', '1',
'1', '2', '0', '6',
'1', '2', '1', '1',
'1', '2', '1', '5',
'1', '2', '2', '0',
'1', '2', '2', '5',
'1', '2', '2', '9',
'1', '2', '3', '4',
'1', '2', '3', '9',
'1', '2', '4', '3',
'1', '2', '4', '8',
'1', '2', '5', '3',
'1', '2', '5', '7',
'1', '2', '6', '2',
'1', '2', '6', '7',
'1', '2', '7', '2',
'1', '2', '7', '6',
'1', '2', '8', '1',
'1', '2', '8', '6',
'1', '2', '9', '0',
'1', '2', '9', '5',
'1', '3', '0', '0',
'1', '3', '0', '4',
'1', '3', '0', '9',
'1', '3', '1', '4',
'1', '3', '1', '8',
'1', '3', '2', '3',
'1', '3', '2', '8',
'1', '3', '3', '3',
'1', '3', '3', '7',
'1', '3', '4', '2',
'1', '3', '4', '7',
'1', '3', '5', '1',
'1', '3', '5', '6',
'1', '3', '6', '1',
'1', '3', '6', '5',
'1', '3', '7', '0',
'1', '3', '7', '5',
'1', '3', '7', '9',
'1', '3', '8', '4',
'1', '3', '8', '9',
'1', '3', '9', '4',
'1', '3', '9', '8',
'1', '4', '0', '3',
'1', '4', '0', '8',
'1', '4', '1', '2',
'1', '4', '1', '7',
'1', '4', '2', '2',
'1', '4', '2', '6',
'1', '4', '3', '1',
'1', '4', '3', '6',
'1', '4', '4', '0',
'1', '4', '4', '5',
'1', '4', '5', '0',
'1', '4', '5', '5',
'1', '4', '5', '9',
'1', '4', '6', '4',
'1', '4', '6', '9',
'1', '4', '7', '3',
'1', '4', '7', '8',
'1', '4', '8', '3',
'1', '4', '8', '7',
'1', '4', '9', '2',
'1', '4', '9', '7',
'1', '5', '0', '1',
'1', '5', '0', '6',
'1', '5', '1', '1',
'1', '5', '1', '6',
'1', '5', '2', '0',
'1', '5', '2', '5',
'1', '5', '3', '0',
'1', '5', '3', '4',
'1', '5', '3', '9',
'1', '5', '4', '4',
'1', '5', '4', '8',
'1', '5', '5', '3',
'1', '5', '5', '8',
'1', '5', '6', '2',
'1', '5', '6', '7',
'1', '5', '7', '2',
'1', '5', '7', '7',
'1', '5', '8', '1',
'1', '5', '8', '6',
'1', '5', '9', '1',
'1', '5', '9', '5',
'1', '6', '0', '0',
'1', '6', '0', '5',
'1', '6', '0', '9',
'1', '6', '1', '4',
'1', '6', '1', '9',
'1', '6', '2', '3',
'1', '6', '2', '8',
'1', '6', '3', '3',
'1', '6', '3', '8',
'1', '6', '4', '2',
'1', '6', '4', '7',
'1', '6', '5', '2',
'1', '6', '5', '6',
'1', '6', '6', '1',
'1', '6', '6', '6',
'1', '6', '7', '0',
'1', '6', '7', '5',
'1', '6', '8', '0',
'1', '6', '8', '4',
'1', '6', '8', '9',
'1', '6', '9', '4',
'1', '6', '9', '9',
'1', '7', '0', '3',
'1', '7', '0', '8',
'1', '7', '1', '3',
'1', '7', '1', '7',
'1', '7', '2', '2',
'1', '7', '2', '7',
'1', '7', '3', '1',
'1', '7', '3', '6',
'1', '7', '4', '1',
'1', '7', '4', '5',
'1', '7', '5', '0',
'1', '7', '5', '5',
'1', '7', '6', '0',
'1', '7', '6', '4',
'1', '7', '6', '9',
'1', '7', '7', '4',
'1', '7', '7', '8',
'1', '7', '8', '3',
'1', '7', '8', '8',
'1', '7', '9', '2',
'1', '7', '9', '7',
'1', '8', '0', '2',
'1', '8', '0', '6',
'1', '8', '1', '1',
'1', '8', '1', '6',
'1', '8', '2', '1',
'1', '8', '2', '5',
'1', '8', '3', '0',
'1', '8', '3', '5',
'1', '8', '3', '9',
'1', '8', '4', '4',
'1', '8', '4', '9',
'1', '8', '5', '3',
'1', '8', '5', '8',
'1', '8', '6', '3',
'1', '8', '6', '7',
'1', '8', '7', '2',
'1', '8', '7', '7',
'1', '8', '8', '2',
'1', '8', '8', '6',
'1', '8', '9', '1',
'1', '8', '9', '6',
'1', '9', '0', '0',
'1', '9', '0', '5',
'1', '9', '1', '0',
'1', '9', '1', '4',
'1', '9', '1', '9',
'1', '9', '2', '4',
'1', '9', '2', '8',
'1', '9', '3', '3',
'1', '9', '3', '8',
'1', '9', '4', '3',
'1', '9', '4', '7',
'1', '9', '5', '2',
'1', '9', '5', '7',
'1', '9', '6', '1',
'1', '9', '6', '6',
'1', '9', '7', '1',
'1', '9', '7', '5',
'1', '9', '8', '0',
'1', '9', '8', '5',
'1', '9', '8', '9',
'1', '9', '9', '4',
'1', '9', '9', '9',
'2', '0', '0', '4',
'2', '0', '0', '8',
'2', '0', '1', '3',
'2', '0', '1', '8',
'2', '0', '2', '2',
'2', '0', '2', '7',
'2', '0', '3', '2',
'2', '0', '3', '6',
'2', '0', '4', '1',
'2', '0', '4', '6',
'2', '0', '5', '0',
'2', '0', '5', '5',
'2', '0', '6', '0',
'2', '0', '6', '5',
'2', '0', '6', '9',
'2', '0', '7', '4',
'2', '0', '7', '9',
'2', '0', '8', '3',
'2', '0', '8', '8',
'2', '0', '9', '3',
'2', '0', '9', '7',
'2', '1', '0', '2',
'2', '1', '0', '7',
'2', '1', '1', '1',
'2', '1', '1', '6',
'2', '1', '2', '1',
'2', '1', '2', '6',
'2', '1', '3', '0',
'2', '1', '3', '5',
'2', '1', '4', '0',
'2', '1', '4', '4',
'2', '1', '4', '9',
'2', '1', '5', '4',
'2', '1', '5', '8',
'2', '1', '6', '3',
'2', '1', '6', '8',
'2', '1', '7', '2',
'2', '1', '7', '7',
'2', '1', '8', '2',
'2', '1', '8', '7',
'2', '1', '9', '1',
'2', '1', '9', '6',
'2', '2', '0', '1',
'2', '2', '0', '5',
'2', '2', '1', '0',
'2', '2', '1', '5',
'2', '2', '1', '9',
'2', '2', '2', '4',
'2', '2', '2', '9',
'2', '2', '3', '3',
'2', '2', '3', '8',
'2', '2', '4', '3',
'2', '2', '4', '8',
'2', '2', '5', '2',
'2', '2', '5', '7',
'2', '2', '6', '2',
'2', '2', '6', '6',
'2', '2', '7', '1',
'2', '2', '7', '6',
'2', '2', '8', '0',
'2', '2', '8', '5',
'2', '2', '9', '0',
'2', '2', '9', '4',
'2', '2', '9', '9',
'2', '3', '0', '4',
'2', '3', '0', '9',
'2', '3', '1', '3',
'2', '3', '1', '8',
'2', '3', '2', '3',
'2', '3', '2', '7',
'2', '3', '3', '2',
'2', '3', '3', '7',
'2', '3', '4', '1',
'2', '3', '4', '6',
'2', '3', '5', '1',
'2', '3', '5', '5',
'2', '3', '6', '0',
'2', '3', '6', '5',
'2', '3', '7', '0',
'2', '3', '7', '4',
'2', '3', '7', '9',
'2', '3', '8', '4',
'2', '3', '8', '8',
'2', '3', '9', '3',
'2', '3', '9', '8',
'2', '4', '0', '2',
'2', '4', '0', '7',
'2', '4', '1', '2',
'2', '4', '1', '6',
'2', '4', '2', '1',
'2', '4', '2', '6',
'2', '4', '3', '0',
'2', '4', '3', '5',
'2', '4', '4', '0',
'2', '4', '4', '5',
'2', '4', '4', '9',
'2', '4', '5', '4',
'2', '4', '5', '9',
'2', '4', '6', '3',
'2', '4', '6', '8',
'2', '4', '7', '3',
'2', '4', '7', '7',
'2', '4', '8', '2',
'2', '4', '8', '7',
'2', '4', '9', '1',
'2', '4', '9', '6',
'2', '5', '0', '1',
'2', '5', '0', '6',
'2', '5', '1', '0',
'2', '5', '1', '5',
'2', '5', '2', '0',
'2', '5', '2', '4',
'2', '5', '2', '9',
'2', '5', '3', '4',
'2', '5', '3', '8',
'2', '5', '4', '3',
'2', '5', '4', '8',
'2', '5', '5', '2',
'2', '5', '5', '7',
'2', '5', '6', '2',
'2', '5', '6', '7',
'2', '5', '7', '1',
'2', '5', '7', '6',
'2', '5', '8', '1',
'2', '5', '8', '5',
'2', '5', '9', '0',
'2', '5', '9', '5',
'2', '5', '9', '9',
'2', '6', '0', '4',
'2', '6', '0', '9',
'2', '6', '1', '3',
'2', '6', '1', '8',
'2', '6', '2', '3',
'2', '6', '2', '8',
'2', '6', '3', '2',
'2', '6', '3', '7',
'2', '6', '4', '2',
'2', '6', '4', '6',
'2', '6', '5', '1',
'2', '6', '5', '6',
'2', '6', '6', '0',
'2', '6', '6', '5',
'2', '6', '7', '0',
'2', '6', '7', '4',
'2', '6', '7', '9',
'2', '6', '8', '4',
'2', '6', '8', '9',
'2', '6', '9', '3',
'2', '6', '9', '8',
'2', '7', '0', '3',
'2', '7', '0', '7',
'2', '7', '1', '2',
'2', '7', '1', '7',
'2', '7', '2', '1',
'2', '7', '2', '6',
'2', '7', '3', '1',
'2', '7', '3', '5',
'2', '7', '4', '0',
'2', '7', '4', '5',
'2', '7', '5', '0',
'2', '7', '5', '4',
'2', '7', '5', '9',
'2', '7', '6', '4',
'2', '7', '6', '8',
'2', '7', '7', '3',
'2', '7', '7', '8',
'2', '7', '8', '2',
'2', '7', '8', '7',
'2', '7', '9', '2',
'2', '7', '9', '6',
'2', '8', '0', '1',
'2', '8', '0', '6',
'2', '8', '1', '1',
'2', '8', '1', '5',
'2', '8', '2', '0',
'2', '8', '2', '5',
'2', '8', '2', '9',
'2', '8', '3', '4',
'2', '8', '3', '9',
'2', '8', '4', '3',
'2', '8', '4', '8',
'2', '8', '5', '3',
'2', '8', '5', '7',
'2', '8', '6', '2',
'2', '8', '6', '7',
'2', '8', '7', '2',
'2', '8', '7', '6',
'2', '8', '8', '1',
'2', '8', '8', '6',
'2', '8', '9', '0',
'2', '8', '9', '5',
'2', '9', '0', '0',
'2', '9', '0', '4',
'2', '9', '0', '9',
'2', '9', '1', '4',
'2', '9', '1', '8',
'2', '9', '2', '3',
'2', '9', '2', '8',
'2', '9', '3', '3',
'2', '9', '3', '7',
'2', '9', '4', '2',
'2', '9', '4', '7',
'2', '9', '5', '1',
'2', '9', '5', '6',
'2', '9', '6', '1',
'2', '9', '6', '5',
'2', '9', '7', '0',
'2', '9', '7', '5',
'2', '9', '7', '9',
'2', '9', '8', '4',
'2', '9', '8', '9',
'2', '9', '9', '4',
'2', '9', '9', '8',
'3', '0', '0', '3',
'3', '0', '0', '8',
'3', '0', '1', '2',
'3', '0', '1', '7',
'3', '0', '2', '2',
'3', '0', '2', '6',
'3', '0', '3', '1',
'3', '0', '3', '6',
'3', '0', '4', '0',
'3', '0', '4', '5',
'3', '0', '5', '0',
'3', '0', '5', '5',
'3', '0', '5', '9',
'3', '0', '6', '4',
'3', '0', '6', '9',
'3', '0', '7', '3',
'3', '0', '7', '8',
'3', '0', '8', '3',
'3', '0', '8', '7',
'3', '0', '9', '2',
'3', '0', '9', '7',
'3', '1', '0', '1',
'3', '1', '0', '6',
'3', '1', '1', '1',
'3', '1', '1', '6',
'3', '1', '2', '0',
'3', '1', '2', '5',
'3', '1', '3', '0',
'3', '1', '3', '4',
'3', '1', '3', '9',
'3', '1', '4', '4',
'3', '1', '4', '8',
'3', '1', '5', '3',
'3', '1', '5', '8',
'3', '1', '6', '2',
'3', '1', '6', '7',
'3', '1', '7', '2',
'3', '1', '7', '7',
'3', '1', '8', '1',
'3', '1', '8', '6',
'3', '1', '9', '1',
'3', '1', '9', '5',
'3', '2', '0', '0',
'3', '2', '0', '5',
'3', '2', '0', '9',
'3', '2', '1', '4',
'3', '2', '1', '9',
'3', '2', '2', '3',
'3', '2', '2', '8',
'3', '2', '3', '3',
'3', '2', '3', '8',
'3', '2', '4', '2',
'3', '2', '4', '7',
'3', '2', '5', '2',
'3', '2', '5', '6',
'3', '2', '6', '1',
'3', '2', '6', '6',
'3', '2', '7', '0',
'3', '2', '7', '5',
'3', '2', '8', '0',
'3', '2', '8', '4',
'3', '2', '8', '9',
'3', '2', '9', '4',
'3', '2', '9', '9',
'3', '3', '0', '3',
'3', '3', '0', '8',
'3', '3', '1', '3',
'3', '3', '1', '7',
'3', '3', '2', '2',
'3', '3', '2', '7',
'3', '3', '3', '1',
'3', '3', '3', '6',
'3', '3', '4', '1',
'3', '3', '4', '5',
'3', '3', '5', '0',
'3', '3', '5', '5',
'3', '3', '6', '0',
'3', '3', '6', '4',
'3', '3', '6', '9',
'3', '3', '7', '4',
'3', '3', '7', '8',
'3', '3', '8', '3',
'3', '3', '8', '8',
'3', '3', '9', '2',
'3', '3', '9', '7',
'3', '4', '0', '2',
'3', '4', '0', '6',
'3', '4', '1', '1',
'3', '4', '1', '6',
'3', '4', '2', '1',
'3', '4', '2', '5',
'3', '4', '3', '0',
'3', '4', '3', '5',
'3', '4', '3', '9',
'3', '4', '4', '4',
'3', '4', '4', '9',
'3', '4', '5', '3',
'3', '4', '5', '8',
'3', '4', '6', '3',
'3', '4', '6', '7',
'3', '4', '7', '2',
'3', '4', '7', '7',
'3', '4', '8', '2',
'3', '4', '8', '6',
'3', '4', '9', '1',
'3', '4', '9', '6',
'3', '5', '0', '0',
'3', '5', '0', '5',
'3', '5', '1', '0',
'3', '5', '1', '4',
'3', '5', '1', '9',
'3', '5', '2', '4',
'3', '5', '2', '8',
'3', '5', '3', '3',
'3', '5', '3', '8',
'3', '5', '4', '3',
'3', '5', '4', '7',
'3', '5', '5', '2',
'3', '5', '5', '7',
'3', '5', '6', '1',
'3', '5', '6', '6',
'3', '5', '7', '1',
'3', '5', '7', '5',
'3', '5', '8', '0',
'3', '5', '8', '5',
'3', '5', '8', '9',
'3', '5', '9', '4',
'3', '5', '9', '9',
'3', '6', '0', '4',
'3', '6', '0', '8',
'3', '6', '1', '3',
'3', '6', '1', '8',
'3', '6', '2', '2',
'3', '6', '2', '7',
'3', '6', '3', '2',
'3', '6', '3', '6',
'3', '6', '4', '1',
'3', '6', '4', '6',
'3', '6', '5', '0',
'3', '6', '5', '5',
'3', '6', '6', '0',
'3', '6', '6', '5',
'3', '6', '6', '9',
'3', '6', '7', '4',
'3', '6', '7', '9',
'3', '6', '8', '3',
'3', '6', '8', '8',
'3', '6', '9', '3',
'3', '6', '9', '7',
'3', '7', '0', '2',
'3', '7', '0', '7',
'3', '7', '1', '1',
'3', '7', '1', '6',
'3', '7', '2', '1',
'3', '7', '2', '6',
'3', '7', '3', '0',
'3', '7', '3', '5',
'3', '7', '4', '0',
'3', '7', '4', '4',
'3', '7', '4', '9',
'3', '7', '5', '4',
'3', '7', '5', '8',
'3', '7', '6', '3',
'3', '7', '6', '8',
'3', '7', '7', '2',
'3', '7', '7', '7',
'3', '7', '8', '2',
'3', '7', '8', '7',
'3', '7', '9', '1',
'3', '7', '9', '6',
'3', '8', '0', '1',
'3', '8', '0', '5',
'3', '8', '1', '0',
'3', '8', '1', '5',
'3', '8', '1', '9',
'3', '8', '2', '4',
'3', '8', '2', '9',
'3', '8', '3', '3',
'3', '8', '3', '8',
'3', '8', '4', '3',
'3', '8', '4', '8',
'3', '8', '5', '2',
'3', '8', '5', '7',
'3', '8', '6', '2',
'3', '8', '6', '6',
'3', '8', '7', '1',
'3', '8', '7', '6',
'3', '8', '8', '0',
'3', '8', '8', '5',
'3', '8', '9', '0',
'3', '8', '9', '4',
'3', '8', '9', '9',
'3', '9', '0', '4',
'3', '9', '0', '9',
'3', '9', '1', '3',
'3', '9', '1', '8',
'3', '9', '2', '3',
'3', '9', '2', '7',
'3', '9', '3', '2',
'3', '9', '3', '7',
'3', '9', '4', '1',
'3', '9', '4', '6',
'3', '9', '5', '1',
'3', '9', '5', '5',
'3', '9', '6', '0',
'3', '9', '6', '5',
'3', '9', '7', '0',
'3', '9', '7', '4',
'3', '9', '7', '9',
'3', '9', '8', '4',
'3', '9', '8', '8',
'3', '9', '9', '3',
'3', '9', '9', '8',
'4', '0', '0', '2',
'4', '0', '0', '7',
'4', '0', '1', '2',
'4', '0', '1', '6',
'4', '0', '2', '1',
'4', '0', '2', '6',
'4', '0', '3', '0',
'4', '0', '3', '5',
'4', '0', '4', '0',
'4', '0', '4', '5',
'4', '0', '4', '9',
'4', '0', '5', '4',
'4', '0', '5', '9',
'4', '0', '6', '3',
'4', '0', '6', '8',
'4', '0', '7', '3',
'4', '0', '7', '7',
'4', '0', '8', '2',
'4', '0', '8', '7',
'4', '0', '9', '1',
'4', '0', '9', '6',
'4', '1', '0', '1',
'4', '1', '0', '6',
'4', '1', '1', '0',
'4', '1', '1', '5',
'4', '1', '2', '0',
'4', '1', '2', '4',
'4', '1', '2', '9',
'4', '1', '3', '4',
'4', '1', '3', '8',
'4', '1', '4', '3',
'4', '1', '4', '8',
'4', '1', '5', '2',
'4', '1', '5', '7',
'4', '1', '6', '2',
'4', '1', '6', '7',
'4', '1', '7', '1',
'4', '1', '7', '6',
'4', '1', '8', '1',
'4', '1', '8', '5',
'4', '1', '9', '0',
'4', '1', '9', '5',
'4', '1', '9', '9',
'4', '2', '0', '4',
'4', '2', '0', '9',
'4', '2', '1', '3',
'4', '2', '1', '8',
'4', '2', '2', '3',
'4', '2', '2', '8',
'4', '2', '3', '2',
'4', '2', '3', '7',
'4', '2', '4', '2',
'4', '2', '4', '6',
'4', '2', '5', '1',
'4', '2', '5', '6',
'4', '2', '6', '0',
'4', '2', '6', '5',
'4', '2', '7', '0',
'4', '2', '7', '4',
'4', '2', '7', '9',
'4', '2', '8', '4',
'4', '2', '8', '9',
'4', '2', '9', '3',
'4', '2', '9', '8',
'4', '3', '0', '3',
'4', '3', '0', '7',
'4', '3', '1', '2',
'4', '3', '1', '7',
'4', '3', '2', '1',
'4', '3', '2', '6',
'4', '3', '3', '1',
'4', '3', '3', '5',
'4', '3', '4', '0',
'4', '3', '4', '5',
'4', '3', '5', '0',
'4', '3', '5', '4',
'4', '3', '5', '9',
'4', '3', '6', '4',
'4', '3', '6', '8',
'4', '3', '7', '3',
'4', '3', '7', '8',
'4', '3', '8', '2',
'4', '3', '8', '7',
'4', '3', '9', '2',
'4', '3', '9', '6',
'4', '4', '0', '1',
'4', '4', '0', '6',
'4', '4', '1', '1',
'4', '4', '1', '5',
'4', '4', '2', '0',
'4', '4', '2', '5',
'4', '4', '2', '9',
'4', '4', '3', '4',
'4', '4', '3', '9',
'4', '4', '4', '3',
'4', '4', '4', '8',
'4', '4', '5', '3',
'4', '4', '5', '7',
'4', '4', '6', '2',
'4', '4', '6', '7',
'4', '4', '7', '2',
'4', '4', '7', '6',
'4', '4', '8', '1',
'4', '4', '8', '6',
'4', '4', '9', '0',
'4', '4', '9', '5',
'4', '5', '0', '0',
'4', '5', '0', '4',
'4', '5', '0', '9',
'4', '5', '1', '4',
'4', '5', '1', '8',
'4', '5', '2', '3',
'4', '5', '2', '8',
'4', '5', '3', '3',
'4', '5', '3', '7',
'4', '5', '4', '2',
'4', '5', '4', '7',
'4', '5', '5', '1',
'4', '5', '5', '6',
'4', '5', '6', '1',
'4', '5', '6', '5',
'4', '5', '7', '0',
'4', '5', '7', '5',
'4', '5', '7', '9',
'4', '5', '8', '4',
'4', '5', '8', '9',
'4', '5', '9', '4',
'4', '5', '9', '8',
'4', '6', '0', '3',
'4', '6', '0', '8',
'4', '6', '1', '2',
'4', '6', '1', '7',
'4', '6', '2', '2',
'4', '6', '2', '6',
'4', '6', '3', '1',
'4', '6', '3', '6',
'4', '6', '4', '0',
'4', '6', '4', '5',
'4', '6', '5', '0',
'4', '6', '5', '5',
'4', '6', '5', '9',
'4', '6', '6', '4',
'4', '6', '6', '9',
'4', '6', '7', '3',
'4', '6', '7', '8',
'4', '6', '8', '3',
'4', '6', '8', '7',
'4', '6', '9', '2',
'4', '6', '9', '7',
'4', '7', '0', '1',
'4', '7', '0', '6',
'4', '7', '1', '1',
'4', '7', '1', '6',
'4', '7', '2', '0',
'4', '7', '2', '5',
'4', '7', '3', '0',
'4', '7', '3', '4',
'4', '7', '3', '9',
'4', '7', '4', '4',
'4', '7', '4', '8',
'4', '7', '5', '3',
'4', '7', '5', '8',
'4', '7', '6', '2',
'4', '7', '6', '7',
'4', '7', '7', '2',
'4', '7', '7', '7',
'4', '7', '8', '1',
'4', '7', '8', '6',
'4', '7', '9', '1',
'4', '7', '9', '5',
'4', '8', '0', '0',
};
...@@ -5,18 +5,34 @@ ...@@ -5,18 +5,34 @@
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
FILE *File = fopen("adc_vtable.ino", "w"); FILE *File = fopen("adc_vtable.ino", "w");
printf("Enter max voltage\n"); double Max1, Max10;
double Max; printf("Enter 1x max voltage\n");
scanf("%lf", &Max); scanf("%lf", &Max1);
printf("Enter 10x max voltage\n");
scanf("%lf", &Max10);
fprintf(File, "const char FLASH_VoltageTable[1024 * 3] PROGMEM =\n"); fprintf(File, "const char FLASH_VoltageTable1x[1024 * 3] PROGMEM =\n");
fprintf(File, "{\n"); fprintf(File, "{\n");
for(int i = 0; i < 1024; i++) for(int i = 0; i < 1024; i++)
{ {
char Buf[16]; char Buf[16];
sprintf(Buf, "%.02f", ((double)i / 1023.0) * Max); sprintf(Buf, "%.02f", ((double)i / 1023.0) * Max1);
fprintf(File, "\t'%c', '%c', '%c',\n", Buf[0], Buf[2], Buf[3]); fprintf(File, "\t'%c', '%c', '%c',\n", Buf[0], Buf[2], Buf[3]);
} }
fprintf(File, "};\n\n");
fprintf(File, "const char FLASH_VoltageTable10x[1024 * 4] PROGMEM =\n");
fprintf(File, "{\n");
for(int i = 0; i < 1024; i++)
{
char Buf[16];
sprintf(Buf, "%.02f", ((double)i / 1023.0) * Max10);
size_t Length = strlen(Buf);
if(Length == 4)
fprintf(File, "\t0, '%c', '%c', '%c',\n", Buf[0], Buf[2], Buf[3]);
else if(Length == 5)
fprintf(File, "\t'%c', '%c', '%c', '%c',\n", Buf[0], Buf[1], Buf[3], Buf[4]);
}
fprintf(File, "};\n"); fprintf(File, "};\n");
return 0; return 0;
......
/* Configuration options */
// Cursor values in format xx.x
#define CURSOR_1 "5.0"
#define CURSOR_2 "0.0"
// Voltage warning limits (indexes for FLASH_VoltageTable10x)
#define LIMIT_5V 107
#define LIMIT_10V 214
#define LIMIT_30V 640
// Range auto adjust thresholds (indexes for FLASH_VoltageTable1x/10x)
#define AUTO_ADJ_MAX_4_8V 958 // 4.5 V
#define AUTO_ADJ_MIN_48V 96 // 4.5 V
// Delay before changing from 48 V to 4.8 V range if voltage is below threshold
#define AUTO_ADJ_DELAY_MS 2500
// Uncomment to disable 48 V range
//#define NO_AUTO_ADJ
// Uncomment to run in oneshot mode
//#define ONESHOT_MODE
// Period to measure in
#define ONESHOT_PERIOD PERIOD_1MS
// How many points to measure before stopping (Serial Monitor display is 49 points wide)
#define ONESHOT_POINTS 49
/* Defines */
#define PIN_BUTTON_1 5 // BUTTON_RANGE_DN #define PIN_BUTTON_1 5 // BUTTON_RANGE_DN
#define PIN_BUTTON_2 4 // BUTTON_RANGE_UP #define PIN_BUTTON_2 4 // BUTTON_RANGE_UP
#define PIN_BUTTON_3 3 // BUTTON_FREQ #define PIN_BUTTON_3 3 // BUTTON_FREQ
#define PIN_BUTTON_4 2 // BUTTON_SHUTDOWN #define PIN_BUTTON_4 2 // BUTTON_SHUTDOWN
#define PIN_LED 6
#define PIN_RANGE_ADJUST 7
#define PIN_BEEPER 8
#define PIN_ADC 7 // A7 #define PIN_ADC 7 // A7
#define BUTTON_RANGE_DN 0 #define BUTTON_RANGE_DN 0
...@@ -16,16 +42,9 @@ ...@@ -16,16 +42,9 @@
#define PERIOD_100MS 4 #define PERIOD_100MS 4
#define PERIOD_1S 5 #define PERIOD_1S 5
/* Configuration options */ #define RANGE_5V 0
// Cursor values in format xx.x #define RANGE_10V 1
#define CURSOR_1 "5.0" #define RANGE_30V 2
#define CURSOR_2 "0.0"
// Uncomment to run in oneshot mode
//#define ONESHOT_MODE
// Period to measure in
#define ONESHOT_PERIOD PERIOD_1MS
// How many points to measure before stopping (Serial Monitor display is 49 points wide)
#define ONESHOT_POINTS 49
// https://www.gammon.com.au/adc // https://www.gammon.com.au/adc
...@@ -36,6 +55,18 @@ char G_MeasureFreq; ...@@ -36,6 +55,18 @@ char G_MeasureFreq;
char G_TimeCounter; char G_TimeCounter;
#define TIME_L_VALUE '0' #define TIME_L_VALUE '0'
#define TIME_H_VALUE "0.5" #define TIME_H_VALUE "0.5"
char G_Warning;
#define BLINK_PERIOD_US 100000 // 0.1s
#define BEEP_PERIOD_US 562 // 1780 Hz
unsigned long G_BlinkTime;
unsigned long G_BeepTime;
char G_BlinkState;
char G_BeepState;
short G_MaxVoltage;
#define RANGE_4_8V 0
#define RANGE_48V 1
char G_Range;
unsigned long G_AutoAdjTime;
#ifdef ONESHOT_MODE #ifdef ONESHOT_MODE
int G_OneshotPoints; int G_OneshotPoints;
#endif #endif
...@@ -46,7 +77,8 @@ int G_PrevButtonState[4]; ...@@ -46,7 +77,8 @@ int G_PrevButtonState[4];
#define DEBOUNCE_DELAY_MS 25 #define DEBOUNCE_DELAY_MS 25
/* Flash data */ /* Flash data */
extern const char FLASH_VoltageTable[1024 * 3] PROGMEM; extern const char FLASH_VoltageTable1x[1024 * 3] PROGMEM;
extern const char FLASH_VoltageTable10x[1024 * 4] PROGMEM;
byte ReadButton(int Button) byte ReadButton(int Button)
{ {
...@@ -73,23 +105,15 @@ void Stop() ...@@ -73,23 +105,15 @@ void Stop()
TCCR1A = 0; TCCR1A = 0;
TCCR1B = 0; // Stop the timer TCCR1B = 0; // Stop the timer
Serial.end(); Serial.end();
Serial.begin(9600);
ADCSRA = bit(ADEN); ADCSRA = bit(ADEN);
ADCSRA |= bit(ADPS2) | bit(ADPS1) | bit(ADPS0); // Prescaler 128 ADCSRA |= bit(ADPS2) | bit(ADPS1) | bit(ADPS0); // Prescaler 128
ADMUX = bit(REFS0) | PIN_ADC; ADMUX = bit(REFS0) | PIN_ADC;
ADCSRB = bit(ADTS0); ADCSRB = bit(ADTS0);
digitalWrite(PIN_LED, HIGH);
for(;;) {} for(;;) {}
} }
// Error occured, light the onboard LED and stop the program
void Error()
{
cli();
digitalWrite(LED_BUILTIN, HIGH);
for(;;) {}
}
// Set up the ADC registers // Set up the ADC registers
void InitADC() void InitADC()
{ {
...@@ -107,7 +131,7 @@ void SetTimerPeriod(int Period) ...@@ -107,7 +131,7 @@ void SetTimerPeriod(int Period)
TCCR1A = 0; TCCR1A = 0;
TCCR1B = 0; // Reset TCCR TCCR1B = 0; // Reset TCCR
TCNT0 = 0; // Reset the counter TCNT0 = 0; // Reset the counter
// http://www.8bit-era.cz/arduino-timer-interrupts-calculator.html // http://www.8bit-era.cz/arduino-timer-interrupts-calculator.html
switch(Period) switch(Period)
{ {
...@@ -145,7 +169,7 @@ void SetTimerPeriod(int Period) ...@@ -145,7 +169,7 @@ void SetTimerPeriod(int Period)
{ {
Serial.print("SetTimerPeriod: Invalid period "); Serial.print("SetTimerPeriod: Invalid period ");
Serial.println(Period); Serial.println(Period);
Error(); Stop();
} break; } break;
} }
...@@ -163,13 +187,45 @@ ISR(ADC_vect) ...@@ -163,13 +187,45 @@ ISR(ADC_vect)
//unsigned long tstart = micros(); //unsigned long tstart = micros();
//Serial.println((ADC / 1023.0) * 4.8); //Serial.println((ADC / 1023.0) * 4.8);
volatile unsigned int Value = ADC; // Read the ADC
Serial.write(G_CursorBuf); Serial.write(G_CursorBuf);
volatile unsigned int Value = ADC; if(G_Range == RANGE_4_8V)
int P = Value * 3; {
Serial.write(pgm_read_word_near(FLASH_VoltageTable + P + 0)); int P = Value * 3;
Serial.write('.'); Serial.write(pgm_read_byte_near(FLASH_VoltageTable1x + P + 0));
Serial.write(pgm_read_word_near(FLASH_VoltageTable + P + 1)); Serial.write('.');
Serial.write(pgm_read_word_near(FLASH_VoltageTable + P + 2)); Serial.write(pgm_read_byte_near(FLASH_VoltageTable1x + P + 1));
Serial.write(pgm_read_byte_near(FLASH_VoltageTable1x + P + 2));
#ifndef NO_AUTO_ADJ
if(Value >= AUTO_ADJ_MAX_4_8V)
{
// Go to 48 V range once voltage goes above threshold
G_Range = RANGE_48V;
digitalWrite(PIN_RANGE_ADJUST, HIGH);
G_AutoAdjTime = millis();
}
#endif
}
else
{
int P = Value * 4;
char Byte1 = pgm_read_byte_near(FLASH_VoltageTable10x + P + 0);
if(Byte1) Serial.write(Byte1);
Serial.write(pgm_read_byte_near(FLASH_VoltageTable10x + P + 1));
Serial.write('.');
Serial.write(pgm_read_byte_near(FLASH_VoltageTable10x + P + 2));
Serial.write(pgm_read_byte_near(FLASH_VoltageTable10x + P + 3));
// Voltage warning is checked in 48 V range
if(Value >= G_MaxVoltage)
G_Warning = 1;
else
G_Warning = 0;
if(Value > AUTO_ADJ_MIN_48V) G_AutoAdjTime = millis();
}
if(G_MeasureFreq != PERIOD_100US) if(G_MeasureFreq != PERIOD_100US)
{ {
Serial.write('\t'); Serial.write('\t');
...@@ -199,6 +255,13 @@ void setup() ...@@ -199,6 +255,13 @@ void setup()
pinMode(PIN_BUTTON_2, INPUT_PULLUP); pinMode(PIN_BUTTON_2, INPUT_PULLUP);
pinMode(PIN_BUTTON_3, INPUT_PULLUP); pinMode(PIN_BUTTON_3, INPUT_PULLUP);
pinMode(PIN_BUTTON_4, INPUT_PULLUP); pinMode(PIN_BUTTON_4, INPUT_PULLUP);
pinMode(PIN_LED, OUTPUT);
pinMode(PIN_RANGE_ADJUST, OUTPUT);
digitalWrite(PIN_RANGE_ADJUST, LOW);
G_Range = RANGE_4_8V;
digitalWrite(PIN_LED, LOW);
digitalWrite(PIN_BEEPER, LOW);
Serial.begin(2000000); Serial.begin(2000000);
#ifndef ONESHOT_MODE #ifndef ONESHOT_MODE
...@@ -217,23 +280,63 @@ void setup() ...@@ -217,23 +280,63 @@ void setup()
sprintf(G_CursorBuf, "%s\t%s\t", CURSOR_1, CURSOR_2); // Precalculate the cursor string sprintf(G_CursorBuf, "%s\t%s\t", CURSOR_1, CURSOR_2); // Precalculate the cursor string
G_TimeCounter = 10; G_TimeCounter = 10;
G_Warning = 0;
G_BlinkTime = 0;
G_BeepTime = 0;
G_BlinkState = LOW;
G_BeepState = LOW;
G_MaxVoltage = LIMIT_5V;
} }
int lstate = LOW; int lstate = LOW;
void loop() void loop()
{ {
if(G_Warning)
{
unsigned long Time = micros();
if(Time - G_BlinkTime >= BLINK_PERIOD_US)
{
if(G_BlinkState == LOW) G_BlinkState = HIGH;
else G_BlinkState = LOW;
digitalWrite(PIN_LED, G_BlinkState);
G_BlinkTime = Time;
}
Time = micros();
if(Time - G_BeepTime >= BEEP_PERIOD_US)
{
if(G_BeepState == LOW) G_BeepState = HIGH;
else G_BeepState = LOW;
digitalWrite(PIN_BEEPER, G_BeepState);
G_BeepTime = Time;
}
}
else if(G_BlinkState == HIGH)
{
G_BlinkState = LOW;
digitalWrite(PIN_LED, LOW);
}
if(G_Range == RANGE_48V)
{
if(millis() - G_AutoAdjTime >= AUTO_ADJ_DELAY_MS)
{
G_Range = RANGE_4_8V;
digitalWrite(PIN_RANGE_ADJUST, LOW);
}
}
if(ReadButton(BUTTON_RANGE_UP) == 1) if(ReadButton(BUTTON_RANGE_UP) == 1)
{ {
if(lstate == LOW) lstate = HIGH; if(G_MaxVoltage == LIMIT_5V) G_MaxVoltage = LIMIT_10V;
else lstate = LOW; else if(G_MaxVoltage == LIMIT_10V) G_MaxVoltage = LIMIT_30V;
digitalWrite(LED_BUILTIN, lstate);
} }
if(ReadButton(BUTTON_RANGE_DN) == 1) if(ReadButton(BUTTON_RANGE_DN) == 1)
{ {
if(lstate == LOW) lstate = HIGH; if(G_MaxVoltage == LIMIT_30V) G_MaxVoltage = LIMIT_10V;
else lstate = LOW; else if(G_MaxVoltage == LIMIT_10V) G_MaxVoltage = LIMIT_5V;
digitalWrite(LED_BUILTIN, lstate);
} }
if(ReadButton(BUTTON_FREQ) == 1) if(ReadButton(BUTTON_FREQ) == 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment