diff --git a/Development Resources/Images/Power.jpg b/Development Resources/Images/Power.jpg new file mode 100644 index 00000000..340b2bce Binary files /dev/null and b/Development Resources/Images/Power.jpg differ diff --git a/Translations/fontTables.py b/Translations/fontTables.py index cd6b83f4..ace27318 100755 --- a/Translations/fontTables.py +++ b/Translations/fontTables.py @@ -10,8 +10,6 @@ def getFontMap(): "&": "0x00,0x00,0x00,0xB8,0xFC,0xC6,0xE2,0x3E,0x1C,0x00,0x00,0x00,0x00,0x00,0x1F,0x3F,0x31,0x21,0x37,0x1E,0x1C,0x36,0x22,0x00,", "'": "0x00,0x00,0x00,0x00,0x27,0x3F,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,", "(": "0x00,0x00,0x00,0xF0,0xFC,0xFE,0x07,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0F,0x1F,0x38,0x20,0x20,0x00,0x00,0x00,", - "(": "0x00,0x00,0x00,0xF0,0xFC,0xFE,0x07,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0F,0x1F,0x38,0x20,0x20,0x00,0x00,0x00,", - ")": "0x00,0x00,0x00,0x01,0x01,0x07,0xFE,0xFC,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x38,0x1F,0x0F,0x03,0x00,0x00,0x00,", ")": "0x00,0x00,0x00,0x01,0x01,0x07,0xFE,0xFC,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x38,0x1F,0x0F,0x03,0x00,0x00,0x00,", "*": "0x00,0x00,0x98,0xB8,0xE0,0xF8,0xF8,0xE0,0xB8,0x98,0x00,0x00,0x00,0x00,0x0C,0x0E,0x03,0x0F,0x0F,0x03,0x0E,0x0C,0x00,0x00,", "+": "0x00,0x00,0x80,0x80,0x80,0xF0,0xF0,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x0F,0x0F,0x01,0x01,0x01,0x00,0x00,", @@ -23,7 +21,6 @@ def getFontMap(): "1": "0x00,0x00,0x00,0x0C,0x0C,0x0E,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x3F,0x3F,0x30,0x30,0x30,0x00,", "2": "0x00,0x1C,0x1E,0x07,0x03,0x03,0x83,0xC3,0xE3,0x77,0x3E,0x1C,0x00,0x30,0x38,0x3C,0x3E,0x37,0x33,0x31,0x30,0x30,0x30,0x30,", "3": "0x00,0x0C,0x0E,0x07,0xC3,0xC3,0xC3,0xC3,0xC3,0xE7,0x7E,0x3C,0x00,0x0C,0x1C,0x38,0x30,0x30,0x30,0x30,0x30,0x39,0x1F,0x0E,", - "З": "0x00,0x0C,0x0E,0x07,0xC3,0xC3,0xC3,0xC3,0xC3,0xE7,0x7E,0x3C,0x00,0x0C,0x1C,0x38,0x30,0x30,0x30,0x30,0x30,0x39,0x1F,0x0E,", "4": "0x00,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x07,0xFF,0xFF,0x00,0x00,0x00,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x3F,0x3F,0x03,0x03,", "5": "0x00,0x3F,0x7F,0x63,0x63,0x63,0x63,0x63,0x63,0xE3,0xC3,0x83,0x00,0x0C,0x1C,0x38,0x30,0x30,0x30,0x30,0x30,0x38,0x1F,0x0F,", "6": "0x00,0xC0,0xF0,0xF8,0xDC,0xCE,0xC7,0xC3,0xC3,0xC3,0x80,0x00,0x00,0x0F,0x1F,0x39,0x30,0x30,0x30,0x30,0x30,0x39,0x1F,0x0F,", @@ -31,7 +28,6 @@ def getFontMap(): "8": "0x00,0x00,0xBC,0xFE,0xE7,0xC3,0xC3,0xC3,0xE7,0xFE,0xBC,0x00,0x00,0x0F,0x1F,0x39,0x30,0x30,0x30,0x30,0x30,0x39,0x1F,0x0F,", "9": "0x00,0x3C,0x7E,0xE7,0xC3,0xC3,0xC3,0xC3,0xC3,0xE7,0xFE,0xFC,0x00,0x00,0x00,0x30,0x30,0x30,0x38,0x1C,0x0E,0x07,0x03,0x00,", ":": "0x00,0x00,0x00,0x00,0x70,0x70,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x1C,0x00,0x00,0x00,0x00,0x00,", - ":": "0x00,0x00,0x00,0x00,0x70,0x70,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x1C,0x00,0x00,0x00,0x00,0x00,", ";": "0x00,0x00,0x00,0x00,0x70,0x70,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9C,0xFC,0x7C,0x00,0x00,0x00,0x00,0x00,", "<": "0x00,0x00,0xC0,0xE0,0xF0,0x38,0x1C,0x0E,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0E,0x1C,0x38,0x30,0x00,0x00,", "=": "0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x00,", @@ -39,12 +35,10 @@ def getFontMap(): "?": "0x00,0x1C,0x1E,0x07,0x03,0x83,0xC3,0xE3,0x77,0x3E,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x37,0x37,0x00,0x00,0x00,0x00,0x00,", "@": "0x00,0xF8,0xFE,0x07,0xF3,0xFB,0x1B,0xFB,0xFB,0x07,0xFE,0xF8,0x00,0x0F,0x1F,0x18,0x33,0x37,0x36,0x37,0x37,0x36,0x03,0x01,", "A": "0x00,0x00,0x00,0xE0,0xFC,0x1F,0x1F,0xFC,0xE0,0x00,0x00,0x00,0x00,0x38,0x3F,0x07,0x06,0x06,0x06,0x06,0x07,0x3F,0x38,0x00,", - "А": "0x00,0x00,0x00,0xE0,0xFC,0x1F,0x1F,0xFC,0xE0,0x00,0x00,0x00,0x00,0x38,0x3F,0x07,0x06,0x06,0x06,0x06,0x07,0x3F,0x38,0x00,", "B": "0x00,0xFF,0xFF,0xC3,0xC3,0xC3,0xC3,0xE7,0xFE,0xBC,0x00,0x00,0x00,0x3F,0x3F,0x30,0x30,0x30,0x30,0x30,0x39,0x1F,0x0F,0x00,", "C": "0x00,0xF0,0xFC,0x0E,0x07,0x03,0x03,0x03,0x07,0x0E,0x0C,0x00,0x00,0x03,0x0F,0x1C,0x38,0x30,0x30,0x30,0x38,0x1C,0x0C,0x00,", "D": "0x00,0xFF,0xFF,0x03,0x03,0x03,0x03,0x07,0x0E,0xFC,0xF0,0x00,0x00,0x3F,0x3F,0x30,0x30,0x30,0x30,0x38,0x1C,0x0F,0x03,0x00,", "E": "0x00,0xFF,0xFF,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0x03,0x03,0x00,0x00,0x3F,0x3F,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,", - "E": "0x00,0xFF,0xFF,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0x03,0x03,0x00,0x00,0x3F,0x3F,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,", "F": "0x00,0xFF,0xFF,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0x03,0x03,0x00,0x00,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,", "G": "0x00,0xF0,0xFC,0x0E,0x07,0x03,0xC3,0xC3,0xC3,0xC7,0xC6,0x00,0x00,0x03,0x0F,0x1C,0x38,0x30,0x30,0x30,0x30,0x3F,0x3F,0x00,", "H": "0x00,0xFF,0xFF,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xFF,0xFF,0x00,0x00,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0x00,", @@ -67,10 +61,8 @@ def getFontMap(): "X": "0x00,0x03,0x0F,0x1C,0x30,0xE0,0xE0,0x30,0x1C,0x0F,0x03,0x00,0x00,0x30,0x3C,0x0E,0x03,0x01,0x01,0x03,0x0E,0x3C,0x30,0x00,", "Y": "0x00,0x03,0x0F,0x3C,0xF0,0xC0,0xC0,0xF0,0x3C,0x0F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,", "Z": "0x00,0x03,0x03,0x03,0x03,0xC3,0xE3,0x33,0x1F,0x0F,0x03,0x00,0x00,0x30,0x3C,0x3E,0x33,0x31,0x30,0x30,0x30,0x30,0x30,0x00,", - "Z": "0x00,0x03,0x03,0x03,0x03,0xC3,0xE3,0x33,0x1F,0x0F,0x03,0x00,0x00,0x30,0x3C,0x3E,0x33,0x31,0x30,0x30,0x30,0x30,0x30,0x00,", "[": "0x00,0x00,0x00,0xFF,0xFF,0x03,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0x30,0x30,0x30,0x30,0x00,0x00,0x00,", "\\": "0x00,0x0E,0x1C,0x38,0x70,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0E,0x1C,0x18,", - "\\": "0x00,0x0E,0x1C,0x38,0x70,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0E,0x1C,0x18,", "]": "0x00,0x00,0x00,0x03,0x03,0x03,0x03,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x3F,0x3F,0x00,0x00,0x00,", "^": "0x00,0x60,0x70,0x38,0x1C,0x0E,0x07,0x0E,0x1C,0x38,0x70,0x60,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,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,", @@ -101,7 +93,6 @@ def getFontMap(): "x": "0x00,0x60,0xE0,0xC0,0x80,0x00,0x80,0xC0,0xE0,0x60,0x00,0x00,0x00,0x30,0x38,0x1D,0x0F,0x07,0x0F,0x1D,0x38,0x30,0x00,0x00,", "y": "0x00,0x00,0x60,0xE0,0x80,0x00,0x00,0x80,0xE0,0x60,0x00,0x00,0x00,0x00,0x00,0x81,0xE7,0x7E,0x1E,0x07,0x01,0x00,0x00,0x00,", "z": "0x00,0x60,0x60,0x60,0x60,0x60,0xE0,0xE0,0x60,0x20,0x00,0x00,0x00,0x30,0x38,0x3C,0x36,0x33,0x31,0x30,0x30,0x30,0x00,0x00,", - "z": "0x00,0x60,0x60,0x60,0x60,0x60,0xE0,0xE0,0x60,0x20,0x00,0x00,0x00,0x30,0x38,0x3C,0x36,0x33,0x31,0x30,0x30,0x30,0x00,0x00,", "{": "0x00,0x00,0x80,0xC0,0xFC,0x7E,0x07,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x1F,0x3F,0x70,0x60,0x60,0x60,0x00,0x00,", "|": "0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,", "}": "0x00,0x00,0x03,0x03,0x03,0x07,0x7E,0xFC,0xC0,0x80,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x70,0x3F,0x1F,0x01,0x00,0x00,0x00,", @@ -209,15 +200,15 @@ def getFontMap(): "Ѝ": "0x00,0xFF,0xFF,0x00,0x01,0xC3,0xF2,0x38,0x0E,0xFF,0xFF,0x00,0x00,0x3F,0x3F,0x1C,0x07,0x03,0x00,0x00,0x00,0x3F,0x3F,0x00,", "Ў": "0x00,0x07,0x1F,0x7C,0xF1,0xC1,0xC1,0xF1,0x7C,0x1F,0x07,0x00,0x00,0x00,0x30,0x30,0x3C,0x0F,0x07,0x01,0x00,0x00,0x00,0x00,", "Џ": "0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x1F,0x1F,0x18,0x18,0x78,0x78,0x18,0x18,0x1F,0x1F,0x00,", - # "A":"0x00,0x80,0xE0,0x78,0x1E,0x07,0x07,0x1E,0x78,0xE0,0x80,0x00,0x00,0x3F,0x3F,0x06,0x06,0x06,0x06,0x06,0x06,0x3F,0x3F,0x00," , + "А": "0x00,0x00,0x00,0xE0,0xFC,0x1F,0x1F,0xFC,0xE0,0x00,0x00,0x00,0x00,0x38,0x3F,0x07,0x06,0x06,0x06,0x06,0x07,0x3F,0x38,0x00,", "Б": "0x00,0xFF,0xFF,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0x83,0x00,0x00,0x00,0x3F,0x3F,0x30,0x30,0x30,0x30,0x30,0x39,0x1F,0x0F,0x00,", "В": "0x00,0xFF,0xFF,0xC3,0xC3,0xC3,0xC3,0xE7,0xFE,0xBC,0x00,0x00,0x00,0x3F,0x3F,0x30,0x30,0x30,0x30,0x30,0x39,0x1F,0x0F,0x00,", "Г": "0x00,0xFF,0xFF,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x00,0x00,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,", - "Г": "0x00,0xFF,0xFF,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x00,0x00,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,", + "Ґ": "0x00,0xFC,0xFC,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0F,0x0F,0x00,0x00,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,", "Д": "0x00,0x00,0xF8,0xFE,0x0F,0x03,0x03,0x03,0xFF,0xFF,0x00,0x00,0x00,0x70,0x7F,0x1F,0x18,0x18,0x18,0x18,0x1F,0x7F,0x70,0x00,", "Е": "0x00,0xFF,0xFF,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0x03,0x03,0x00,0x00,0x3F,0x3F,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,", "Ж": "0x00,0x03,0x0F,0xFC,0xE0,0xFF,0xFF,0xE0,0xFC,0x0F,0x03,0x00,0x00,0x38,0x3F,0x07,0x00,0x3F,0x3F,0x00,0x07,0x3F,0x38,0x00,", - "Ж": "0x00,0x03,0x0F,0xFC,0xE0,0xFF,0xFF,0xE0,0xFC,0x0F,0x03,0x00,0x00,0x38,0x3F,0x07,0x00,0x3F,0x3F,0x00,0x07,0x3F,0x38,0x00,", + "З": "0x0C,0x0E,0x07,0x03,0xC3,0xC3,0xC3,0xC3,0xC3,0xE7,0x7E,0x3C,0x0C,0x1C,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x39,0x1F,0x0E,", "И": "0x00,0xFF,0xFF,0x00,0x00,0xC0,0xF0,0x38,0x0E,0xFF,0xFF,0x00,0x00,0x3F,0x3F,0x1C,0x07,0x03,0x00,0x00,0x00,0x3F,0x3F,0x00,", "Й": "0x00,0xFF,0xFF,0x00,0x02,0xC3,0xF1,0x38,0x0E,0xFF,0xFF,0x00,0x00,0x3F,0x3F,0x1C,0x07,0x03,0x00,0x00,0x00,0x3F,0x3F,0x00,", "К": "0x00,0xFF,0xFF,0xC0,0xE0,0xF0,0x38,0x1C,0x0E,0x07,0x03,0x00,0x00,0x3F,0x3F,0x00,0x01,0x03,0x07,0x0E,0x1C,0x38,0x30,0x00,", @@ -246,11 +237,11 @@ def getFontMap(): "б": "0x00,0xE0,0xF0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x1F,0x3F,0x33,0x33,0x33,0x33,0x33,0x33,0x3F,0x1E,0x00,", "в": "0x00,0xF0,0xF0,0x30,0x30,0x30,0x30,0x30,0xF0,0xE0,0x00,0x00,0x00,0x3F,0x3F,0x33,0x33,0x33,0x33,0x33,0x33,0x3F,0x1E,0x00,", "г": "0x00,0xF0,0xF0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,", + "ґ": "0x00,0xF0,0xF0,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x3C,0x00,0x00,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,", "д": "0x00,0x00,0xC0,0xE0,0x70,0x30,0x30,0x30,0xF0,0xF0,0x00,0x00,0x00,0x60,0x7F,0x3F,0x30,0x30,0x30,0x30,0x3F,0x7F,0x60,0x00,", "е": "0x00,0xE0,0xF0,0x30,0x30,0x30,0x30,0x30,0x30,0xF0,0xE0,0x00,0x00,0x1F,0x3F,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x00,", "ж": "0x00,0x30,0xF0,0xC0,0x00,0xF0,0xF0,0x00,0xC0,0xF0,0x30,0x00,0x00,0x30,0x3C,0x0F,0x03,0x3F,0x3F,0x03,0x0F,0x3C,0x30,0x00,", "з": "0x00,0x60,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0xF0,0xE0,0x00,0x00,0x18,0x38,0x30,0x33,0x33,0x33,0x33,0x33,0x3F,0x1D,0x00,", - "З": "0x00,0x60,0x70,0x30,0x30,0x30,0x30,0x30,0x30,0xF0,0xE0,0x00,0x00,0x18,0x38,0x30,0x33,0x33,0x33,0x33,0x33,0x3F,0x1D,0x00,", "и": "0x00,0xF0,0xF0,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF0,0x00,0x00,0x3F,0x3F,0x1C,0x0E,0x07,0x03,0x01,0x00,0x3F,0x3F,0x00,", "й": "0x00,0xF0,0xF0,0x00,0x04,0x08,0x88,0xC4,0xE0,0xF0,0xF0,0x00,0x00,0x3F,0x3F,0x1C,0x0E,0x07,0x03,0x01,0x00,0x3F,0x3F,0x00,", "к": "0x00,0xF0,0xF0,0x80,0x80,0xC0,0xE0,0x70,0x30,0x10,0x00,0x00,0x00,0x3F,0x3F,0x03,0x03,0x07,0x0E,0x1C,0x38,0x30,0x20,0x00,", @@ -520,7 +511,6 @@ def getSmallFontMap(): "|": "0x00, 0x00, 0x77, 0x00, 0x00, 0x00,", "}": "0x00, 0x00, 0x41, 0x36, 0x08, 0x00,", "~": "0x02, 0x01, 0x02, 0x04, 0x02, 0x00,", - "^": "0x04, 0x02, 0x01, 0x02, 0x04, 0x00,", "¡": "0x00, 0x00, 0x79, 0x00, 0x00, 0x00,", "¢": "0x1c, 0x22, 0x7f, 0x22, 0x10, 0x00,", "£": "0x50, 0x7e, 0x51, 0x41, 0x42, 0x00,", @@ -635,6 +625,7 @@ def getSmallFontMap(): "Б": "0x7f, 0x49, 0x49, 0x49, 0x31, 0x00,", "В": "0x7f, 0x49, 0x49, 0x49, 0x36, 0x00,", "Г": "0x7f, 0x01, 0x01, 0x01, 0x01, 0x00,", + "Ґ": "0x7E, 0x02, 0x02, 0x02, 0x03, 0x00,", "Д": "0x60, 0x3f, 0x21, 0x3f, 0x60, 0x00,", "Е": "0x7f, 0x49, 0x49, 0x49, 0x41, 0x00,", "Ж": "0x77, 0x08, 0x7f, 0x08, 0x77, 0x00,", @@ -655,8 +646,8 @@ def getSmallFontMap(): "Х": "0x63, 0x14, 0x08, 0x14, 0x63, 0x00,", "Ц": "0x3f, 0x20, 0x20, 0x3f, 0x60, 0x00,", "Ч": "0x07, 0x08, 0x08, 0x08, 0x7f, 0x00,", - "Ш": "0x3f, 0x20, 0x3f, 0x20, 0x3f, 0x00,", - "Щ": "0x3f, 0x20, 0x3f, 0x20, 0x3f, 0x60,", + "Ш": "0x7F, 0x40, 0x7F, 0x40, 0x7F, 0x00,", + "Щ": "0x7F, 0x40, 0x7F, 0x40, 0x7F, 0xC0,", "Ъ": "0x01, 0x7f, 0x48, 0x48, 0x30, 0x00,", "Ы": "0x7f, 0x48, 0x30, 0x00, 0x7f, 0x00,", "Ь": "0x00, 0x7f, 0x48, 0x48, 0x30, 0x00,", @@ -667,6 +658,7 @@ def getSmallFontMap(): "б": "0x3c, 0x4a, 0x4a, 0x4a, 0x30, 0x00,", "в": "0x7c, 0x54, 0x54, 0x54, 0x28, 0x00,", "г": "0x7c, 0x04, 0x04, 0x04, 0x04, 0x00,", + "ґ": "0x7C, 0x04, 0x04, 0x04, 0x06, 0x00,", "д": "0x40, 0x3c, 0x24, 0x3c, 0x60, 0x00,", "е": "0x38, 0x54, 0x54, 0x54, 0x18, 0x00,", "ж": "0x6c, 0x10, 0x7c, 0x10, 0x6c, 0x00,", @@ -687,8 +679,8 @@ def getSmallFontMap(): "х": "0x44, 0x28, 0x10, 0x28, 0x44, 0x00,", "ц": "0x3c, 0x20, 0x20, 0x3c, 0x60, 0x00,", "ч": "0x0c, 0x10, 0x10, 0x10, 0x7c, 0x00,", - "ш": "0x3c, 0x20, 0x3c, 0x20, 0x3c, 0x00,", - "щ": "0x3c, 0x20, 0x3c, 0x20, 0x7c, 0x00,", + "ш": "0x7C, 0x40, 0x7C, 0x40, 0x7C, 0x00,", + "щ": "0x7C, 0x40, 0x7C, 0x40, 0xFC, 0x00,", "ъ": "0x04, 0x7c, 0x50, 0x20, 0x00, 0x00,", "ы": "0x7c, 0x50, 0x20, 0x00, 0x7c, 0x00,", "ь": "0x00, 0x7c, 0x50, 0x20, 0x00, 0x00,", diff --git a/Translations/make_translation.py b/Translations/make_translation.py index f498cdfd..38171344 100755 --- a/Translations/make_translation.py +++ b/Translations/make_translation.py @@ -5,12 +5,12 @@ import argparse import json import os import io +import functools from datetime import datetime import sys import fontTables import re import subprocess -from bdflib import reader as bdfreader HERE = os.path.dirname(__file__) @@ -20,8 +20,11 @@ except NameError: to_unicode = str -with open(os.path.join(HERE, "wqy-bitmapsong/wenquanyi_9pt.bdf"), "rb") as handle: - cjkFont = bdfreader.read_bdf(handle) +@functools.lru_cache(maxsize=None) +def cjkFont(): + from bdflib import reader as bdfreader + with open(os.path.join(HERE, "wqy-bitmapsong/wenquanyi_9pt.bdf"), "rb") as f: + return bdfreader.read_bdf(f) def log(message): @@ -184,7 +187,7 @@ def getLetterCounts(defs, lang): def getCJKGlyph(sym): from bdflib.model import Glyph try: - glyph: Glyph = cjkFont[ord(sym)] + glyph: Glyph = cjkFont()[ord(sym)] except: return None data = glyph.data diff --git a/Translations/translation_BG.json b/Translations/translation_BG.json index 3fb24b8e..c59cede6 100644 --- a/Translations/translation_BG.json +++ b/Translations/translation_BG.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Поялник", @@ -274,6 +282,13 @@ "locking" ], "desc": "When soldering, long press on both buttons lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_CS.json b/Translations/translation_CS.json index af1103c9..8b373f51 100644 --- a/Translations/translation_CS.json +++ b/Translations/translation_CS.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Pájecí", @@ -274,6 +282,13 @@ "locking" ], "desc": "When soldering, long press on both buttons lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_DA.json b/Translations/translation_DA.json index b98220a1..0859c233 100644 --- a/Translations/translation_DA.json +++ b/Translations/translation_DA.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Soldering", @@ -274,6 +282,13 @@ "locking" ], "desc": "When soldering, long press on both buttons lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_DE.json b/Translations/translation_DE.json index 60c9b4b9..2bb581e8 100644 --- a/Translations/translation_DE.json +++ b/Translations/translation_DE.json @@ -14,7 +14,7 @@ "BadTipString": "Spitze Defekt", "SleepingSimpleString": "Zzz ", "SleepingAdvancedString": "Ruhemodus...", - "WarningSimpleString": "HEIß!", + "WarningSimpleString": "HEISS!", "WarningAdvancedString": "! Achtung Heiß !", "SleepingTipAdvancedString": "Temp:", "IdleTipString": "Ist:", @@ -47,9 +47,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "V" + "SettingLockFullChar": "V", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Löt-", @@ -99,14 +107,14 @@ "Ruhever-", "zögerung" ], - "desc": "System wechselt in Ruhemodus, wenn innerhalb dieser Dauer nicht bewegt " + "desc": "Dauer vor Übergang in den Ruhemodus " }, "ShutdownTimeout": { "text2": [ "Abschalt-", "zeit" ], - "desc": "System schaltet ab, wenn innerhalb dieser Dauer nicht bewegt " + "desc": "Dauer vor automatischer Abschaltung " }, "MotionSensitivity": { "text2": [ @@ -148,7 +156,7 @@ "Start im", "Lötmodus" ], - "desc": "Bestimmt das Heizverhalten beim Einschalten der Spannungsversorgung " + "desc": "Heizverhalten beim Einschalten der Spannungsversorgung " }, "CooldownBlink": { "text2": [ @@ -169,14 +177,14 @@ "Einstellungen", "zurücksetzen?" ], - "desc": "Werte werden auf Werkseinstellungen zurückgesetzt!" + "desc": "Werte auf Werkseinstellungen zurücksetzen" }, "VoltageCalibration": { "text2": [ "Eingangsspannung", "kalibrieren?" ], - "desc": "Kalibrierung der Eingangsspannung. Kurzer Tastendruck zum Einstellen, langer Tastendruck zum Verlassen." + "desc": "Kalibrierung der Eingangsspannung " }, "AdvancedSoldering": { "text2": [ @@ -204,14 +212,14 @@ "Einfache", "Kalibrierung" ], - "desc": "Einfache Kalibrierung mittels heißen Wassers" + "desc": "Einfache Kalibrierung mit heißem Wasser" }, "AdvancedCalibrationMode": { "text2": [ "Erweiterte", "Kalibrierung" ], - "desc": "Erweiterte Kalibrierung mittels eines Thermoelements an der Lötspitze" + "desc": "Erweiterte Kalibrierung mit Thermoelement an der Lötspitze" }, "QCMaxVoltage": { "text2": [ @@ -253,28 +261,35 @@ "Leistungs-", "impuls" ], - "desc": "Powerbank wird mittels eines Impulses wach gehalten " + "desc": "Powerbank mit einem Impuls wach halten " }, "TipGain": { "text2": [ "Ändere", - "Spitzen Faktor" + "Spitzen-Faktor" ], - "desc": "Spitzen Faktor" + "desc": "Spitzen-Faktor" }, "HallEffSensitivity": { "text2": [ - "Hall Sensor", + "Hall-Sonde", "Empfindlichkeit" ], - "desc": "Empfindlichkeit des Hall Effekt Sensors beim Erkennen des Ruhemodus " + "desc": "Empfindlichkeit der Hall-Sonde beim Erkennen des Ruhemodus " }, "LockingMode": { "text2": [ - "Knopf-", + "Tasten-", "sperre" ], - "desc": "Langes drücken beider Knöpfe im Lötmodus, sperrt diese " + "desc": "Langes drücken beider Tasten im Lötmodus sperrt diese " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } diff --git a/Translations/translation_EN.json b/Translations/translation_EN.json index d208a386..2697bf4b 100644 --- a/Translations/translation_EN.json +++ b/Translations/translation_EN.json @@ -47,9 +47,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Soldering", @@ -275,6 +283,13 @@ "buttons" ], "desc": "When soldering, long press both buttons, to lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } diff --git a/Translations/translation_ES.json b/Translations/translation_ES.json index 8adca0d9..fb89fcc9 100644 --- a/Translations/translation_ES.json +++ b/Translations/translation_ES.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Ajustes de", @@ -274,6 +282,13 @@ "locking" ], "desc": "When soldering, long press on both buttons lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_FI.json b/Translations/translation_FI.json index d2319978..8d10536c 100644 --- a/Translations/translation_FI.json +++ b/Translations/translation_FI.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Juotos-", @@ -274,6 +282,13 @@ "locking" ], "desc": "When soldering, long press on both buttons lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_FR.json b/Translations/translation_FR.json index a9b7e15e..612a570a 100644 --- a/Translations/translation_FR.json +++ b/Translations/translation_FR.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "V" + "SettingLockFullChar": "V", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Paramètres", @@ -274,6 +282,13 @@ "capteur effet hall" ], "desc": "Sensibilité du capteur à effet Hall lors de la détection de mise en veille " + }, + "MinVolCell": { + "text2": [ + "Tension", + "minimale" + ], + "desc": "Tension minimale autorisée par cellule" } } } diff --git a/Translations/translation_HR.json b/Translations/translation_HR.json index 11f6c884..1158c034 100644 --- a/Translations/translation_HR.json +++ b/Translations/translation_HR.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Postavke", @@ -274,6 +282,13 @@ "locking" ], "desc": "When soldering, long press on both buttons lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_HU.json b/Translations/translation_HU.json index 03d549a3..612f6407 100644 --- a/Translations/translation_HU.json +++ b/Translations/translation_HU.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "M", "SettingLockDisableChar": "K", "SettingLockBoostChar": "B", - "SettingLockFullChar": "T" + "SettingLockFullChar": "T", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Forrasztási", @@ -274,6 +282,13 @@ "enged." ], "desc": "Forrasztás közben mindkét gombot hosszan lenyomva rögzíti a hőmérsékletet (K=ki B=csak \"boost\" mód T=teljes lezárás)" + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } diff --git a/Translations/translation_IT.json b/Translations/translation_IT.json index cd1fd539..80ef7886 100644 --- a/Translations/translation_IT.json +++ b/Translations/translation_IT.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "A", "SettingLockDisableChar": "D", "SettingLockBoostChar": "T", - "SettingLockFullChar": "C" + "SettingLockFullChar": "C", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Opzioni", @@ -274,6 +282,13 @@ "tasti" ], "desc": "Blocca i tasti durante la modalità Saldatura; tieni premuto entrambi per bloccare/sbloccare " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } diff --git a/Translations/translation_LT.json b/Translations/translation_LT.json index 3563bcca..c25d5fea 100644 --- a/Translations/translation_LT.json +++ b/Translations/translation_LT.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "A", "SettingLockDisableChar": "I", "SettingLockBoostChar": "T", - "SettingLockFullChar": "V" + "SettingLockFullChar": "V", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Litavimo", @@ -274,6 +282,13 @@ "užraktas" ], "desc": "Lituodami, ilgai paspauskite abu mygtukus, kad juos užrakintumėte " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_NL.json b/Translations/translation_NL.json index d4abf365..c3d59735 100644 --- a/Translations/translation_NL.json +++ b/Translations/translation_NL.json @@ -46,9 +46,17 @@ "SettingSensitivityOff": "O", "SettingSensitivityLow": "L", "SettingSensitivityMedium": "M", - "SettingSensitivityHigh": "H" + "SettingSensitivityHigh": "H", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Soldeer", @@ -274,6 +282,13 @@ "knoppen" ], "desc": "Tijdens solderen lang op beide knoppen drukken, blokkeert ze. " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_NL_BE.json b/Translations/translation_NL_BE.json index 2713d418..90cdea43 100644 --- a/Translations/translation_NL_BE.json +++ b/Translations/translation_NL_BE.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Soldeer", @@ -274,6 +282,13 @@ "locking" ], "desc": "When soldering, long press on both buttons lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_NO.json b/Translations/translation_NO.json index fa90ecf4..990e1c83 100644 --- a/Translations/translation_NO.json +++ b/Translations/translation_NO.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Lodde-", @@ -274,6 +282,13 @@ "locking" ], "desc": "When soldering, long press on both buttons lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_PL.json b/Translations/translation_PL.json index 1a92b0f9..2e4c5b96 100644 --- a/Translations/translation_PL.json +++ b/Translations/translation_PL.json @@ -47,9 +47,17 @@ "SettingSensitivityHigh": "W", "SettingLockDisableChar": "W", "SettingLockBoostChar": "B", - "SettingLockFullChar": "P" + "SettingLockFullChar": "P", + "SettingNAChar": "N/D" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Ustawienia", + "zasilania" + ], + "desc": "Zasilanie i minimalne napięcie na komórkę" + }, "SolderingMenu": { "text2": [ "Lutowanie", @@ -275,6 +283,13 @@ "przycisków" ], "desc": "W trybie lutowania, wciśnij oba przyciski aby je zablokować " + }, + "MinVolCell": { + "text2": [ + "Minimalne", + "napięcie" + ], + "desc": "Minimalne dozwolone napięcie na komórkę <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" } } } diff --git a/Translations/translation_PT.json b/Translations/translation_PT.json index 4bf003d1..ab24e50d 100644 --- a/Translations/translation_PT.json +++ b/Translations/translation_PT.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Configurações", @@ -274,6 +282,13 @@ "locking" ], "desc": "When soldering, long press on both buttons lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_RU.json b/Translations/translation_RU.json index 1923c0d4..29621499 100644 --- a/Translations/translation_RU.json +++ b/Translations/translation_RU.json @@ -7,14 +7,14 @@ "SettingsCalibrationWarning": "Прежде чем продолжить, пожалуйста, убедитесь, что жало имеет комнатную температуру!", "SettingsResetWarning": "Вы уверены, что хотите сбросить настройки к значениям по умолчанию?", "UVLOWarningString": "НАПРЯЖ--", - "UndervoltageString": "Низк. напряжение", + "UndervoltageString": "Низкое напряжение", "InputVoltageString": "Питание В: ", "WarningTipTempString": "Темп. жала: ", "BadTipString": "ЖАЛО--", "SleepingSimpleString": "Zzzz", "SleepingAdvancedString": "Ожидание...", "WarningSimpleString": "ГОРЯЧО!", - "WarningAdvancedString": "!!! ГОРЯЧЕЕ ЖАЛО !!!", + "WarningAdvancedString": "!!! ГОРЯЧЕЕ !!!\n!!! ЖАЛО !!!", "SleepingTipAdvancedString": "Жало:", "IdleTipString": "Жало:", "IdleSetString": " ->", @@ -23,7 +23,7 @@ "OffString": "Выкл.", "ResetOKMessage": "Сброс OK", "YourGainMessage": "Прирост:", - "SettingsResetMessage": "Настройки сброшены!", + "SettingsResetMessage": "Настройки\nсброшены!", "NoAccelerometerMessage": "Не определен\nакселерометр!", "NoPowerDeliveryMessage": "No USB-PD IC\ndetected!", "LockingKeysString": " LOCKED", @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "В", "SettingLockDisableChar": "О", "SettingLockBoostChar": "Т", - "SettingLockFullChar": "П" + "SettingLockFullChar": "П", + "SettingNAChar": "Н/Д" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Параметры", + "питания" + ], + "desc": "Источник питания и минимальное напряжение на ячейку" + }, "SolderingMenu": { "text2": [ "Параметры", @@ -274,6 +282,13 @@ "блок. кнопок" ], "desc": "При работе длинное нажатие обеих кнопок блокирует их <О=Отключено, Т=Только турбо, П=Полная блокировка>" + }, + "MinVolCell": { + "text2": [ + "Мин.", + "напр." + ], + "desc": "Минимальное разрешенное напряжение на ячейку <В вольтах> <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" } } } diff --git a/Translations/translation_SK.json b/Translations/translation_SK.json index a53dcae8..3a7058bf 100644 --- a/Translations/translation_SK.json +++ b/Translations/translation_SK.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "V", "SettingLockDisableChar": "Z", "SettingLockBoostChar": "B", - "SettingLockFullChar": "P" + "SettingLockFullChar": "P", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Nastavenie", @@ -274,6 +282,13 @@ "tlačidiel" ], "desc": "Zamknutie tlačidiel - dlhé stlačenie oboch naraz počas spájkovania " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } diff --git a/Translations/translation_SL.json b/Translations/translation_SL.json index 2f7c6a90..afe9666c 100644 --- a/Translations/translation_SL.json +++ b/Translations/translation_SL.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "V", "SettingLockDisableChar": "O", "SettingLockBoostChar": "L", - "SettingLockFullChar": "P" + "SettingLockFullChar": "P", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Nastavitve", @@ -274,6 +282,13 @@ "zaklep gumbov" ], "desc": "Za zaklep med spajkanjem drži oba gumba " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_SR_CYRL.json b/Translations/translation_SR_CYRL.json index 9fa61a14..5c85fc9b 100644 --- a/Translations/translation_SR_CYRL.json +++ b/Translations/translation_SR_CYRL.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Поставке", @@ -274,6 +282,13 @@ "locking" ], "desc": "When soldering, long press on both buttons lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_SR_LATN.json b/Translations/translation_SR_LATN.json index 43e64b7d..5b38c369 100644 --- a/Translations/translation_SR_LATN.json +++ b/Translations/translation_SR_LATN.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Postavke", @@ -274,6 +282,13 @@ "locking" ], "desc": "When soldering, long press on both buttons lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_SV.json b/Translations/translation_SV.json index a3411b75..a2c58cd8 100644 --- a/Translations/translation_SV.json +++ b/Translations/translation_SV.json @@ -46,9 +46,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Lödnings-", @@ -274,6 +282,13 @@ "locking" ], "desc": "When soldering, long press on both buttons lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_TR.json b/Translations/translation_TR.json index 8c0f3881..cf09370a 100644 --- a/Translations/translation_TR.json +++ b/Translations/translation_TR.json @@ -43,9 +43,17 @@ "SettingSensitivityHigh": "H", "SettingLockDisableChar": "D", "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" + "SettingLockFullChar": "F", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "Lehimleme", @@ -292,6 +300,13 @@ "locking" ], "desc": "When soldering, long press on both buttons lock them " + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } \ No newline at end of file diff --git a/Translations/translation_UK.json b/Translations/translation_UK.json index f2ab5e94..38a7c6eb 100644 --- a/Translations/translation_UK.json +++ b/Translations/translation_UK.json @@ -7,28 +7,28 @@ "SettingsCalibrationWarning": "Переконайтеся, що жало охололо до кімнатної температури, перш ніж продовжувати!", "SettingsResetWarning": "Ви дійсно хочете скинути налаштування до значень за замовчуванням? ", "UVLOWarningString": "АККУМ--", - "UndervoltageString": "Низ. напруга", + "UndervoltageString": "Низька напруга", "InputVoltageString": "Жив.(B): ", "WarningTipTempString": "Жало t°: ", "BadTipString": "ЖАЛО--", "SleepingSimpleString": "ZzZzz", "SleepingAdvancedString": "Очікування...", "WarningSimpleString": "ГАРЯЧЕ!", - "WarningAdvancedString": "!!! ГАРЯЧЕ ЖАЛО !!!", + "WarningAdvancedString": "!!! ГАРЯЧЕ !!!\n!!! ЖАЛО !!!", "SleepingTipAdvancedString": "Жало:", "IdleTipString": "Жало:", "IdleSetString": " ->", "TipDisconnectedString": "Жало вимкнено!", "SolderingAdvancedPowerPrompt": "Живлення: ", "OffString": "Вимк", - "ResetOKMessage": "Скидання OK", + "ResetOKMessage": "Скид. OK", "YourGainMessage": "Приріст:", - "SettingsResetMessage": "Налаштування скинуті!", + "SettingsResetMessage": "Налаштування\nскинуті!", "NoAccelerometerMessage": "Акселерометр\nне виявлено!", "NoPowerDeliveryMessage": "USB-PD IC\nне виявлено!", - "LockingKeysString": " ЗАБЛОКОВАНО", - "UnlockingKeysString": "РОЗБЛОКОВАНО", - "WarningKeysLockedString": "!ЗАБЛОКОВАНО!" + "LockingKeysString": " ЗАБЛОК.", + "UnlockingKeysString": "РОЗБЛОК.", + "WarningKeysLockedString": "!ЗАБЛОК!" }, "characters": { "SettingRightChar": "П", @@ -46,15 +46,23 @@ "SettingSensitivityHigh": "М", "SettingLockDisableChar": "В", "SettingLockBoostChar": "Т", - "SettingLockFullChar": "П" + "SettingLockFullChar": "П", + "SettingNAChar": "Н/Д" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Параметри", + "живлення" + ], + "desc": "Джерело живлення, та мінамільна напруга на комірку" + }, "SolderingMenu": { "text2": [ "Параметри", "пайки" ], - "desc": "Налаштування для режиму пайки. Діють при включеному жалі." + "desc": "Налаштування для режиму пайки. Діють при увімкненому жалі." }, "PowerSavingMenu": { "text2": [ @@ -65,8 +73,8 @@ }, "UIMenu": { "text2": [ - "Інтерфейс", - "" + "Параметри", + "інтерфейсу" ], "desc": "Параметри користувальницького інтерфейсу." }, @@ -84,7 +92,7 @@ "Джерело", "живлення" ], - "desc": "Встановлення напруги відключення. " + "desc": "Встановлює напругу відсічки. " }, "SleepTemperature": { "text2": [ @@ -105,12 +113,12 @@ "Часу до", "вимкнення" ], - "desc": "Час до відключення <Хвилини>" + "desc": "Час до вимкнення <Хвилини>" }, "MotionSensitivity": { "text2": [ - "Чутл. сенсо-", - "ру руху" + "Чутливість", + "сенсору руху" ], "desc": "Акселерометр <0 - Вимк. 1 - мін. чутливості 9 - макс. чутливості>" }, @@ -140,25 +148,25 @@ "Темпер.", "Турбо" ], - "desc": "Температура в Турбо-режимі" + "desc": "Температура в \"Турбо\" режимі" }, "AutoStart": { "text2": [ "Гарячий", "старт" ], - "desc": "Режим з яким запускається паяльник при подачі живлення <П=Пайка, О=Очікування, К=Очікування при кімн. темп., В=Вимк.>" + "desc": "Режим в якому запускається паяльник при ввімкненні <П=Пайка, О=Очікування, К=Очікування при кімн. темп., В=Вимк.>" }, "CooldownBlink": { "text2": [ "Показ t° при", - "охолодж." + "охолодженні" ], "desc": "Показувати температуру на екрані охолодження, поки жало залишається гарячим, при цьому екран моргає" }, "TemperatureCalibration": { "text2": [ - "Калібровка", + "Калібрування", "температури" ], "desc": "Калібрування температурного датчика." @@ -179,8 +187,8 @@ }, "AdvancedSoldering": { "text2": [ - "Детальний ре-", - "жим пайки" + "Детальний", + "режим пайки" ], "desc": "Показувати детальну інформацію при пайці." }, @@ -194,7 +202,7 @@ "TipModel": { "text2": [ "Модель", - "Жало" + "жала" ], "desc": "Вибір моделі жала" }, @@ -215,7 +223,7 @@ "QCMaxVoltage": { "text2": [ "Потужність", - "дж. живл." + "дж. живлення" ], "desc": "Потужність джерела живлення в Ватах" }, @@ -235,14 +243,14 @@ }, "TempChangeShortStep": { "text2": [ - "Зм. темп.", + "Зміна темп.", "коротко?" ], "desc": "Змінювати температуру при короткому натисканні!" }, "TempChangeLongStep": { "text2": [ - "Зм. темп.", + "Зміна темп.", "довго?" ], "desc": "Змінювати температуру при довгому натисканні!" @@ -252,14 +260,14 @@ "Пульс.", "Навантаж." ], - "desc": "Деякі PowerBank-и з часом вимк. живлення, якщо пристрій споживає дуже мало енергії (це потрібно щоб паяльник не вимкнувся з часом)" + "desc": "Деякі PowerBank-и з часом вимк. живлення, якщо пристрій споживає дуже мало енергії)" }, "TipGain": { "text2": [ - "Modify", - "tip gain" + "Змінити", + "підсил. жала" ], - "desc": "Tip gain" + "desc": "Підсилення жала" }, "HallEffSensitivity": { "text2": [ @@ -271,9 +279,16 @@ "LockingMode": { "text2": [ "Дозволити", - "блокування кнопок" + "блок. кнопок" ], "desc": "Під час пайки тривале натискання обох кнопок заблокує їх <В=Вимк, Т=Тільки турбо, П=Повне>" + }, + "MinVolCell": { + "text2": [ + "Мін.", + "напруга" + ], + "desc": "Мінімальна дозволена напруга на комірку <В вольтах> <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" } } } diff --git a/Translations/translation_YUE_HK.json b/Translations/translation_YUE_HK.json index a79691e6..4b3b7eed 100644 --- a/Translations/translation_YUE_HK.json +++ b/Translations/translation_YUE_HK.json @@ -47,9 +47,17 @@ "SettingSensitivityHigh": "高", "SettingLockDisableChar": "無", "SettingLockBoostChar": "增", - "SettingLockFullChar": "全" + "SettingLockFullChar": "全", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "", @@ -275,6 +283,13 @@ "撳掣鎖定" ], "desc": "喺焊接模式時,同時長撳兩粒掣啓用撳掣鎖定 <無=停用 | 增=只鎖定增熱模式 | 全=鎖定全部>" + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } diff --git a/Translations/translation_ZH_TW.json b/Translations/translation_ZH_TW.json index 02c39d66..841c1fca 100644 --- a/Translations/translation_ZH_TW.json +++ b/Translations/translation_ZH_TW.json @@ -47,9 +47,17 @@ "SettingSensitivityHigh": "高", "SettingLockDisableChar": "無", "SettingLockBoostChar": "增", - "SettingLockFullChar": "全" + "SettingLockFullChar": "全", + "SettingNAChar": "N/A" }, "menuGroups": { + "PowerMenu": { + "text2": [ + "Power", + "settings" + ], + "desc": "Power settings" + }, "SolderingMenu": { "text2": [ "", @@ -275,6 +283,13 @@ "按鍵鎖定" ], "desc": "於焊接模式時,同時長按兩個按鍵啟用按鍵鎖定 <無=停用 | 增=只鎖定增熱模式 | 全=鎖定全部>" + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum allowed voltage per cell" } } } diff --git a/Translations/translations_def.js b/Translations/translations_def.js index 82cc9ff0..c9a5961a 100644 --- a/Translations/translations_def.js +++ b/Translations/translations_def.js @@ -173,7 +173,8 @@ var def = { "id": "SettingSensitivityHigh", "len": 1 - }, { + }, + { "id": "SettingLockDisableChar", "len": 1, "default": "D" @@ -187,9 +188,18 @@ var def = "id": "SettingLockFullChar", "len": 1, "default": "F" + }, + { + "id": "SettingNAChar", + "len": 3, + "default": "N/A" } ], "menuGroups": [ + { + "id": "PowerMenu", + "maxLen": 11 + }, { "id": "SolderingMenu", "maxLen": 11 @@ -342,10 +352,16 @@ var def = "id": "HallEffSensitivity", "maxLen": 6, "maxLen2": 8 - }, { + }, + { "id": "LockingMode", "maxLen": 6, "maxLen2": 13 + }, + { + "id": "MinVolCell", + "maxLen": 4, + "maxLen2": 9 } ] } diff --git a/docker-compose.yml b/docker-compose.yml index 30ddcb88..31ded282 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,5 +7,5 @@ services: context: . command: /bin/bash volumes: - - ./ci:/build/ci - - ./:/build/source + - ./ci:/build/ci:Z + - ./:/build/source:Z diff --git a/source/Core/BSP/Pine64/BSP.cpp b/source/Core/BSP/Pine64/BSP.cpp index 707f55ce..e29abea2 100644 --- a/source/Core/BSP/Pine64/BSP.cpp +++ b/source/Core/BSP/Pine64/BSP.cpp @@ -88,19 +88,21 @@ uint16_t getInputVoltageX10(uint16_t divisor, uint8_t sample) { void unstick_I2C() { /* configure SDA/SCL for GPIO */ GPIO_BC(GPIOB) |= SDA_Pin | SCL_Pin; - gpio_init(SDA_GPIO_Port, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, SDA_Pin | SCL_Pin); - asm("nop"); - asm("nop"); - asm("nop"); - asm("nop"); - asm("nop"); - GPIO_BOP(GPIOB) |= SCL_Pin; - asm("nop"); - asm("nop"); - asm("nop"); - asm("nop"); - asm("nop"); - GPIO_BOP(GPIOB) |= SDA_Pin; + gpio_init(SDA_GPIO_Port, GPIO_MODE_OUT_OD, GPIO_OSPEED_50MHZ, SDA_Pin | SCL_Pin); + for (int i = 0; i < 8; i++) { + asm("nop"); + asm("nop"); + asm("nop"); + asm("nop"); + asm("nop"); + GPIO_BOP(GPIOB) |= SCL_Pin; + asm("nop"); + asm("nop"); + asm("nop"); + asm("nop"); + asm("nop"); + GPIO_BOP(GPIOB) &= SCL_Pin; + } /* connect PB6 to I2C0_SCL */ /* connect PB7 to I2C0_SDA */ gpio_init(SDA_GPIO_Port, GPIO_MODE_AF_OD, GPIO_OSPEED_50MHZ, SDA_Pin | SCL_Pin); diff --git a/source/Core/BSP/Pine64/BSP_PD.c b/source/Core/BSP/Pine64/BSP_PD.c index 7a282409..8608c814 100644 --- a/source/Core/BSP/Pine64/BSP_PD.c +++ b/source/Core/BSP/Pine64/BSP_PD.c @@ -15,11 +15,12 @@ const uint16_t USB_PD_Desired_Levels[] = { // mV desired input, mA minimum required current // Tip is ~ 7.5 ohms 20000, 2666, // 20V, 2.6A + 18000, 2400, // 18V, 2.4A 15000, 2000, // 15V 2A 12000, 1600, // 12V @ 1.6A 9000, 1200, // 9V @ 1.2A 5000, 100, // 5V @ whatever }; -const uint8_t USB_PD_Desired_Levels_Len = 5; +const uint8_t USB_PD_Desired_Levels_Len = 6; #endif diff --git a/source/Core/BSP/Pine64/Debug.cpp b/source/Core/BSP/Pine64/Debug.cpp index 354985fb..de40fe7d 100644 --- a/source/Core/BSP/Pine64/Debug.cpp +++ b/source/Core/BSP/Pine64/Debug.cpp @@ -9,39 +9,39 @@ extern "C" { #include "gd32vf103_usart.h" } -char uartOutputBuffer[uartOutputBufferLength]; -volatile uint32_t currentOutputPos = 0xFF; -volatile uint32_t outputLength = 0; +char uartOutputBuffer[uartOutputBufferLength]; +volatile uint32_t currentOutputPos = 0xFF; +volatile uint32_t outputLength = 0; extern volatile uint8_t pendingPWM; -void log_system_state(int32_t PWMWattsx10) { - if (currentOutputPos == 0xFF) { +void log_system_state(int32_t PWMWattsx10) { + if (currentOutputPos == 0xFF) { - // Want to print a CSV log out the uart - // Tip_Temp_C,Handle_Temp_C,Output_Power_Wattx10,PWM,Tip_Raw\r\n - // 3+1+3+1+3+1+3+1+5+2 = 23, so sizing at 32 for now + // Want to print a CSV log out the uart + // Tip_Temp_C,Handle_Temp_C,Output_Power_Wattx10,PWM,Tip_Raw\r\n + // 3+1+3+1+3+1+3+1+5+2 = 23, so sizing at 32 for now - outputLength = snprintf(uartOutputBuffer, uartOutputBufferLength, "%lu,%u,%li,%u,%lu\r\n", // - TipThermoModel::getTipInC(false), // Tip temp in C - getHandleTemperature(), // Handle temp in C X10 - PWMWattsx10, // Output Wattage - pendingPWM, // PWM - TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0), true) // Tip temp in uV - ); + outputLength = snprintf(uartOutputBuffer, uartOutputBufferLength, "%lu,%u,%li,%u,%lu\r\n", // + TipThermoModel::getTipInC(false), // Tip temp in C + getHandleTemperature(), // Handle temp in C X10 + PWMWattsx10, // Output Wattage + pendingPWM, // PWM + TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0), true) // Tip temp in uV + ); - // Now print this out the uart via IRQ (DMA cant be used as oled has it) - currentOutputPos = 0; - /* enable USART1 Transmit Buffer Empty interrupt */ - usart_interrupt_enable(UART_PERIF, USART_INT_TBE); - } + // Now print this out the uart via IRQ (DMA cant be used as oled has it) + currentOutputPos = 0; + /* enable USART1 Transmit Buffer Empty interrupt */ + usart_interrupt_enable(UART_PERIF, USART_INT_TBE); + } } void USART1_IRQHandler(void) { - if (RESET != usart_interrupt_flag_get(UART_PERIF, USART_INT_FLAG_TBE)) { - /* write one byte to the transmit data register */ - usart_data_transmit(UART_PERIF, uartOutputBuffer[currentOutputPos++]); - if (currentOutputPos >= outputLength) { - currentOutputPos = 0xFF; // Mark done - usart_interrupt_disable(UART_PERIF, USART_INT_TBE); - } - } + if (RESET != usart_interrupt_flag_get(UART_PERIF, USART_INT_FLAG_TBE)) { + /* write one byte to the transmit data register */ + usart_data_transmit(UART_PERIF, uartOutputBuffer[currentOutputPos++]); + if (currentOutputPos >= outputLength) { + currentOutputPos = 0xFF; // Mark done + usart_interrupt_disable(UART_PERIF, USART_INT_TBE); + } + } } diff --git a/source/Core/BSP/Pine64/I2C_Wrapper.cpp b/source/Core/BSP/Pine64/I2C_Wrapper.cpp index c54380c0..04d1e288 100644 --- a/source/Core/BSP/Pine64/I2C_Wrapper.cpp +++ b/source/Core/BSP/Pine64/I2C_Wrapper.cpp @@ -23,353 +23,281 @@ uint8_t FRToSI2C::I2C_RegisterRead(uint8_t add, uint8_t reg) { return temp; } -bool FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t read_address, uint8_t *p_buffer, uint16_t number_of_byte) { - if (!lock()) - return false; +enum i2c_step { + // Write+read steps + Write_start, // Sending start on bus + Write_device_address, // start sent, send device address + Write_device_memory_address, // device address sent, write the memory location + Write_device_data_start, // Write all of the remaining data using DMA + Write_device_data_finish, // Write all of the remaining data using DMA + + Read_start, // second read + Read_device_address, // Send device address again for the read + Read_device_data_start, // read device data via DMA + Read_device_data_finish, // read device data via DMA + Send_stop, // send the stop at the end of the transaction + Wait_stop, // Wait for stop to send and we are done + Done, // Finished + Error_occured, // Error occured on the bus + +}; +struct i2c_state { + i2c_step currentStep; + bool isMemoryWrite; + bool wakePart; + uint8_t deviceAddress; + uint8_t memoryAddress; + uint8_t * buffer; + uint16_t numberOfBytes; + dma_parameter_struct dma_init_struct; +}; +volatile i2c_state currentState; + +void perform_i2c_step() { + // Performs next step of the i2c state machine + if (i2c_flag_get(I2C0, I2C_FLAG_AERR)) { + i2c_flag_clear(I2C0, I2C_FLAG_AERR); + // Arb error - we lost the bus / nacked + currentState.currentStep = Error_occured; + } else if (i2c_flag_get(I2C0, I2C_FLAG_BERR)) { + i2c_flag_clear(I2C0, I2C_FLAG_BERR); + // Bus Error + currentState.currentStep = Error_occured; + } else if (i2c_flag_get(I2C0, I2C_FLAG_LOSTARB)) { + i2c_flag_clear(I2C0, I2C_FLAG_LOSTARB); + // Bus Error + currentState.currentStep = Error_occured; + } else if (i2c_flag_get(I2C0, I2C_FLAG_PECERR)) { + i2c_flag_clear(I2C0, I2C_FLAG_PECERR); + // Bus Error + currentState.currentStep = Error_occured; + } + switch (currentState.currentStep) { + case Error_occured: + i2c_stop_on_bus(I2C0); + break; + case Write_start: + + /* enable acknowledge */ + i2c_ack_config(I2C0, I2C_ACK_ENABLE); + /* i2c master sends start signal only when the bus is idle */ + if (!i2c_flag_get(I2C0, I2C_FLAG_I2CBSY)) { + /* send the start signal */ + i2c_start_on_bus(I2C0); + currentState.currentStep = Write_device_address; + } + break; + + case Write_device_address: + /* i2c master sends START signal successfully */ + if (i2c_flag_get(I2C0, I2C_FLAG_SBSEND)) { + i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND); + i2c_master_addressing(I2C0, currentState.deviceAddress, I2C_TRANSMITTER); + currentState.currentStep = Write_device_memory_address; + } + break; + case Write_device_memory_address: + // Send the device memory location + + if (i2c_flag_get(I2C0, I2C_FLAG_ADDSEND)) { // addr sent + i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND); + + if (i2c_flag_get(I2C0, I2C_FLAG_BERR)) { + i2c_flag_clear(I2C0, I2C_FLAG_BERR); + // Bus Error + currentState.currentStep = Error_occured; + } else if (i2c_flag_get(I2C0, I2C_FLAG_AERR)) { + i2c_flag_clear(I2C0, I2C_FLAG_AERR); + // Arb error - we lost the bus / nacked + currentState.currentStep = Error_occured; + } else if (currentState.wakePart) { + // We are stopping here + currentState.currentStep = Send_stop; + } else if (i2c_flag_get(I2C0, I2C_FLAG_TBE)) { + // Write out the 8 byte address + i2c_data_transmit(I2C0, currentState.memoryAddress); + + if (currentState.isMemoryWrite) { + currentState.currentStep = Write_device_data_start; + } else { + currentState.currentStep = Read_start; + } + } + } + + break; + case Write_device_data_start: + + /* wait until BTC bit is set */ + if (i2c_flag_get(I2C0, I2C_FLAG_BTC)) { + /* enable I2C0 DMA */ + i2c_dma_enable(I2C0, I2C_DMA_ON); + /* enable DMA0 channel5 */ + dma_channel_enable(DMA0, DMA_CH5); + currentState.currentStep = Write_device_data_finish; + } + break; + + case Write_device_data_finish: // Wait for complete then goto stop + /* wait until BTC bit is set */ + if (dma_flag_get(DMA0, DMA_CH5, DMA_FLAG_FTF)) { + /* wait until BTC bit is set */ + if (i2c_flag_get(I2C0, I2C_FLAG_BTC)) { + currentState.currentStep = Send_stop; + } + } + break; + case Read_start: + /* wait until BTC bit is set */ + if (i2c_flag_get(I2C0, I2C_FLAG_BTC)) { + i2c_start_on_bus(I2C0); + currentState.currentStep = Read_device_address; + } + break; + case Read_device_address: + if (i2c_flag_get(I2C0, I2C_FLAG_SBSEND)) { + i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND); + i2c_master_addressing(I2C0, currentState.deviceAddress, I2C_RECEIVER); + currentState.currentStep = Read_device_data_start; + } + break; + case Read_device_data_start: + if (i2c_flag_get(I2C0, I2C_FLAG_ADDSEND)) { // addr sent + i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND); + if (i2c_flag_get(I2C0, I2C_FLAG_AERR)) { + // Arb error - we lost the bus / nacked + currentState.currentStep = Error_occured; + } + /* one byte master reception procedure (polling) */ + if (currentState.numberOfBytes == 0) { + currentState.currentStep = Send_stop; + } else if (currentState.numberOfBytes == 1) { + /* disable acknowledge */ + i2c_ack_config(I2C0, I2C_ACK_DISABLE); + /* clear ADDSEND register by reading I2C_STAT0 then I2C_STAT1 register + * (I2C_STAT0 has already been read) */ + i2c_flag_get(I2C0, I2C_FLAG_ADDSEND); // sat0 + i2c_flag_get(I2C0, I2C_FLAG_I2CBSY); // sat1 + /* send a stop condition to I2C bus*/ + i2c_stop_on_bus(I2C0); + /* wait for the byte to be received */ + while (!i2c_flag_get(I2C0, I2C_FLAG_RBNE)) + ; + /* read the byte received from the EEPROM */ + *currentState.buffer = i2c_data_receive(I2C0); + currentState.currentStep = Wait_stop; + } else { /* more than one byte master reception procedure (DMA) */ + /* enable I2C0 DMA */ + i2c_dma_enable(I2C0, I2C_DMA_ON); + /* enable DMA0 channel5 */ + dma_channel_enable(DMA0, DMA_CH6); + currentState.currentStep = Read_device_data_finish; + } + } + break; + case Read_device_data_finish: // Wait for complete then goto stop + /* wait until BTC bit is set */ + if (dma_flag_get(DMA0, DMA_CH6, DMA_FLAG_FTF)) { + currentState.currentStep = Send_stop; + } + + break; + case Send_stop: + /* send a stop condition to I2C bus*/ + i2c_stop_on_bus(I2C0); + currentState.currentStep = Wait_stop; + break; + case Wait_stop: + /* i2c master sends STOP signal successfully */ + if ((I2C_CTL0(I2C0) & 0x0200) != 0x0200) { + currentState.currentStep = Done; + } + break; + default: + // If we get here something is amiss + return; + } +} + +bool perform_i2c_transaction(uint16_t DevAddress, uint16_t memory_address, uint8_t *p_buffer, uint16_t number_of_byte, bool isWrite, bool isWakeOnly) { + { + // TODO is this required + /* disable I2C0 */ + i2c_disable(I2C0); + /* enable I2C0 */ + i2c_enable(I2C0); + } i2c_interrupt_disable(I2C0, I2C_INT_ERR); i2c_interrupt_disable(I2C0, I2C_INT_BUF); i2c_interrupt_disable(I2C0, I2C_INT_EV); - dma_parameter_struct dma_init_struct; - uint8_t state = I2C_START; - uint8_t in_rx_cycle = 0; - uint16_t timeout = 0; - uint8_t tries = 0; - uint8_t i2c_timeout_flag = 0; - while (!(i2c_timeout_flag)) { - switch (state) { - case I2C_START: - tries++; - if (tries > 64) { - i2c_stop_on_bus(I2C0); - /* i2c master sends STOP signal successfully */ - while ((I2C_CTL0(I2C0) & 0x0200) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - unlock(); - return false; - } - if (0 == in_rx_cycle) { - /* disable I2C0 */ - i2c_disable(I2C0); - /* enable I2C0 */ - i2c_enable(I2C0); + currentState.isMemoryWrite = isWrite; + currentState.wakePart = isWakeOnly; + currentState.deviceAddress = DevAddress; + currentState.memoryAddress = memory_address; + currentState.numberOfBytes = number_of_byte; + currentState.buffer = p_buffer; + if (!isWakeOnly) { + // Setup DMA + currentState.dma_init_struct.memory_width = DMA_MEMORY_WIDTH_8BIT; + currentState.dma_init_struct.memory_addr = (uint32_t)p_buffer; + currentState.dma_init_struct.memory_inc = DMA_MEMORY_INCREASE_ENABLE; + currentState.dma_init_struct.number = number_of_byte; + currentState.dma_init_struct.periph_addr = (uint32_t)&I2C_DATA(I2C0); + currentState.dma_init_struct.periph_inc = DMA_PERIPH_INCREASE_DISABLE; + currentState.dma_init_struct.periph_width = DMA_PERIPHERAL_WIDTH_8BIT; + currentState.dma_init_struct.priority = DMA_PRIORITY_ULTRA_HIGH; + if (currentState.isMemoryWrite) { + dma_deinit(DMA0, DMA_CH5); + currentState.dma_init_struct.direction = DMA_MEMORY_TO_PERIPHERAL; + dma_init(DMA0, DMA_CH5, (dma_parameter_struct *)¤tState.dma_init_struct); + } else { + dma_deinit(DMA0, DMA_CH6); + currentState.dma_init_struct.direction = DMA_PERIPHERAL_TO_MEMORY; + dma_init(DMA0, DMA_CH6, (dma_parameter_struct *)¤tState.dma_init_struct); + } - /* enable acknowledge */ - i2c_ack_config(I2C0, I2C_ACK_ENABLE); - /* i2c master sends start signal only when the bus is idle */ - while (i2c_flag_get(I2C0, I2C_FLAG_I2CBSY) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - if (timeout < I2C_TIME_OUT) { - /* send the start signal */ - i2c_start_on_bus(I2C0); - timeout = 0; - state = I2C_SEND_ADDRESS; - } else { - I2C_Unstick(); - timeout = 0; - state = I2C_START; - } - } else { - i2c_start_on_bus(I2C0); - timeout = 0; - state = I2C_SEND_ADDRESS; - } - break; - case I2C_SEND_ADDRESS: - /* i2c master sends START signal successfully */ - while ((!i2c_flag_get(I2C0, I2C_FLAG_SBSEND)) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - if (timeout < I2C_TIME_OUT) { - if (RESET == in_rx_cycle) { - i2c_master_addressing(I2C0, DevAddress, I2C_TRANSMITTER); - state = I2C_CLEAR_ADDRESS_FLAG; - } else { - i2c_master_addressing(I2C0, DevAddress, I2C_RECEIVER); - state = I2C_CLEAR_ADDRESS_FLAG; - } - timeout = 0; - } else { - timeout = 0; - state = I2C_START; - in_rx_cycle = 0; - } - break; - case I2C_CLEAR_ADDRESS_FLAG: - /* address flag set means i2c slave sends ACK */ - while ((!i2c_flag_get(I2C0, I2C_FLAG_ADDSEND)) && (timeout < I2C_TIME_OUT)) { - timeout++; - if (i2c_flag_get(I2C0, I2C_FLAG_AERR)) { - i2c_flag_clear(I2C0, I2C_FLAG_AERR); - i2c_stop_on_bus(I2C0); - /* i2c master sends STOP signal successfully */ - while ((I2C_CTL0(I2C0) & 0x0200) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - // Address NACK'd - unlock(); - return false; - } - } - if (timeout < I2C_TIME_OUT) { - i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND); - timeout = 0; - state = I2C_TRANSMIT_DATA; - } else { - i2c_stop_on_bus(I2C0); - /* i2c master sends STOP signal successfully */ - while ((I2C_CTL0(I2C0) & 0x0200) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - // Address NACK'd - unlock(); - return false; - } - break; - case I2C_TRANSMIT_DATA: - if (0 == in_rx_cycle) { - /* wait until the transmit data buffer is empty */ - while ((!i2c_flag_get(I2C0, I2C_FLAG_TBE)) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - if (timeout < I2C_TIME_OUT) { - // Write out the 8 byte address - i2c_data_transmit(I2C0, read_address); - timeout = 0; - } else { - timeout = 0; - state = I2C_START; - in_rx_cycle = 0; - } - /* wait until BTC bit is set */ - while ((!i2c_flag_get(I2C0, I2C_FLAG_BTC)) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - if (timeout < I2C_TIME_OUT) { - timeout = 0; - state = I2C_START; - in_rx_cycle = 1; - } else { - timeout = 0; - state = I2C_START; - in_rx_cycle = 0; - } - } else { - /* one byte master reception procedure (polling) */ - if (number_of_byte < 2) { - /* disable acknowledge */ - i2c_ack_config(I2C0, I2C_ACK_DISABLE); - /* clear ADDSEND register by reading I2C_STAT0 then I2C_STAT1 register - * (I2C_STAT0 has already been read) */ - i2c_flag_get(I2C0, I2C_FLAG_ADDSEND); - /* send a stop condition to I2C bus*/ - i2c_stop_on_bus(I2C0); - /* wait for the byte to be received */ - while (!i2c_flag_get(I2C0, I2C_FLAG_RBNE)) - ; - /* read the byte received from the EEPROM */ - *p_buffer = i2c_data_receive(I2C0); - /* decrement the read bytes counter */ - number_of_byte--; - timeout = 0; - } else { /* more than one byte master reception procedure (DMA) */ - dma_deinit(DMA0, DMA_CH6); - dma_init_struct.direction = DMA_PERIPHERAL_TO_MEMORY; - dma_init_struct.memory_addr = (uint32_t)p_buffer; - dma_init_struct.memory_inc = DMA_MEMORY_INCREASE_ENABLE; - dma_init_struct.memory_width = DMA_MEMORY_WIDTH_8BIT; - dma_init_struct.number = number_of_byte; - dma_init_struct.periph_addr = (uint32_t)&I2C_DATA(I2C0); - dma_init_struct.periph_inc = DMA_PERIPH_INCREASE_DISABLE; - dma_init_struct.periph_width = DMA_PERIPHERAL_WIDTH_8BIT; - dma_init_struct.priority = DMA_PRIORITY_ULTRA_HIGH; - dma_init(DMA0, DMA_CH6, &dma_init_struct); - - i2c_dma_last_transfer_config(I2C0, I2C_DMALST_ON); - /* enable I2C0 DMA */ - i2c_dma_enable(I2C0, I2C_DMA_ON); - /* enable DMA0 channel5 */ - dma_channel_enable(DMA0, DMA_CH6); - /* wait until BTC bit is set */ - while (!dma_flag_get(DMA0, DMA_CH6, DMA_FLAG_FTF)) {} - /* send a stop condition to I2C bus*/ - i2c_stop_on_bus(I2C0); - } - timeout = 0; - state = I2C_STOP; - } - break; - case I2C_STOP: - /* i2c master sends STOP signal successfully */ - while ((I2C_CTL0(I2C0) & 0x0200) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - if (timeout < I2C_TIME_OUT) { - timeout = 0; - state = I2C_END; - i2c_timeout_flag = I2C_OK; - } else { - timeout = 0; - state = I2C_START; - in_rx_cycle = 0; - } - break; - default: - state = I2C_START; - in_rx_cycle = 0; - i2c_timeout_flag = I2C_OK; - timeout = 0; - break; + if (!currentState.isMemoryWrite) { + i2c_dma_last_transfer_config(I2C0, I2C_DMALST_ON); } } + // Clear flags + I2C_STAT0(I2C0) = 0; + I2C_STAT1(I2C0) = 0; + i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND); + + currentState.currentStep = Write_start; // Always start in write mode + TickType_t timeout = xTaskGetTickCount() + TICKS_SECOND; + while ((currentState.currentStep != Done) && (currentState.currentStep != Error_occured)) { + if (xTaskGetTickCount() > timeout) { + i2c_stop_on_bus(I2C0); + return false; + } + perform_i2c_step(); + } + return currentState.currentStep == Done; +} + +bool FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t read_address, uint8_t *p_buffer, uint16_t number_of_byte) { + if (!lock()) + return false; + bool res = perform_i2c_transaction(DevAddress, read_address, p_buffer, number_of_byte, false, false); + if (!res) { + I2C_Unstick(); + } unlock(); - return true; + return res; } bool FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress, uint8_t *p_buffer, uint16_t number_of_byte) { if (!lock()) return false; - - i2c_interrupt_disable(I2C0, I2C_INT_ERR); - i2c_interrupt_disable(I2C0, I2C_INT_EV); - i2c_interrupt_disable(I2C0, I2C_INT_BUF); - dma_parameter_struct dma_init_struct; - - uint8_t state = I2C_START; - uint16_t timeout = 0; - bool done = false; - bool timedout = false; - while (!(done || timedout)) { - switch (state) { - case I2C_START: - /* i2c master sends start signal only when the bus is idle */ - while (i2c_flag_get(I2C0, I2C_FLAG_I2CBSY) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - if (timeout < I2C_TIME_OUT) { - i2c_start_on_bus(I2C0); - timeout = 0; - state = I2C_SEND_ADDRESS; - } else { - I2C_Unstick(); - timeout = 0; - state = I2C_START; - } - break; - case I2C_SEND_ADDRESS: - /* i2c master sends START signal successfully */ - while ((!i2c_flag_get(I2C0, I2C_FLAG_SBSEND)) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - if (timeout < I2C_TIME_OUT) { - i2c_master_addressing(I2C0, DevAddress, I2C_TRANSMITTER); - timeout = 0; - state = I2C_CLEAR_ADDRESS_FLAG; - } else { - timedout = true; - done = true; - timeout = 0; - state = I2C_START; - } - break; - case I2C_CLEAR_ADDRESS_FLAG: - /* address flag set means i2c slave sends ACK */ - while ((!i2c_flag_get(I2C0, I2C_FLAG_ADDSEND)) && (timeout < I2C_TIME_OUT)) { - timeout++; - if (i2c_flag_get(I2C0, I2C_FLAG_AERR)) { - i2c_flag_clear(I2C0, I2C_FLAG_AERR); - i2c_stop_on_bus(I2C0); - /* i2c master sends STOP signal successfully */ - while ((I2C_CTL0(I2C0) & 0x0200) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - // Address NACK'd - unlock(); - return false; - } - } - timeout = 0; - if (timeout < I2C_TIME_OUT) { - i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND); - state = I2C_TRANSMIT_DATA; - } else { - // Dont retry as this means a NAK - i2c_stop_on_bus(I2C0); - /* i2c master sends STOP signal successfully */ - while ((I2C_CTL0(I2C0) & 0x0200) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - unlock(); - return false; - } - break; - case I2C_TRANSMIT_DATA: - /* wait until the transmit data buffer is empty */ - while ((!i2c_flag_get(I2C0, I2C_FLAG_TBE)) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - if (timeout < I2C_TIME_OUT) { - /* send the EEPROM's internal address to write to : only one byte - * address */ - i2c_data_transmit(I2C0, MemAddress); - timeout = 0; - } else { - timedout = true; - timeout = 0; - state = I2C_START; - } - /* wait until BTC bit is set */ - while (!i2c_flag_get(I2C0, I2C_FLAG_BTC)) - ; - dma_deinit(DMA0, DMA_CH5); - dma_init_struct.direction = DMA_MEMORY_TO_PERIPHERAL; - dma_init_struct.memory_addr = (uint32_t)p_buffer; - dma_init_struct.memory_inc = DMA_MEMORY_INCREASE_ENABLE; - dma_init_struct.memory_width = DMA_MEMORY_WIDTH_8BIT; - dma_init_struct.number = number_of_byte; - dma_init_struct.periph_addr = (uint32_t)&I2C_DATA(I2C0); - dma_init_struct.periph_inc = DMA_PERIPH_INCREASE_DISABLE; - dma_init_struct.periph_width = DMA_PERIPHERAL_WIDTH_8BIT; - dma_init_struct.priority = DMA_PRIORITY_ULTRA_HIGH; - dma_init(DMA0, DMA_CH5, &dma_init_struct); - /* enable I2C0 DMA */ - i2c_dma_enable(I2C0, I2C_DMA_ON); - /* enable DMA0 channel5 */ - dma_channel_enable(DMA0, DMA_CH5); - /* wait until BTC bit is set */ - while (!dma_flag_get(DMA0, DMA_CH5, DMA_FLAG_FTF)) {} - /* wait until BTC bit is set */ - while (!i2c_flag_get(I2C0, I2C_FLAG_BTC)) {} - state = I2C_STOP; - break; - case I2C_STOP: - /* send a stop condition to I2C bus */ - i2c_stop_on_bus(I2C0); - /* i2c master sends STOP signal successfully */ - while ((I2C_CTL0(I2C0) & 0x0200) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - if (timeout < I2C_TIME_OUT) { - timeout = 0; - state = I2C_END; - done = true; - } else { - timedout = true; - done = true; - timeout = 0; - state = I2C_START; - } - break; - default: - state = I2C_START; - timeout = 0; - break; - } + bool res = perform_i2c_transaction(DevAddress, MemAddress, p_buffer, number_of_byte, true, false); + if (!res) { + I2C_Unstick(); } unlock(); - return timedout == false; + return res; } bool FRToSI2C::Transmit(uint16_t DevAddress, uint8_t *pData, uint16_t Size) { return Mem_Write(DevAddress, pData[0], pData + 1, Size - 1); } @@ -406,104 +334,15 @@ bool FRToSI2C::wakePart(uint16_t DevAddress) { // wakepart is a special case where only the device address is sent if (!lock()) return false; - - i2c_interrupt_disable(I2C0, I2C_INT_ERR); - i2c_interrupt_disable(I2C0, I2C_INT_EV); - i2c_interrupt_disable(I2C0, I2C_INT_BUF); - - uint8_t state = I2C_START; - uint16_t timeout = 0; - bool done = false; - bool timedout = false; - while (!(done || timedout)) { - switch (state) { - case I2C_START: - /* i2c master sends start signal only when the bus is idle */ - while (i2c_flag_get(I2C0, I2C_FLAG_I2CBSY) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - if (timeout < I2C_TIME_OUT) { - i2c_start_on_bus(I2C0); - timeout = 0; - state = I2C_SEND_ADDRESS; - } else { - I2C_Unstick(); - timeout = 0; - state = I2C_START; - } - break; - case I2C_SEND_ADDRESS: - /* i2c master sends START signal successfully */ - while ((!i2c_flag_get(I2C0, I2C_FLAG_SBSEND)) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - if (timeout < I2C_TIME_OUT) { - i2c_master_addressing(I2C0, DevAddress, I2C_TRANSMITTER); - timeout = 0; - state = I2C_CLEAR_ADDRESS_FLAG; - } else { - timedout = true; - done = true; - timeout = 0; - state = I2C_START; - } - break; - case I2C_CLEAR_ADDRESS_FLAG: - /* address flag set means i2c slave sends ACK */ - while ((!i2c_flag_get(I2C0, I2C_FLAG_ADDSEND)) && (timeout < I2C_TIME_OUT)) { - timeout++; - if (i2c_flag_get(I2C0, I2C_FLAG_AERR)) { - i2c_flag_clear(I2C0, I2C_FLAG_AERR); - i2c_stop_on_bus(I2C0); - /* i2c master sends STOP signal successfully */ - while ((I2C_CTL0(I2C0) & 0x0200) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - // Address NACK'd - unlock(); - return false; - } - } - if (timeout < I2C_TIME_OUT) { - i2c_flag_clear(I2C0, I2C_FLAG_ADDSEND); - timeout = 0; - state = I2C_STOP; - } else { - // Dont retry as this means a NAK - i2c_stop_on_bus(I2C0); - /* i2c master sends STOP signal successfully */ - while ((I2C_CTL0(I2C0) & 0x0200) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - unlock(); - return false; - } - break; - - case I2C_STOP: - /* send a stop condition to I2C bus */ - i2c_stop_on_bus(I2C0); - /* i2c master sends STOP signal successfully */ - while ((I2C_CTL0(I2C0) & 0x0200) && (timeout < I2C_TIME_OUT)) { - timeout++; - } - if (timeout < I2C_TIME_OUT) { - timeout = 0; - state = I2C_END; - done = true; - } else { - timedout = true; - done = true; - timeout = 0; - state = I2C_START; - } - break; - default: - state = I2C_START; - timeout = 0; - break; - } + bool res = perform_i2c_transaction(DevAddress, 0, NULL, 0, false, true); + if (!res) { + I2C_Unstick(); } unlock(); - return timedout == false; + return res; +} + +void I2C_EV_IRQ() {} +void I2C_ER_IRQ() { + // Error callbacks } diff --git a/source/Core/Drivers/FUSB302/policy_engine.cpp b/source/Core/Drivers/FUSB302/policy_engine.cpp index 5ce5428e..e8358f5b 100644 --- a/source/Core/Drivers/FUSB302/policy_engine.cpp +++ b/source/Core/Drivers/FUSB302/policy_engine.cpp @@ -411,10 +411,9 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_ready() { return PESinkSendSoftReset; } - /* If we got an unknown message, send a soft reset ??? */ } else { - - return PESinkSendSoftReset; + /* if we get an unknown message code, silently ignore it*/ + return PESinkReady; } } } diff --git a/source/Core/Drivers/Font.h b/source/Core/Drivers/Font.h index 5ada9fd4..c6b5180e 100644 --- a/source/Core/Drivers/Font.h +++ b/source/Core/Drivers/Font.h @@ -150,6 +150,42 @@ const uint8_t disconnectedTipIcon[] = { * */ const uint8_t SettingsMenuIcons[] = { + // Power + // width = 16 + // height = 16 + 0xC0, + 0xB0, + 0x8C, + 0x83, + 0x01, + 0x01, + 0x21, + 0x31, + 0xA9, + 0x65, + 0x03, + 0x42, + 0x62, + 0x52, + 0xCA, + 0x06, + 0x60, + 0x58, + 0x26, + 0x11, + 0x08, + 0xC4, + 0xB2, + 0x4D, + 0x23, + 0x10, + 0x08, + 0x04, + 0x02, + 0x01, + 0x00, + 0x00, + // Soldering // width = 16 // height = 16 diff --git a/source/Core/Drivers/TipThermoModel.h b/source/Core/Drivers/TipThermoModel.h index 4af4ab3c..b595c736 100644 --- a/source/Core/Drivers/TipThermoModel.h +++ b/source/Core/Drivers/TipThermoModel.h @@ -21,7 +21,7 @@ public: static uint32_t convertTipRawADCToDegC(uint16_t rawADC); static uint32_t convertTipRawADCToDegF(uint16_t rawADC); // Returns the uV of the tip reading before the op-amp compensating for pullups - static uint32_t convertTipRawADCTouV(uint16_t rawADC,bool skipCalOffset=false); + static uint32_t convertTipRawADCTouV(uint16_t rawADC, bool skipCalOffset = false); static uint32_t convertCtoF(uint32_t degC); static uint32_t convertFtoC(uint32_t degF); diff --git a/source/Core/Inc/Settings.h b/source/Core/Inc/Settings.h index 95170db2..828fa334 100644 --- a/source/Core/Inc/Settings.h +++ b/source/Core/Inc/Settings.h @@ -10,7 +10,7 @@ #ifndef SETTINGS_H_ #define SETTINGS_H_ #include -#define SETTINGSVERSION (0x25) +#define SETTINGSVERSION (0x26) /*Change this if you change the struct below to prevent people getting \ out of sync*/ @@ -25,6 +25,7 @@ typedef struct { uint16_t SleepTemp; // temp to drop to in sleep uint8_t SleepTime; // minutes timeout to sleep uint8_t minDCVoltageCells; // The voltage we cut out at for under voltage when powered by DC jack + uint8_t minVoltageCells; // Minimum allowed voltage per cell <3S - 3.0V (30)> <4S - 2.4V (24)> <...> (Minimum recommended 2.7V) uint8_t QCIdealVoltage; // Desired QC3.0 voltage (9,12,20V) uint8_t OrientationMode : 2; // Selects between Auto,Right and left handed layouts uint8_t sensitivity : 4; // Sensitivity of accelerometer (5 bits) @@ -32,11 +33,11 @@ typedef struct { // into soldering mode when power is applied uint8_t ShutdownTime; // Time until unit shuts down if left alone - uint8_t coolingTempBlink : 1; // Should the temperature blink on the cool - // down screen until its <50C - uint8_t detailedIDLE : 1; // Detailed idle screen - uint8_t detailedSoldering : 1; // Detailed soldering screens - uint8_t temperatureInF : 1; // Should the temp be in F or C (true is F) + uint8_t coolingTempBlink : 1; // Should the temperature blink on the cool + // down screen until its <50C + uint8_t detailedIDLE : 1; // Detailed idle screen + uint8_t detailedSoldering : 1; // Detailed soldering screens + uint8_t temperatureInF : 1; // Should the temp be in F or C (true is F) uint8_t descriptionScrollSpeed : 1; // Description scroll speed uint8_t lockingMode : 2; // Store the locking mode uint8_t KeepAwakePulse; // Keep Awake pulse power in 0.1 watts (10 = 1Watt) diff --git a/source/Core/Inc/Translation.h b/source/Core/Inc/Translation.h index 018303cc..21507b8c 100644 --- a/source/Core/Inc/Translation.h +++ b/source/Core/Inc/Translation.h @@ -10,11 +10,11 @@ #include "stdint.h" extern const uint8_t USER_FONT_12[]; extern const uint8_t USER_FONT_6x8[]; -extern const bool HasFahrenheit; +extern const bool HasFahrenheit; extern const char *SettingsShortNames[29][2]; extern const char *SettingsDescriptions[29]; -extern const char *SettingsMenuEntries[4]; +extern const char *SettingsMenuEntries[5]; extern const char *SettingsCalibrationDone; extern const char *SettingsCalibrationWarning; @@ -60,6 +60,7 @@ extern const char *SettingSensitivityHigh; extern const char *SettingLockDisableChar; extern const char *SettingLockBoostChar; extern const char *SettingLockFullChar; +extern const char *SettingNAChar; extern const char *SettingFastChar; extern const char *SettingSlowChar; diff --git a/source/Core/Src/Settings.cpp b/source/Core/Src/Settings.cpp index 9cdb44ce..3cdc8296 100644 --- a/source/Core/Src/Settings.cpp +++ b/source/Core/Src/Settings.cpp @@ -46,28 +46,29 @@ uint8_t lookupVoltageLevel() { if (systemSettings.minDCVoltageCells == 0) return 90; // 9V since iron does not function effectively below this else - return (systemSettings.minDCVoltageCells * 33) + (33 * 2); + return (systemSettings.minDCVoltageCells * systemSettings.minVoltageCells) + (systemSettings.minVoltageCells * 2); } void resetSettings() { memset((void *)&systemSettings, 0, sizeof(systemSettingsType)); systemSettings.SleepTemp = SLEEP_TEMP; // Temperature the iron sleeps at - default 150.0 C systemSettings.SleepTime = SLEEP_TIME; // How many seconds/minutes we wait until going // to sleep - default 1 min - systemSettings.SolderingTemp = SOLDERING_TEMP; // Default soldering temp is 320.0 C - systemSettings.minDCVoltageCells = CUT_OUT_SETTING; // default to no cut-off voltage - systemSettings.QCIdealVoltage = 0; // Default to 9V for QC3.0 Voltage - systemSettings.version = SETTINGSVERSION; // Store the version number to allow for easier upgrades - systemSettings.detailedSoldering = DETAILED_SOLDERING; // Detailed soldering screen - systemSettings.detailedIDLE = DETAILED_IDLE; // Detailed idle screen (off for first time users) - systemSettings.OrientationMode = ORIENTATION_MODE; // Default to automatic - systemSettings.sensitivity = SENSITIVITY; // Default high sensitivity - systemSettings.voltageDiv = VOLTAGE_DIV; // Default divider from schematic - systemSettings.ShutdownTime = SHUTDOWN_TIME; // How many minutes until the unit turns itself off - systemSettings.BoostTemp = BOOST_TEMP; // default to 400C - systemSettings.autoStartMode = AUTO_START_MODE; // Auto start off for safety - systemSettings.lockingMode = LOCKING_MODE; // Disable locking for safety - systemSettings.coolingTempBlink = COOLING_TEMP_BLINK; // Blink the temperature on the cooling screen when its > 50C - systemSettings.temperatureInF = TEMPERATURE_INF; // default to 0 + systemSettings.SolderingTemp = SOLDERING_TEMP; // Default soldering temp is 320.0 C + systemSettings.minDCVoltageCells = CUT_OUT_SETTING; // default to no cut-off voltage + systemSettings.minVoltageCells = RECOM_VOL_CELL; // Minimum voltage per cell (Recommended 3.3V (33)) + systemSettings.QCIdealVoltage = 0; // Default to 9V for QC3.0 Voltage + systemSettings.version = SETTINGSVERSION; // Store the version number to allow for easier upgrades + systemSettings.detailedSoldering = DETAILED_SOLDERING; // Detailed soldering screen + systemSettings.detailedIDLE = DETAILED_IDLE; // Detailed idle screen (off for first time users) + systemSettings.OrientationMode = ORIENTATION_MODE; // Default to automatic + systemSettings.sensitivity = SENSITIVITY; // Default high sensitivity + systemSettings.voltageDiv = VOLTAGE_DIV; // Default divider from schematic + systemSettings.ShutdownTime = SHUTDOWN_TIME; // How many minutes until the unit turns itself off + systemSettings.BoostTemp = BOOST_TEMP; // default to 400C + systemSettings.autoStartMode = AUTO_START_MODE; // Auto start off for safety + systemSettings.lockingMode = LOCKING_MODE; // Disable locking for safety + systemSettings.coolingTempBlink = COOLING_TEMP_BLINK; // Blink the temperature on the cooling screen when its > 50C + systemSettings.temperatureInF = TEMPERATURE_INF; // default to 0 systemSettings.descriptionScrollSpeed = DESCRIPTION_SCROLL_SPEED; // default to slow systemSettings.CalibrationOffset = CALIBRATION_OFFSET; // the adc offset in uV systemSettings.powerLimit = POWER_LIMIT; // 30 watts default limit diff --git a/source/Core/Src/gui.cpp b/source/Core/Src/gui.cpp index 20a9284c..9b9f254f 100644 --- a/source/Core/Src/gui.cpp +++ b/source/Core/Src/gui.cpp @@ -19,6 +19,8 @@ void gui_Menu(const menuitem *menu); #ifdef POW_DC static bool settings_setInputVRange(void); static void settings_displayInputVRange(void); +static bool settings_setInputMinVRange(void); +static void settings_displayInputMinVRange(void); #endif #ifdef POW_QC static bool settings_setQCInputV(void); @@ -73,10 +75,12 @@ static void settings_displayHallEffect(void); static bool settings_setHallEffect(void); #endif // Menu functions -static void settings_displaySolderingMenu(void); -static bool settings_enterSolderingMenu(void); static void settings_displayPowerMenu(void); static bool settings_enterPowerMenu(void); +static void settings_displaySolderingMenu(void); +static bool settings_enterSolderingMenu(void); +static void settings_displayPowerSavingMenu(void); +static bool settings_enterPowerSavingMenu(void); static void settings_displayUIMenu(void); static bool settings_enterUIMenu(void); static void settings_displayAdvancedMenu(void); @@ -84,7 +88,9 @@ static bool settings_enterAdvancedMenu(void); /* * Root Settings Menu * - * Power Source + * Power Menu + * Power Source + * * Soldering * Boost Mode Enabled * Boost Mode Temp @@ -121,26 +127,34 @@ static bool settings_enterAdvancedMenu(void); */ const menuitem rootSettingsMenu[]{ /* - * Power Source + * Power Menu * Soldering Menu * Power Saving Menu * UI Menu * Advanced Menu * Exit */ -#ifdef POW_DC - {(const char *)SettingsDescriptions[0], settings_setInputVRange, settings_displayInputVRange}, /*Voltage input*/ -#endif -#ifdef POW_QC - {(const char *)SettingsDescriptions[19], settings_setQCInputV, settings_displayQCInputV}, /*Voltage input*/ -#endif + {(const char *)NULL, settings_enterPowerMenu, settings_displayPowerMenu}, /*Power*/ {(const char *)NULL, settings_enterSolderingMenu, settings_displaySolderingMenu}, /*Soldering*/ - {(const char *)NULL, settings_enterPowerMenu, settings_displayPowerMenu}, /*Sleep Options Menu*/ + {(const char *)NULL, settings_enterPowerSavingMenu, settings_displayPowerSavingMenu}, /*Sleep Options Menu*/ {(const char *)NULL, settings_enterUIMenu, settings_displayUIMenu}, /*UI Menu*/ {(const char *)NULL, settings_enterAdvancedMenu, settings_displayAdvancedMenu}, /*Advanced Menu*/ {NULL, NULL, NULL} // end of menu marker. DO NOT REMOVE }; +const menuitem powerMenu[] = { + /* + * Power Source + */ +#ifdef POW_DC + {(const char *)SettingsDescriptions[0], settings_setInputVRange, settings_displayInputVRange}, /*Voltage input*/ + {(const char *)SettingsDescriptions[28], settings_setInputMinVRange, settings_displayInputMinVRange}, /*Minimum voltage input*/ +#endif +#ifdef POW_QC + {(const char *)SettingsDescriptions[19], settings_setQCInputV, settings_displayQCInputV}, /*Voltage input*/ +#endif + {NULL, NULL, NULL} // end of menu marker. DO NOT REMOVE +}; const menuitem solderingMenu[] = { /* * Boost Mode Enabled @@ -157,22 +171,23 @@ const menuitem solderingMenu[] = { {NULL, NULL, NULL} // end of menu marker. DO NOT REMOVE }; const menuitem UIMenu[] = { -/* - // Language - * Scrolling Speed - * Temperature Unit - * Display orientation - * Cooldown blink - * Reverse Temp change buttons + - - */ - {(const char *)SettingsDescriptions[5], settings_setTempF, settings_displayTempF}, /* Temperature units, this has to be the first element in the array to work with the logic in settings_enterUIMenu() */ + /* + // Language + * Scrolling Speed + * Temperature Unit + * Display orientation + * Cooldown blink + * Reverse Temp change buttons + - + */ + {(const char *)SettingsDescriptions[5], settings_setTempF, + settings_displayTempF}, /* Temperature units, this has to be the first element in the array to work with the logic in settings_enterUIMenu() */ {(const char *)SettingsDescriptions[7], settings_setDisplayRotation, settings_displayDisplayRotation}, /*Display Rotation*/ {(const char *)SettingsDescriptions[10], settings_setCoolingBlinkEnabled, settings_displayCoolingBlinkEnabled}, /*Cooling blink warning*/ {(const char *)SettingsDescriptions[15], settings_setScrollSpeed, settings_displayScrollSpeed}, /*Scroll Speed for descriptions*/ {(const char *)SettingsDescriptions[21], settings_setReverseButtonTempChangeEnabled, settings_displayReverseButtonTempChangeEnabled}, /* Reverse Temp change buttons + - */ {NULL, NULL, NULL} // end of menu marker. DO NOT REMOVE }; -const menuitem PowerMenu[] = { +const menuitem PowerSavingMenu[] = { /* * Sleep Temp * Sleep Time @@ -293,6 +308,8 @@ static int userConfirmation(const char *message) { #ifdef POW_DC static bool settings_setInputVRange(void) { systemSettings.minDCVoltageCells = (systemSettings.minDCVoltageCells + 1) % 5; + if (systemSettings.minDCVoltageCells == 1 && systemSettings.minVoltageCells < 30) + systemSettings.minVoltageCells = 30; return systemSettings.minDCVoltageCells == 4; } @@ -306,6 +323,27 @@ static void settings_displayInputVRange(void) { OLED::print(SymbolDC); } } + +static bool settings_setInputMinVRange(void) { + systemSettings.minVoltageCells = (systemSettings.minVoltageCells + 1) % 38; + if (systemSettings.minDCVoltageCells == 1 && systemSettings.minVoltageCells < 30) + systemSettings.minVoltageCells = 30; + else if(systemSettings.minVoltageCells < 24) + systemSettings.minVoltageCells = 24; + return systemSettings.minVoltageCells == 37; +} + +static void settings_displayInputMinVRange(void) { + if (systemSettings.minDCVoltageCells) { + printShortDescription(28, 4); + OLED::printNumber(systemSettings.minVoltageCells / 10, 2); + OLED::print(SymbolDot); + OLED::printNumber(systemSettings.minVoltageCells % 10, 1); + } else { + printShortDescription(28, 5); + OLED::print(SettingNAChar); + } +} #endif #ifdef POW_QC static bool settings_setQCInputV(void) { @@ -822,9 +860,15 @@ static void settings_displayTempChangeShortStep(void) { } static bool settings_setTempChangeLongStep(void) { - systemSettings.TempChangeLongStep += TEMP_CHANGE_LONG_STEP; + if (systemSettings.TempChangeLongStep == TEMP_CHANGE_SHORT_STEP) { + systemSettings.TempChangeLongStep = TEMP_CHANGE_LONG_STEP / 2; + } else if (systemSettings.TempChangeLongStep == TEMP_CHANGE_LONG_STEP / 2) { + systemSettings.TempChangeLongStep = TEMP_CHANGE_LONG_STEP; + } else { + systemSettings.TempChangeLongStep += TEMP_CHANGE_LONG_STEP; + } if (systemSettings.TempChangeLongStep > TEMP_CHANGE_LONG_STEP_MAX) { - systemSettings.TempChangeLongStep = TEMP_CHANGE_LONG_STEP; // loop back at TEMP_CHANGE_LONG_STEP_MAX + systemSettings.TempChangeLongStep = TEMP_CHANGE_SHORT_STEP; // loop back at TEMP_CHANGE_LONG_STEP_MAX } return systemSettings.TempChangeLongStep == TEMP_CHANGE_LONG_STEP_MAX; } @@ -897,22 +941,27 @@ static void displayMenu(size_t index) { } static void settings_displayCalibrateVIN(void) { printShortDescription(13, 5); } -static void settings_displaySolderingMenu(void) { displayMenu(0); } +static void settings_displayPowerMenu(void) { displayMenu(0); } +static bool settings_enterPowerMenu(void) { + gui_Menu(powerMenu); + return false; +} +static void settings_displaySolderingMenu(void) { displayMenu(1); } static bool settings_enterSolderingMenu(void) { gui_Menu(solderingMenu); return false; } -static void settings_displayPowerMenu(void) { displayMenu(1); } -static bool settings_enterPowerMenu(void) { - gui_Menu(PowerMenu); +static void settings_displayPowerSavingMenu(void) { displayMenu(2); } +static bool settings_enterPowerSavingMenu(void) { + gui_Menu(PowerSavingMenu); return false; } -static void settings_displayUIMenu(void) { displayMenu(2); } +static void settings_displayUIMenu(void) { displayMenu(3); } static bool settings_enterUIMenu(void) { gui_Menu(HasFahrenheit ? UIMenu : UIMenu + 1); return false; } -static void settings_displayAdvancedMenu(void) { displayMenu(3); } +static void settings_displayAdvancedMenu(void) { displayMenu(4); } static bool settings_enterAdvancedMenu(void) { gui_Menu(advancedMenu); return false; diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp index d1ccd054..f58a1e8c 100644 --- a/source/Core/Threads/GUIThread.cpp +++ b/source/Core/Threads/GUIThread.cpp @@ -70,8 +70,7 @@ void gui_drawTipTemp(bool symbol) { uint32_t Temp = 0; if (systemSettings.temperatureInF) { Temp = TipThermoModel::getTipInF(); - } else - { + } else { Temp = TipThermoModel::getTipInC(); } @@ -160,10 +159,10 @@ static void gui_drawBatteryIcon() { uint8_t cellCount = systemSettings.minDCVoltageCells + 2; uint32_t cellV = getInputVoltageX10(systemSettings.voltageDiv, 0) / cellCount; // Should give us approx cell voltage X10 - // Range is 42 -> 33 = 9 steps therefore we will use battery 0-9 - if (cellV < 33) - cellV = 33; - cellV -= 33; // Should leave us a number of 0-9 + // Range is 42 -> Minimum voltage setting (systemSettings.minVoltageCells) = 9 steps therefore we will use battery 0-9 + if (cellV < systemSettings.minVoltageCells) + cellV = systemSettings.minVoltageCells; + cellV -= systemSettings.minVoltageCells; // Should leave us a number of 0-9 if (cellV > 9) cellV = 9; OLED::drawBattery(cellV + 1); @@ -274,8 +273,7 @@ static void gui_solderingTempAdjust() { OLED::printNumber(systemSettings.SolderingTemp, 3); if (systemSettings.temperatureInF) OLED::drawSymbol(0); - else - { + else { OLED::drawSymbol(1); } OLED::print(SymbolSpace); @@ -410,7 +408,7 @@ static bool shouldBeSleeping(bool inAutoStart) { } } if (lastMovementTime > 0 || lastButtonTime > 0) { - if ((xTaskGetTickCount() - lastMovementTime) > getSleepTimeout() && (xTaskGetTickCount() - lastButtonTime) > getSleepTimeout()) { + if (((xTaskGetTickCount() - lastMovementTime) > getSleepTimeout()) && ((xTaskGetTickCount() - lastButtonTime) > getSleepTimeout())) { return true; } } @@ -419,7 +417,7 @@ static bool shouldBeSleeping(bool inAutoStart) { #ifdef HALL_SENSOR // If the hall effect sensor is enabled in the build, check if its over // threshold, and if so then we force sleep - if (lookupHallEffectThreshold()) { + if (getHallSensorFitted() && lookupHallEffectThreshold()) { int16_t hallEffectStrength = getRawHallEffect(); if (hallEffectStrength < 0) hallEffectStrength = -hallEffectStrength; diff --git a/source/Makefile b/source/Makefile index 95175df5..9636c99c 100644 --- a/source/Makefile +++ b/source/Makefile @@ -319,7 +319,7 @@ $(OUT_OBJS_S): $(OUTPUT_DIR)/%.o: %.S Makefile @echo 'Building file: $<' @$(AS) -c $(AFLAGS) $< -o $@ -Core/Gen/Translation.%.cpp: ../Translations/translation_%.json Makefile ../Translations/make_translation.py ../Translations/translations_commons.js +Core/Gen/Translation.%.cpp: ../Translations/translation_%.json Makefile ../Translations/make_translation.py ../Translations/translations_commons.js ../Translations/fontTables.py ../Translations/wqy-bitmapsong/wenquanyi_9pt.bdf @test -d $(@D) || mkdir -p $(@D) @echo 'Generating translations for language $*' @python3 ../Translations/make_translation.py -o $(PWD)/$@ $* diff --git a/source/configuration.h b/source/configuration.h index 6ae7d372..a326dfc8 100644 --- a/source/configuration.h +++ b/source/configuration.h @@ -88,9 +88,10 @@ #define DETAILED_SOLDERING 0 // 0: Disable 1: Enable - Default 0 #define DETAILED_IDLE 0 // 0: Disable 1: Enable - Default 0 -#define CUT_OUT_SETTING 0 // default to no cut-off voltage -#define TEMPERATURE_INF 0 // default to 0 -#define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow +#define CUT_OUT_SETTING 0 // default to no cut-off voltage +#define RECOM_VOL_CELL 33 // Minimum voltage per cell (Recommended 3.3V (33)) +#define TEMPERATURE_INF 0 // default to 0 +#define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow #define OP_AMP_Rf_TS100 750 * 1000 // 750 Kilo-ohms -> From schematic, R1 #define OP_AMP_Rin_TS100 2370 // 2.37 Kilo-ohms -> From schematic, R2 diff --git a/source/version.h b/source/version.h index 96fba0c7..c7d32e68 100644 --- a/source/version.h +++ b/source/version.h @@ -4,4 +4,4 @@ * i.e.: BUILD_VERSION = 'Rel. v2.08' --> Will generated to: 'v2.08.1a2b3c4' */ -#define BUILD_VERSION "v2.14" +#define BUILD_VERSION "v2.15"