comparison Discovery/Src/t7.c @ 759:9825dcf50675

Some compass improvements from mikeller
author heinrichsweikamp
date Fri, 17 Mar 2023 09:35:25 +0100
parents b6d8a6fbf4fd
children 8deb28b2d4da
comparison
equal deleted inserted replaced
758:b6d8a6fbf4fd 759:9825dcf50675
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. 26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
27 ////////////////////////////////////////////////////////////////////////////// 27 //////////////////////////////////////////////////////////////////////////////
28 28
29 /* Includes ------------------------------------------------------------------*/ 29 /* Includes ------------------------------------------------------------------*/
30 #include <stdlib.h> 30 #include <stdlib.h>
31 #include <stdbool.h>
31 32
32 #include "t7.h" 33 #include "t7.h"
33 #include "t3.h" 34 #include "t3.h"
34 #include "settings.h" 35 #include "settings.h"
35 #include "data_exchange_main.h" 36 #include "data_exchange_main.h"
1750 i++; 1751 i++;
1751 return i; 1752 return i;
1752 } 1753 }
1753 1754
1754 1755
1756 bool isCompassCalibrated(void)
1757 {
1758 return stateUsed->lifeData.compass_heading != -1;
1759 }
1760
1761
1755 void t7_refresh_customview(void) 1762 void t7_refresh_customview(void)
1756 { 1763 {
1757 static uint8_t last_customview = CVIEW_END; 1764 static uint8_t last_customview = CVIEW_END;
1758 1765
1759 char text[256]; 1766 char text[256];
1891 text[textpointer++] = 0; 1898 text[textpointer++] = 0;
1892 GFX_write_string_color(&FontT42,&t7cC,text,1, CLUT_WarningRed); 1899 GFX_write_string_color(&FontT42,&t7cC,text,1, CLUT_WarningRed);
1893 t7cC.WindowY0 += shiftWindowY0; 1900 t7cC.WindowY0 += shiftWindowY0;
1894 } 1901 }
1895 t7cC.WindowNumberOfTextLines = 1; 1902 t7cC.WindowNumberOfTextLines = 1;
1903 }
1904 else if(!isCompassCalibrated()) {
1905 if(warning_count_high_time) {
1906 shiftWindowY0 += 20;
1907 t7cC.WindowY0 -= shiftWindowY0;
1908 textpointer = 0;
1909 text[textpointer++] = '\001';
1910 text[textpointer++] = TXT_2BYTE;
1911 text[textpointer++] = TXT2BYTE_Compass;
1912 text[textpointer++] = '\n';
1913 text[textpointer++] = '\r';
1914 text[textpointer++] = '\001';
1915 text[textpointer++] = TXT_2BYTE;
1916 text[textpointer++] = TXT2BYTE_NotCalibrated;
1917 text[textpointer++] = '\n';
1918 text[textpointer++] = '\r';
1919 text[textpointer++] = 0;
1920 GFX_write_string_color(&FontT42, &t7cC,text, 1, CLUT_WarningRed);
1921 t7cC.WindowY0 += shiftWindowY0;
1922 }
1923 t7cC.WindowNumberOfTextLines = 2;
1896 } 1924 }
1897 else // customtext 1925 else // customtext
1898 { 1926 {
1899 lineCountCustomtext = t7_customtextPrepare(text); 1927 lineCountCustomtext = t7_customtextPrepare(text);
1900 if(lineCountCustomtext <= 2) 1928 if(lineCountCustomtext <= 2)