diff options
feat: Move aspect ratio input parsing into cli
1 files changed, 6 insertions, 5 deletions
| -rw-r--r-- | src/LEDVideoWall.cpp | 11 |
diff --git a/src/LEDVideoWall.cpp b/src/LEDVideoWall.cpp index ad3dc3c..fc447bc 100644 --- a/src/LEDVideoWall.cpp +++ b/src/LEDVideoWall.cpp @@ -62,11 +62,12 @@ LEDVideoWall* LEDVideoWall::fromCommandLine() { case LEDVideoWallType::Aspect: { mm i_width = 0, i_height = 0; - printf("Enter aspect ratio (in the format 'width:height'): "); - while (scanf("%d:%d", &i_width, &i_height) != 2) { - printf("Invalid input, try again!\n"); - printf("Enter aspect ratio (in the format 'width:height'): "); - } + cli::scanTwoValues( + "%d:%d", + i_width, + i_height, + "Enter aspect ratio (in the format 'width:height'): ", + "Invalid input, try again!"); return LEDVideoWall::Aspect(ipanel_width, ipanel_height, i_width, i_height); }; |