An archive of community.esquilo.io as of Saturday January 26, 2019.

%%Runtime error [parameter 0 has an invalid type ‘class’ ; expected: ‘table’]

JefferyS

Not sure why it is giving me this and it doesn't seem to be saving either.

It stops on the nvsave(); line.

Here is my code. Let me know if you need more, it's part of a class.

Thanks,

Jeffery

//
// Anodizing Tanks Configuration
//
function CreateBasicAnodizingTanks(){
    // Create a default config if it does not exist
    if (!("AnodizingTanks" in nv)) {
        nv.AnodizingTanks <- {
            // Anodizing Config
            Anodizing = {
                tankName = "Anodizing",
                tankTemp = 0,
                tankProbe = 0,
                tankMinTemp = 15,
                tankMaxTemp = 22,
                tankTempFC = "C",
                tankAlarm = 1,
                tankActive = 1
            },
            // 740 Cleaner Config
            Cleaner740 = {
                tankName = "Speciality 740 Cleaner",
                tankTemp = 0,
                tankProbe = 1,
                tankMinTemp = 54,
                tankMaxTemp = 71,
                tankTempFC = "C",
                tankAlarm = 1,
                tankActive = 1
            },
            // SealantMTL Config
            SealantMTL = {
                tankName = "Speciality Sealant MTL",
                tankTemp = 0,
                tankProbe = 2,
                tankMinTemp = 82,
                tankMaxTemp = 88,
                tankTempFC = "C",
                tankAlarm = 1,
                tankActive = 1
            },
            // SoakClean Config
            SoakClean = {
                tankName = "Soak Clean",
                tankTemp = 0,
                tankProbe = 3,
                tankMinTemp = 57,
                tankMaxTemp = 66,
                tankTempFC = "C",
                tankAlarm = 0,
                tankActive = 1
            },
            // WarmRinse Config
            WarmRinse = {
                tankName = "-----",
                tankTemp = 0,
                tankProbe = 0,
                tankMinTemp = 0,
                tankMaxTemp = 0,
                tankTempFC = "C",
                tankAlarm = 0,
                tankActive = 0
            },
            // Tank Dye
            Dye = {
                tankName = "Dye - Fast Blue GN",
                tankTemp = 0,
                tankProbe = 5,
                tankMinTemp = 57,
                tankMaxTemp = 63,
                tankTempFC = "C",
                tankAlarm = 1,
                tankActive = 1
            }
            //
        };

        // Save the nv table
        nvsave();
    }
} // function CreateBasicAnodizingTanks()
JefferyS

Having some strangeness in the nv storage.

I had two other tables in nv and could not save the AnodizingTanks. I deleted the two in nv and I was able to put in my AnodizingTnaks. Not sure what that is about but I don't need this answered any more.

Thanks,

Jeffery

JefferyS

Still having problems, I made a few changes to the table structure and removed the AnodizingTanks in the nv then tried to create a new one and it will create it but won't save it. No errors. I'm doing this in a separate nut file that I run.

Is there a storage limit that I'm exceeding or something?

This is what I have in my file and I've reset the Esquilo several times before trying it.

I uncomment createAnodizingTanks() at the bottom to create it. Then I comment it again and run the nut and the the print tell me if it is still there. Also make a watch on the nv and can see it is gone too.

    require("nv");


function createAnodizingTanks(){

    nv.AnodizingTanks <- {
        // Anodizing Config
        Anodizing = {
            tankId = 0,
            tankName = "Anodizing",
            tankShortName = "Anodizing",
            tankTemp = 0,
            tankProbe = 0,
            tankMinTemp = 15,
            tankMaxTemp = 22,
            tankTempFC = "C",
            tankAlarm = 1,
            tankActive = 1
        },
            // 740 Cleaner Config
            Cleaner740 = {
            tankId = 1,
            tankName = "Speciality 740 Cleaner",
            tankShortName = "740 Cleaner",
            tankTemp = 0,
            tankProbe = 1,
            tankMinTemp = 54,
            tankMaxTemp = 71,
            tankTempFC = "C",
            tankAlarm = 1,
            tankActive = 1
        },
            // SealantMTL Config
            SealantMTL = {
            tankId = 2,
            tankName = "Speciality Sealant MTL",
            tankShortName = "Sealant MTL",
            tankTemp = 0,
            tankProbe = 2,
            tankMinTemp = 82,
            tankMaxTemp = 88,
            tankTempFC = "C",
            tankAlarm = 1,
            tankActive = 1
        },
            // SoakClean Config
            SoakClean = {
            tankId = 3,
            tankName = "Soak Clean",
            tankShortName = "Soak Clean",
            tankTemp = 0,
            tankProbe = 3,
            tankMinTemp = 57,
            tankMaxTemp = 66,
            tankTempFC = "C",
            tankAlarm = 0,
            tankActive = 1
        },
            // WarmRinse Config
            WarmRinse = {
            tankId = 4,
            tankName = "-----",
            tankShortName = "-----",
            tankTemp = 0,
            tankProbe = 0,
            tankMinTemp = 0,
            tankMaxTemp = 0,
            tankTempFC = "C",
            tankAlarm = 0,
            tankActive = 0
        },
            // Tank Dye
            Dye = {
            tankId = 5,
            tankName = "Dye - Fast Blue GN",
            tankShortName = "Dye - Blue",
            tankTemp = 0,
            tankProbe = 5,
            tankMinTemp = 57,
            tankMaxTemp = 63,
            tankTempFC = "C",
            tankAlarm = 1,
            tankActive = 1
        }
        //
    };

    // Save the nv table
    nvsave();
}

function removeNv(nvName){
    delete nv[nvName];
    nvsave();
}

// -----------------------------------------------------------------

//createAnodizingTanks();


//removeNv("AnodizingTanks");


print("---------------------------------------\n");
print("AnodizingTanks" in nv);
print("\n---------------------------------------\n");
Scott_Shumate

The maximum size of the nv table in EEPROM is 1024 bytes which includes overhead for the value type and length. If you exceed that, it should throw a "value too large" exception. It sounds like you are hitting the limit but the exception is not displaying. I'll see if I can reproduce it.

In the meantime, you can shorten the table key names to get quite a bit more space. Each table key name is encoded as a string in the EEPROM so if you have several instances of the table, it will eat up a lot of EEPROM space. For example, remove the "tank" in front of each table key in your program.

Scott_Shumate

I verified that there is a problem with the exception not getting thrown when the nv table is too large. We'll fix in the next release.

JefferyS

Thanks Scott, thought I was going crazy lol.

Removing the "tank" in front of everything worked.

Is there a way to see how much room it is taking up?

Thanks,

Jeffery