-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
[Feature] Improve number display for pybricks -499 to 499 #1711
Comments
This is very versatile! However, I am not sure that using 3 different fonts/sizes for the same number is as intuitive as it could be as a default. When designing the current standard, I've considered the LEGO approach (0--19) and an approach similar to yours (up to 499 in a slightly different way), but ultimately settled on a 0-99 approach as a balance between simplicity and functionality. Note that if you want "full size" characters for 0--9, you can already do so with the hub.display.char(str(3)) But I think you've found those already:
These use the standard MicroBit font, but I would be happy to take a pull request to improve them. A centered 3x5 font is fine by me. It should be as simple as adapting Making a library for additional numbers like you have seems like a good approach to enable bigger numbers. We can definitely add some generic hooks that might make your library usage easier. In fact, maybe there already is something for you.... As you could see above, Pybricks icons are encoded in a single 32-bit integer. There is an undocumented feature that lets you make icons like those easily: HEART = Icon(11533764) And since you can add matrices like these, you can fairly easily build composite numbers from just 20 integers in your code, which should make the library very light. Most of the math will happen at the C level too, so it should be fast. While we're on the topic, we would welcome additional default icons in When we do, we could also consider adding a corresponding Icon dropdown + field in the block editor. We haven't really leveraged that functionality so far, even though Pybricks does make animations pretty powerful and easy. |
I thought I saw a comment here just now but now I can't find it. In any case, to get half brightness you can do: Icon(11533764) * 0.5. I'm simplifying and not covering edge cases, but your library function could be something like: return Icon(left_digits[...]) * 0.5 + Icon(right_digits[number % 10]) |
Awesome! I started working on the micropython codebase to implement this. Neither My best guess: I would extend the
That I would use like this for displaying "42". pbio_light_matrix_set_rows(light_matrix, [0b1000100101,0b1000100001,0b1010100101,0b0000100100,0b0000100101], 2, 50);
// [0b101,0b101,0b111,0b001,0b001] // 4
// [0b11,0b01,0b11,0b10,0b11] // 2
// [0b1000100101,0b1000100001,0b1010100101,0b0000100100,0b0000100101] // 42 Does this sound alright with you? May I continue like this? Alternative approach with kwargs: pbio_light_matrix_set_rows(light_matrix, [0b101,0b101,0b111,0b001,0b001], 100, [0b11,0b01,0b11,0b10,0b11], 50);
// [0b101,0b101,0b111,0b001,0b001] // 4
// [0b11,0b01,0b11,0b10,0b11] // 2 |
Ah, the comment is back now 🙂
Oh, I meant the
To show digits with reduced brightness, you can multiply with a scalar in your library. |
As a next step would you support to differentiate the single digit (0 - 9 and -9 - -1 range) for better readibility in |
Since you have already improved the character displays for 0--9 (thanks for pybricks/pybricks-micropython#253!), I think we can keep If you used If you prefer the different font for smaller numbers, you can always do that in your code. |
Is your feature request related to a problem? Please describe.
I am always a fan of showing numbers as part local feedback what the hub is doing.
SPIKE's display is limited to 5x5 pixels, and numeric display is suboptimal that I would love to see improved.
Describe the solution you'd like
I would like a better display for two digit numbers both positive and negative, a more straightforward one-digit display and solution to display numbers 0-360 range.
Describe alternatives you've considered
I have created a solution for displaying numbers between -499-499 that I would suggest to discuss and implement.
Additional context
![compiled](https://private-user-images.githubusercontent.com/4489389/348555190-8eb32113-18ba-4aea-92ff-4c700980e3ca.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ3MzE3MDgsIm5iZiI6MTcyNDczMTQwOCwicGF0aCI6Ii80NDg5Mzg5LzM0ODU1NTE5MC04ZWIzMjExMy0xOGJhLTRhZWEtOTJmZi00YzcwMDk4MGUzY2EucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjdUMDQwMzI4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YmI5YjNkZTEzYTBhNDgwN2M0MjRhM2Y5YmJmOTZlY2Y1MGY1ZmRhMjRhMzQ0ZTM1OGYzMTM5MThiZDcyNzc5ZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.vVGtRpSy-RouFVQsLIGmC8TvKAYfde1UmBOdHjnSxzU)
![IMG_0182](https://private-user-images.githubusercontent.com/4489389/348555194-5f874aad-e359-4ea9-b9fd-3e908ff405cb.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ3MzE3MDgsIm5iZiI6MTcyNDczMTQwOCwicGF0aCI6Ii80NDg5Mzg5LzM0ODU1NTE5NC01Zjg3NGFhZC1lMzU5LTRlYTktYjlmZC0zZTkwOGZmNDA1Y2IuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjdUMDQwMzI4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTk5YzI0N2JhYjMxZGI0ZTFhMThhN2Y4OGRkZTA1MTcxYmFiYzRmMzNmMmFmZDIwOWY4OGM1NjU0MWZlZDI1MCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.0AxkepAph2Cl7ihnoM8_8FPzV6jc0Y7loymZfbLzPqM)
python code: https://gist.github.com/afarago/90645439804b1075634186266a7bfdfd
detailed description and photos: https://digitalbrick.home.blog/2024/07/14/hot-summer-large-numbers-on-your-spike
video demo: https://youtube.com/shorts/ornyaFLwexo
The text was updated successfully, but these errors were encountered: