-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Config PIDs #4
Config PIDs #4
Conversation
Cherry pick items from 77cc817
This commit removes two two old source folders referenced by lib-gd32
lib-rdm was missing project include to lib-dmxreceiver. lib-configstore was missing project includes to lib-ws28xx, lib-ws28xxdmx, lib-rdm, and lib-rdmsensor.
Add references to main project to all sub-projects to aid Eclipse
Replace GCC function `__builtin_offsetof` with <cstddef> defined `offsetof`
Exposed by define `ENABLE_CONFIG_PIDS` replace the config mode personality with a separate personality for each supported pixel type.
Enable manufacturer pids and add the ability to set pixel type settings. Correct pixel parameter type sizes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These kind of parameters must be uint32_t. Otherwise additional ARM instructions will be generated reducing the size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This somewhat depends on the extensions available on the specfic chip, I'm not really sure what the GD32 has.
However any small performance gain, in my mind, is outweighed by the convenience offered by C++ of correctly sized parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correctly sized parameters.
Only when using 8/16-bit MCU's then it is best practices using 'correctly sized parameters.'. My open source software is targeted for 32-bit MCU's only. Therefore reducing parameters is not an option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you have any aversions to using uint_fast8_t
and uint_fast16_t
, the true intended size is then obvious to the developer, but the complier then uses the best/fastest storage size for the processor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a reference : https://community.st.com/t5/stm32-mcus-products/most-efficient-data-length/td-p/388385
I am not sure if using uint_fast8_t
and uint_fast16_t
would help in performance. Moreover, there is no performance issue with the firmware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint_fast8_t
and uint_fast16_t
resolve the to native platform register size; which on ARM mode would be 4 bytes (32 bit), but if the target CPU is operating in Thumb mode could be 2 bytes (16bit).
By using uint_fast8_t
we are indicating to the compiler "use the native size", but to the developer "we don't intend this to exceed 255".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SetCount
is handled in class PixelConfiguration. m_nGroups
is set based on PixelConfiguration.GetCount()
m_nGroups = GetCount() / m_nGroupingCount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you're referencing here, WS28xxDmx::SetCount()
calls PixelConfiguration::SetCount()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SetCount is validated at start-up. Within this validation several variables are calculated based on m_nCount.
PixelDmxConfiguration pixelDmxConfiguration;
StorePixelDmx storePixelDmx;
PixelDmxParams pixelDmxParams(&storePixelDmx);
if (pixelDmxParams.Load()) {
pixelDmxParams.Dump();
pixelDmxParams.Set(&pixelDmxConfiguration);
}
/*
* DMX Footprint = (Channels per Pixel * Groups) <= 512 (1 Universe)
* Groups = Led count / Grouping count
*
* Channels per Pixel * (Led count / Grouping count) <= 512
* Channels per Pixel * Led count <= 512 * Grouping count
*
* Led count <= (512 * Grouping count) / Channels per Pixel
*/
uint32_t nLedsPerPixel;
pixeldmxconfiguration::PortInfo portInfo;
pixelDmxConfiguration.Validate(1 , nLedsPerPixel, portInfo);
if (pixelDmxConfiguration.GetUniverses() > 1) {
const auto nCount = (512U * pixelDmxConfiguration.GetGroupingCount()) / nLedsPerPixel;
pixelDmxConfiguration.SetCount(nCount);
}
WS28xxDmx pixelDmx(pixelDmxConfiguration);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, unfortunately the way the application is currently structured this does mean a power cycle is necessary is needed to fully apply all the pixel properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately the way the application is currently structured this does mean a power cycle is necessary is needed to fully apply all the pixel properties.
Correct. That is the current limitation. I had the same discussion with Bas. It has a major effort changing the firmware in order to make it possible changing paramaters at run-time. I have done some pre-work in order to make it possible. So when we change for example the Count, then we need to run Validation(). And all run-time paramaters should be updated accordingly.
I am eager to get this fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the advantages for this change?
When we are going to change the global access for a Class
then it must changed for all classes. And the impact, the usage of .bss, must be carefully analysed.
Currently there is just one 'singleton' implementation -> https://github.com/vanvught/GD32F303RC-DMX512-RDM/blob/development/lib-lightset/include/lightsetdata.h Which is introduced for making it possible defining the RAM section to be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advantage is that it prevents the discipline needed to ensure only a single constructor was ever called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advantage is that it prevents the discipline needed to ensure only a single constructor was ever called.
Understood. I will analyse the impact and when possible I will change all classes in /lib-configstore across all solutions https://www.gd32-dmx.org/github.html
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With regards the way the libs are stored, have you ever considered using git submodules?
e.g. have lib-configstore
as a seperate git project, which is then imported as a submodule for each project.
It means that there is only a single code base for the lib, and each project then only needs to reference that. It would avoid the need to copy and merge source everytime there is a lib change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you ever considered using git submodules?
Yes. But I am missing the free time in order to make it happen. The base code is https://github.com/vanvught/rpidmx512 and I have./github-distribute.sh
running in the background.
Hi Marcus. thanks for these updates. I will work with it. We need to think about the implementation for changing the run-time properties. I am eager to get this done. I hope to find the time in the upcoming holidays. Thanks, Arjan |
Hi Marcus, I will introduce the configuration property
And This can be done for all *Params classes. Some time consuming edit, but the result is cleaner code. The |
Given it a second thought. I will handle it in the legacy software. And not using |
Replaces, enabled with the define
ENABLE_CONFIG_PIDS
, the DMX configuration mode with RDM PIDs.The pixel type is set using DMX personality, as this can take advantage of the personality enumeration process.
The exisiting manufacturer pids have been enabled, tweaked, and extended with SETs (excluding 'Pixel Type' 0x8500).
'Pixel Map' (0x8503) is a small compromise due to RDMs lack of suitable custom parameter enumeration, as such entry is via ASCII text. e.g. 'RGB', 'rgb', 'BRG', et cetera; it remains quite useable with any RDM controller that allows string input.