Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Filament counter reset
#81
(01-30-2017, 12:01 AM)tonyi Wrote:
(05-29-2014, 04:28 PM)bobd Wrote: In python, you can compute the bytes with:

Code:
# create a little-endian string of hex-encoded bytes for 999000 (length is in mm)
hexval='%0.8x' % 999000
# Swizzle to big-endian order:
bytes=[hexval[i-2:i] for i in range(len(hexval),0,-2)]
# compose the assignment for x:
'char x[] = {' + ','.join(['0x'+s for s in bytes]) + '};'

which returns:

Code:
char x[] = {0x58,0x3e,0x0f,0x00};

I'm still trying to get this code, to spit out "char x[] = {0x58,0x3e,0x0f,0x00};" after it runs.  I got the code to run on python 27 and Thonny but, neither program spits out any answer, after it runs.  Am I missing something that needs to be added to the above code?  Has anybody had any luck getting the script to run correctly and give an answer when finished running?

Syntax error?, maybe because of the python (27) version I was using.  Error on line 5, the program didn't say there was an error but the variable "hexval" was not getting the value placed into it.... I took a guess, since this code is the first time I messed with python and added print hexval  to see what the value was and entered it manually at first; but now it functions correctly in my Python 27 as is below:
Quote:hexval ='%0.8x' % 360000
#I added the following line and it fixed the problem, but I don't know why...
print hexval
# Swizzle to big-endian order:
bytes=[hexval[i-2:i] for i in range(len(hexval),0,-2)]
# compose the assignment for x:
'char x[] = {' + ','.join(['0x'+s for s in bytes]) + '};'
It does not work in Thonny.  By my calculations, which you may want to verify, when you correct the code syntax the proper way, for 360 is:  'char x[] = {0x40,0x7e,0x05,0x00};'
Hopefully the printer will allow this value to work for the length of the filament after all the time I spent getting the code to work! lol
Reply
#82
Don't bother; it doesn't work. The printer will tell you that you have 360m under info., but will give an error code 008 if you try to print; at least with firmware J 1.1.
Reply
#83
(04-30-2014, 11:20 AM)pdiddy Wrote: So went out and purchased an Arduino Uno, then followed the instructions posted by Oliver ..... worked a treat, thank you!

I programmed the bundled 120M filament, and now its showing 120/120, but I was wondering if its possible to reprogram it to the full capacity 600G (240/240M) or can you only reset to the original amount? If no, I assume that when I try it on the separately 600g filaments I purchased, it will reset to 240M ?

Sorry if these question are super basic, but I'm a total beginner   Blush

Hi pdiddy,

did the same thing not too long ago myself. Here is what you do.....

Find the line of code as below.
Notice the one that is highlighted in red.
Notice it does not have "//" preceding it.
Go into the code and put "//" in front of the line highlighted in blue that has 120m and remove"//" from the line after it that is highlighted in red.
It's that simple.


Verified with firmware 1.1.I
*/

// Value to write to the EEPROM for remaining filament lenght
// Default Starter Cartdridge is 120m
//char x[] = {0xc0,0xd4,0x01,0x00}; //120m
char x[] = {0x80,0xa9,0x03,0x00}; //240m
//char x[] = {0x80,0x1a,0x06,0x00}; //400m0/

// extruder temp, default is 210 C for ABS
char et[] = {0xd2,0x00}; // 210 C
//char et[] = {0xe6,0x00}; // 230 C
//char et[] = {0xf5,0x00}; // 245 C
//char et[] = {0xfa,0x00}; // 250 C

// bed temp 90 degrees, default ABS
char bt[] = {0x5a,0x00};

byte sr;
NanodeUNIO unio(NANODE_MAC_DEVICE);
Reply
#84
Hi,

Over the last week I bought an Arduino Mini Pro and have started reading and experimenting.

Couple of things noticed:

1) the code on github reads a serial number as 12 bytes starting at position 0x18. But from what I can tell there's several pieces  of the serial number spread over 4 starting positions. I guess it doesn't really matter?

2) the code to increment the serial uses atol, but the last 4 digits aren't numerical - but hex (at least on one of my cartridges). I guess this doesn't really matter - the code seems to mangle the number and the printer just needs it to be 'diferent' from before? Nevertheless, would be nice to have this a true +1 increment?

I've made some simple code that actually prints length, type, color, etc in a human readable form like below. I can share the code if someone likes.

SERIAL NUMBER
<number>(success)
CODE:5A(success)
MATERIAL:ABS(success)
COLOR:4B(success)
DATE:36343780(success)
TOTALLEN:240000(success)
NEWLEN:240000(success)
HEADTEMP:210(success)
BEDTEMP:90(success)
LEN2:17032



Thanks.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)