Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New time shift menu option #14

Open
scredly opened this issue Jun 19, 2024 · 0 comments
Open

New time shift menu option #14

scredly opened this issue Jun 19, 2024 · 0 comments

Comments

@scredly
Copy link

scredly commented Jun 19, 2024

Hi!
I hasten to share a change in the code for the time offset menu. This has become much clearer. And it is fully consistent in the Ascom driver settings and in the web configurator. I hope you will paste the code into the new version asap.

// void UI::menuZone() {
//   char out[20];
//   if (message.show(onStep.Get(":GG#", out))) {
//     char* pEnd;
//     int hr = (int)strtol(&out[0], &pEnd, 10);

//     boolean negative=false;
//     if (hr<0) negative=true;
//     uint8_t b=abs(hr);
  
//     if (display->UserInterfaceInputValueInteger(&keyPad, "UTC " L_OFFSET_ABV " (-" L_TZ_ABV ")", "", &b, 0, 14, 2, " " L_HRS_ABV)) {
//       if (display->UserInterfaceInputValueBoolean(&keyPad, "UTC " L_OFFSET_ABV " - ?", &negative)) {
//         hr = b;
//         if (negative) hr = -hr;
//         sprintf(out, ":SG%+02d#", hr);
//         message.show(onStep.Set(out), false);
//       }
//     }
//   }
// }


void UI::menuZone() {
  char out[20];
  if (message.show(onStep.Get(":GG#", out))) {
    char* pEnd;
    int hr = 13-(int)strtol(&out[0], &pEnd, 10);

    hr = display->UserInterfaceSelectionList(&keyPad, "UTC " L_OFFSET_ABV " (-" L_TZ_ABV ")", hr, "12\n11\n10\n9\n8\n7\n6\n5\n4\n3\n2\n1\n0\n-1\n-2\n-3\n-4\n-5\n-6\n-7\n-8\n-9\n-10\n-11\n-12\n-13\n-14");
    if (hr != 0) {
        sprintf(out, ":SG%+02d#", 13-hr);
        message.show(onStep.Set(out), false);
    }
  }
}


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant