@@ -878,6 +878,8 @@ static void checkTouch()
878878 // set showing sat in DX box
879879 dx_info_for_sat = true ;
880880 drawSatPass ();
881+ } else if (checkPlanetMapTouch (s)) {
882+ // handled entirely within checkPlanetMapTouch
881883 } else if (!overViewBtn (s, DX_R ) && s2ll (s, ll)) {
882884 // tapped map: set flag to run popup after map finishes or set newDX here if special-tap
883885 if (names_on)
@@ -1715,6 +1717,7 @@ void drawAllSymbols()
17151717 drawADIFSpotsOnMap ();
17161718 drawDXPedsOnMap ();
17171719 drawHamsatOnMap ();
1720+ drawPlanetsOnMap ();
17181721 drawStormsOnMap ();
17191722 drawLaunchesOnMap ();
17201723 drawActiveNetsOnMap ();
@@ -1886,10 +1889,7 @@ void drawDEFormatMenu()
18861889 // number of core menu items
18871890 #define N_DEFMT_CORE 8
18881891
1889- // PLOT_CH_SATACT can't join PANE_0_CH_MASK -- that's a 32-bit bitmask constant and SATACT's
1890- // ordinal (32) can never fit in one, by the same design as everywhere else PLOTBIT() is used.
1891- // it's offered as one extra, separately-handled menu item instead.
1892- MenuItem mitems[N_DEFMT_CORE +N_PANE_0_CH +1 ] = {
1892+ MenuItem mitems[N_DEFMT_CORE +N_PANE_0_CH ] = {
18931893
18941894 // outer menu is whether to display the DE pane or use both DE+DX for a pane choice
18951895 {MENU_1OFN , !SHOWING_PANE_0 (), 1 , mi, " DE format:" , NULL },
@@ -1904,40 +1904,28 @@ void drawDEFormatMenu()
19041904
19051905 {MENU_1OFN , SHOWING_PANE_0 (), 1 , mi, " Data Panes:" , NULL },
19061906
1907- // bottom submenu is list of possible pane choices, see next.
1908- // N.B. don't include ones already in play in the top set
1909-
1907+ // bottom submenu is filled below from PANE_0_CH_MASK, including high-word choices.
19101908 };
19111909
1912- // set and record PANE_0 choices from successive bits in PANE_0_CH_MASK
1913- uint32_t pane_0_bits = PANE_0_CH_MASK ;
1910+ // prepare each suitable Pane 0 choice in PlotChoice order
19141911 PlotChoice menu_ch[N_PANE_0_CH ];
1915- for ( int i = 0 ; i < N_PANE_0_CH ; i++) {
1916- // find and zero out the next bit in mask of possible PANE_0 panes
1917- int plot_n = 0 ;
1918- for ( uint32_t bits = pane_0_bits; bits >>= 1 ; plot_n++ )
1912+ int n_menu_ch = 0 ;
1913+ for ( int i = 0 ; i < PLOT_CH_N ; i++) {
1914+ PlotChoice pc = (PlotChoice)i ;
1915+ if (! PLOT_CH_IS_REAL (pc) || !( PANE_0_CH_MASK & PLOTBIT (pc)) )
19191916 continue ;
1920- pane_0_bits &= ~(1 <<plot_n);
1921- menu_ch[i] = (PlotChoice)plot_n;
1922- // prepare menu item
1923- PlotPane pp = findPaneForChoice ((PlotChoice)plot_n);
1924- bool available = plotChoiceIsAvailable ((PlotChoice)plot_n) && (pp == PANE_NONE || pp == PANE_0 );
1925- MenuFieldType type = available ? MENU_AL1OFN : MENU_IGNORE ;
1926- mitems[N_DEFMT_CORE +i] = {type, !!(plot_rotset[PANE_0 ] & PLOTBIT (plot_n)), 3 , Mi, plot_names[plot_n], 0 };
1927- }
1928- if (pane_0_bits != 0 )
1929- fatalError (" drawDEFormatMenu() %d %d 0x%x\n " , pane_0_bits, N_PANE_0_CH , PANE_0_CH_MASK );
1930-
1931- // extra SATACT item -- can't be represented in plot_rotset (see comment above), so its
1932- // "currently set" state is determined the same way paneHasChoice() checks a solo choice
1933- const int SATACT_MI = N_DEFMT_CORE + N_PANE_0_CH ;
1934- {
1935- PlotPane pp = findPaneForChoice (PLOT_CH_SATACT );
1936- bool available = plotChoiceIsAvailable (PLOT_CH_SATACT ) && (pp == PANE_NONE || pp == PANE_0 );
1917+
1918+ menu_ch[n_menu_ch] = pc;
1919+ PlotPane pp = findPaneForChoice (pc);
1920+ bool available = plotChoiceIsAvailable (pc) && (pp == PANE_NONE || pp == PANE_0 );
19371921 MenuFieldType type = available ? MENU_AL1OFN : MENU_IGNORE ;
1938- bool is_set = (plot_ch[PANE_0 ] == PLOT_CH_SATACT && plot_rotset[PANE_0 ] == 0 );
1939- mitems[SATACT_MI ] = {type, is_set, 3 , Mi, plot_names[PLOT_CH_SATACT ], 0 };
1922+ mitems[N_DEFMT_CORE +n_menu_ch] = {
1923+ type, !!(plot_rotset[PANE_0 ] & PLOTBIT (pc)), 3 , Mi, plot_names[pc], 0
1924+ };
1925+ n_menu_ch++;
19401926 }
1927+ if (n_menu_ch != N_PANE_0_CH )
1928+ fatalError (" drawDEFormatMenu() found %d of %d Pane 0 choices" , n_menu_ch, N_PANE_0_CH );
19411929
19421930 // create a box for the menu
19431931 SBox menu_b;
@@ -1948,73 +1936,56 @@ void drawDEFormatMenu()
19481936 // run menu
19491937 SBox ok_b;
19501938 MenuInfo menu = {menu_b, ok_b, UF_NOCLOCKS , M_CANCELOK , 1 , NARRAY (mitems), mitems};
1951- if (runMenu (menu)) {
1952-
1953- // capture and save new state
1954-
1955- if (mitems[0 ].set ) {
1956-
1957- // set desired detime format
1958-
1959- int new_fmt = -1 ;
1960- for (int i = 0 ; i < DETIME_N ; i++) {
1961- if (mitems[i+1 ].set ) {
1962- new_fmt = i;
1963- break ;
1964- }
1965- }
1966-
1967- // paranoid
1968- if (new_fmt < 0 )
1969- fatalError (" drawDEFormatMenu: No de fmt" );
1970-
1971- // set fmt and turn off PANE_0
1972- de_time_fmt = (uint8_t )new_fmt;
1973- NVWriteUInt8 (NV_DE_TIMEFMT , de_time_fmt);
1974- plot_ch[PANE_0 ] = PLOT_CH_NONE ;
1975- plot_rotset[PANE_0 ] = 0 ;
1939+ if (!runMenu (menu))
1940+ return ;
19761941
1977- } else {
1942+ if (mitems[ 0 ]. set ) {
19781943
1979- // get new collection of plot choices
1980- uint32_t new_rotset = 0 ;
1981- for (int i = 0 ; i < N_PANE_0_CH ; i++) {
1982- if (mitems[N_DEFMT_CORE +i].set )
1983- new_rotset |= PLOTBIT (menu_ch[i]);
1944+ // set desired DE time format and restore the normal DE/DX layout
1945+ int new_fmt = -1 ;
1946+ for (int i = 0 ; i < DETIME_N ; i++) {
1947+ if (mitems[i+1 ].set ) {
1948+ new_fmt = i;
1949+ break ;
19841950 }
1951+ }
1952+ if (new_fmt < 0 )
1953+ fatalError (" drawDEFormatMenu: No de fmt" );
19851954
1986- bool satact_set = mitems[ SATACT_MI ]. set ;
1987-
1988- if (satact_set && new_rotset == 0 ) {
1955+ de_time_fmt = ( uint8_t )new_fmt ;
1956+ NVWriteUInt8 ( NV_DE_TIMEFMT , de_time_fmt);
1957+ restoreNormPANE0 ();
19891958
1990- // SATACT alone: solo, non-rotating choice -- can't be represented in plot_rotset
1991- plot_ch[PANE_0 ] = PLOT_CH_SATACT ;
1992- plot_rotset[PANE_0 ] = 0 ;
1959+ } else {
19931960
1994- } else if (new_rotset != 0 ) {
1961+ // collect low- and high-word choices into one in-memory rotation mask
1962+ PlotMask new_rotset = 0 ;
1963+ for (int i = 0 ; i < N_PANE_0_CH ; i++) {
1964+ if (mitems[N_DEFMT_CORE +i].set )
1965+ new_rotset |= PLOTBIT (menu_ch[i]);
1966+ }
19951967
1996- // one or more mask-based choices (SATACT, if also checked, can't join a
1997- // multi-item rotation set the way these can, so it's dropped in that case)
1998- plot_rotset[PANE_0 ] = new_rotset;
1968+ if (new_rotset == 0 ) {
1969+ restoreNormPANE0 ();
1970+ } else {
1971+ plot_rotset[PANE_0 ] = new_rotset;
19991972
2000- // pick any one as current
1973+ // retain the current choice when still selected, otherwise choose the first set bit
1974+ if (!(plot_rotset[PANE_0 ] & PLOTBIT (plot_ch[PANE_0 ]))) {
20011975 for (int i = 0 ; i < PLOT_CH_N ; i++) {
20021976 if (plot_rotset[PANE_0 ] & PLOTBIT (i)) {
2003- plot_ch[PANE_0 ] = (PlotChoice) i;
1977+ plot_ch[PANE_0 ] = (PlotChoice)i;
20041978 break ;
20051979 }
20061980 }
20071981 }
1982+
1983+ if (!setPlotChoice (PANE_0 , plot_ch[PANE_0 ]))
1984+ fatalError (" drawDEFormatMenu: can not set Pane 0 choice %d" , (int )plot_ch[PANE_0 ]);
20081985 }
20091986 }
20101987
2011- // set PANE_0 choice, even if none
2012- setPlotChoice (PANE_0 , plot_ch[PANE_0 ]);
20131988 logPaneRotSet (PANE_0 , plot_ch[PANE_0 ]);
2014-
2015- // redraw if normal
2016- if (!SHOWING_PANE_0 ())
2017- restoreNormPANE0 ();
20181989}
20191990
20201991/* resume using nearestPrefix
0 commit comments