Skip to content

Commit b72d0d9

Browse files
Laurence BankLaurence Bank
authored andcommitted
fixed new positioning method
1 parent 63d89ce commit b72d0d9

File tree

1 file changed

+13
-29
lines changed

1 file changed

+13
-29
lines changed

src/obd.inl

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,7 @@ unsigned char c, *s, ucTemp[40];
17451745
{
17461746
i = 0;
17471747
iFontSkip = iScroll & 7; // number of columns to initially skip
1748-
while (pOBD->iCursorX < pOBD->width && szMsg[i] != 0 && pOBD->iCursorY < pOBD->height / 8)
1748+
while (pOBD->iCursorX < pOBD->width && szMsg[i] != 0 && pOBD->iCursorY < pOBD->height)
17491749
{
17501750
if (iScroll < 8) // only display visible characters
17511751
{
@@ -1764,7 +1764,7 @@ unsigned char c, *s, ucTemp[40];
17641764
if (pOBD->iCursorX >= pOBD->width-7 && pOBD->wrap) // word wrap enabled?
17651765
{
17661766
pOBD->iCursorX = 0; // start at the beginning of the next line
1767-
pOBD->iCursorY++;
1767+
pOBD->iCursorY+=8;
17681768
obdSetPosition(pOBD, pOBD->iCursorX, pOBD->iCursorY, bRender);
17691769
}
17701770
iFontSkip = 0;
@@ -1773,16 +1773,14 @@ unsigned char c, *s, ucTemp[40];
17731773
i++;
17741774
} // while
17751775
obdCachedFlush(pOBD, bRender); // write any remaining data
1776-
pOBD->iCursorX = x+(i*8);
1777-
pOBD->iCursorY = y; // set the new cursor position
1778-
return 0;
1776+
return 0;
17791777
} // 8x8
17801778
#ifndef __AVR__
17811779
else if (iSize == FONT_16x32)
17821780
{
17831781
i = 0;
17841782
iFontSkip = iScroll & 15; // number of columns to initially skip
1785-
while (pOBD->iCursorX < pOBD->width && pOBD->iCursorY < (pOBD->height / 8)-3 && szMsg[i] != 0)
1783+
while (pOBD->iCursorX < pOBD->width && pOBD->iCursorY < pOBD->height && szMsg[i] != 0)
17861784
{
17871785
if (iScroll < 16) // if characters are visible
17881786
{
@@ -1798,34 +1796,26 @@ unsigned char c, *s, ucTemp[40];
17981796
obdSetPosition(pOBD, pOBD->iCursorX, pOBD->iCursorY+8, bRender);
17991797
memcpy_P(ucTemp, s+16, 16);
18001798
if (bInvert) InvertBytes(ucTemp, 16);
1801-
obdWriteDataBlock(pOBD, &ucTemp[iFontSkip], iLen, bRender); // write character pattern
1802-
// if (pOBD->iCursorY <= 5)
1803-
{
1804-
obdSetPosition(pOBD, pOBD->iCursorX, pOBD->iCursorY+16, bRender);
1805-
memcpy_P(ucTemp, s+32, 16);
1806-
if (bInvert) InvertBytes(ucTemp, 16);
18071799
obdWriteDataBlock(pOBD, &ucTemp[iFontSkip], iLen, bRender); // write character pattern
1808-
}
1809-
// if (pOBD->iCursorY <= 4)
1810-
{
1811-
obdSetPosition(pOBD, pOBD->iCursorX, pOBD->iCursorY+24, bRender);
1812-
memcpy_P(ucTemp, s+48, 16);
1813-
if (bInvert) InvertBytes(ucTemp, 16);
1800+
obdSetPosition(pOBD, pOBD->iCursorX, pOBD->iCursorY+16, bRender);
1801+
memcpy_P(ucTemp, s+32, 16);
1802+
if (bInvert) InvertBytes(ucTemp, 16);
1803+
obdWriteDataBlock(pOBD, &ucTemp[iFontSkip], iLen, bRender); // write character pattern
1804+
obdSetPosition(pOBD, pOBD->iCursorX, pOBD->iCursorY+24, bRender);
1805+
memcpy_P(ucTemp, s+48, 16);
1806+
if (bInvert) InvertBytes(ucTemp, 16);
18141807
obdWriteDataBlock(pOBD, &ucTemp[iFontSkip], iLen, bRender); // write character pattern
1815-
}
18161808
pOBD->iCursorX += iLen;
18171809
if (pOBD->iCursorX >= pOBD->width-15 && pOBD->wrap) // word wrap enabled?
18181810
{
18191811
pOBD->iCursorX = 0; // start at the beginning of the next line
1820-
pOBD->iCursorY+=4;
1812+
pOBD->iCursorY+=32;
18211813
}
18221814
iFontSkip = 0;
18231815
} // if character visible from scrolling
18241816
iScroll -= 16;
18251817
i++;
18261818
} // while
1827-
pOBD->iCursorX = x+(i*16);
1828-
pOBD->iCursorY = y; // set the new cursor position
18291819
return 0;
18301820
} // 16x32
18311821
#endif // !__AVR__
@@ -1886,8 +1876,6 @@ unsigned char c, *s, ucTemp[40];
18861876
iScroll -= 16;
18871877
i++;
18881878
} // while
1889-
pOBD->iCursorX = x+(i*16);
1890-
pOBD->iCursorY = y; // set the new cursor position
18911879
return 0;
18921880
} // 16x16
18931881
else if (iSize == FONT_12x16) // 6x8 stretched to 12x16
@@ -2025,8 +2013,6 @@ unsigned char c, *s, ucTemp[40];
20252013
iScroll -= 12;
20262014
i++;
20272015
} // while
2028-
pOBD->iCursorX = x+(i*12);
2029-
pOBD->iCursorY = y; // set the new cursor position
20302016
return 0;
20312017
} // 12x16
20322018
else if (iSize == FONT_6x8)
@@ -2052,16 +2038,14 @@ unsigned char c, *s, ucTemp[40];
20522038
if (pOBD->iCursorX >= pOBD->width-5 && pOBD->wrap) // word wrap enabled?
20532039
{
20542040
pOBD->iCursorX = 0; // start at the beginning of the next line
2055-
pOBD->iCursorY++;
2041+
pOBD->iCursorY +=8;
20562042
obdSetPosition(pOBD, pOBD->iCursorX, pOBD->iCursorY, bRender);
20572043
}
20582044
} // if characters are visible
20592045
iScroll -= 6;
20602046
i++;
20612047
}
20622048
obdCachedFlush(pOBD, bRender); // write any remaining data
2063-
pOBD->iCursorX = x+(i*6);
2064-
pOBD->iCursorY = y; // set the new cursor position
20652049
return 0;
20662050
} // 6x8
20672051
return -1; // invalid size

0 commit comments

Comments
 (0)