By manju_guru, 10 August, 2020 Forums General discussion Hello Mikko, If i ignored Dynamic memory allocation by enabling the macro DLMS_IGNORE_MALLOC, The software will work without any modifications or else should i create statically allocated variables for buffers. Please clarify. BR, Manju Hi, Hi, If you define DLMS_IGNORE_MALLOC you need to allocate space for each object like this: static gxChargeTable ACTIVE_CHARGE_TABLES[10] = { 0 }; static gxChargeTable PASSIVE_CHARGE_TABLES[10] = { 0 }; const unsigned char ln[6] = { 0, 0, 19, 20, 0, 255 }; if ((ret = INIT_OBJECT(charge, DLMS_OBJECT_TYPE_CHARGE, ln)) == 0) { charge.chargeConfiguration = DLMS_CHARGE_CONFIGURATION_CONTINUOUS_COLLECTION; ARR_ATTACH(charge.unitChargeActive.chargeTables, ACTIVE_CHARGE_TABLES, 0); ARR_ATTACH(charge.unitChargePassive.chargeTables, PASSIVE_CHARGE_TABLES, 0); } We are updating the example where are more example objects. BR, Mikko Log in or register to post comments
Hi, Hi, If you define DLMS_IGNORE_MALLOC you need to allocate space for each object like this: static gxChargeTable ACTIVE_CHARGE_TABLES[10] = { 0 }; static gxChargeTable PASSIVE_CHARGE_TABLES[10] = { 0 }; const unsigned char ln[6] = { 0, 0, 19, 20, 0, 255 }; if ((ret = INIT_OBJECT(charge, DLMS_OBJECT_TYPE_CHARGE, ln)) == 0) { charge.chargeConfiguration = DLMS_CHARGE_CONFIGURATION_CONTINUOUS_COLLECTION; ARR_ATTACH(charge.unitChargeActive.chargeTables, ACTIVE_CHARGE_TABLES, 0); ARR_ATTACH(charge.unitChargePassive.chargeTables, PASSIVE_CHARGE_TABLES, 0); } We are updating the example where are more example objects. BR, Mikko
Hi,
Hi,
If you define DLMS_IGNORE_MALLOC you need to allocate space for each object like this:
static gxChargeTable ACTIVE_CHARGE_TABLES[10] = { 0 };
static gxChargeTable PASSIVE_CHARGE_TABLES[10] = { 0 };
const unsigned char ln[6] = { 0, 0, 19, 20, 0, 255 };
if ((ret = INIT_OBJECT(charge, DLMS_OBJECT_TYPE_CHARGE, ln)) == 0)
{
charge.chargeConfiguration = DLMS_CHARGE_CONFIGURATION_CONTINUOUS_COLLECTION;
ARR_ATTACH(charge.unitChargeActive.chargeTables, ACTIVE_CHARGE_TABLES, 0);
ARR_ATTACH(charge.unitChargePassive.chargeTables, PASSIVE_CHARGE_TABLES, 0);
}
We are updating the example where are more example objects.
BR,
Mikko