Config generation handles padding after packed booleans (bits) wrong

#1057
refactoring
This commit is contained in:
rusefi 2019-12-14 15:33:30 -05:00
parent d6780909f5
commit d5b25902d3
3 changed files with 7 additions and 11 deletions

View File

@ -3,11 +3,10 @@
* @brief Main engine configuration data structure.
*
* @date Oct 30, 2013
* @author Andrey Belomutskiy, (c) 2012-2017
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef ENGINE_CONFIGURATION_H_
#define ENGINE_CONFIGURATION_H_
#pragma once
#include "globalaccess.h"
#include "crc.h"
@ -89,5 +88,3 @@ typedef void (*configuration_callback_t)(engine_configuration_s*);
void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallback, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX);
void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX);
#endif /* __cplusplus */
#endif /* ENGINE_CONFIGURATION_H_ */

View File

@ -24,7 +24,6 @@ public class ConfigStructure {
public int currentOffset;
public int totalSize;
public BitState bitState = new BitState();
public ConfigStructure(String name, String comment, boolean withPrefix, boolean withConstructor) {
this.name = name;
@ -42,9 +41,9 @@ public class ConfigStructure {
}
public void addAlignmentFill(ReaderState state) {
bitState.reset();
BitState bitState = new BitState();
/**
* we make alignment decision based on C fields since we expect interation and non-iteration fields
* we make alignment decision based on C fields since we expect iteration and non-iteration fields
* to match in size
*/
for (int i = 0; i < cFields.size(); i++) {

View File

@ -67,13 +67,13 @@ public class CHeaderConsumer implements ConfigurationConsumer {
content.append("\t" + structure.name + "();" + EOL);
}
structure.bitState.reset();
BitState bitState = new BitState();
for (int i = 0; i < structure.cFields.size(); i++) {
ConfigField cf = structure.cFields.get(i);
content.append(getHeaderText(cf, structure.currentOffset, structure.bitState.get()));
content.append(getHeaderText(cf, structure.currentOffset, bitState.get()));
ConfigField next = i == structure.cFields.size() - 1 ? ConfigField.VOID : structure.cFields.get(i + 1);
structure.bitState.incrementBitIndex(cf, next);
bitState.incrementBitIndex(cf, next);
structure.currentOffset += cf.getSize(next);
}