Bonjour à tous, je vous fais un retour car je suis sur la bonne voie. J'ai suivi la piste de Pascal et j'ai donc créé un module switch pour chaque couleur R, G et B. Voici le code rajouté:
switch.ledR.enable true # Enable this module
switch.ledR.input_on_command M98 # Command that will turn this switch on
switch.ledR.input_off_command M99 # Command that will turn this switch off
switch.ledR.output_pin 2.13 # Pin this module controls
switch.ledR.output_type pwm # PWM output settable with S parameter in theinput_on_comand
switch.ledR.startup_value 255
#switch.ledR.max_pwm 255 # Set max pwm for the pin default is 255
switch.ledG.enable true # Enable this module
switch.ledG.input_on_command M100 # Command that will turn this switch on
switch.ledG.input_off_command M101 # Command that will turn this switch off
switch.ledG.output_pin 3.25 # Pin this module controls
switch.ledG.output_type pwm # PWM output settable with S parameter in theinput_on_comand
switch.ledG.startup_value 255
#switch.ledG.max_pwm 255 # Set max pwm for the pin default is 255
switch.ledB.enable true # Enable this module
switch.ledB.input_on_command M102 # Command that will turn this switch on
switch.ledB.input_off_command M103 # Command that will turn this switch off
switch.ledB.output_pin 3.26 # Pin this module controls
switch.ledB.output_type pwm # PWM output settable with S parameter in theinput_on_comand
switch.ledB.startup_value 255
#switch.ledB.max_pwm 255 # Set max pwm for the pin default is 255
Je me suis basé sur le module fan déjà créé dans le fichier config et qui utilise la commande M42 qui ne serait pas compatible avec Smoothieware mais qui marche quand même. Je me suis dit que je pourrais donc utiliser des commandes "non reconnues". J"ai donc choisi les commandes M98 et M99 pour ouvrir et fermer le switch du rouge, M100 et M101 pour le vert et M102 et M103 pour le bleu. Résultat: ça fonctionne presque bien mais il y a un mais. Quand j'allume mon imprimante, j'obtiens une couleur rouge de base alors que normalement ça devrait être éteint. Le fait qu'il y a du rouge de base, fausse mes mélanges. Par exemple quand je fais:
M98 S0 M100 S255 M102 S0, j'obtiens du vert et quand je fais M98 S0 M100 S0 M102 S255, j'obtiens du pourpre au lieu d'avoir du bleu. Il y a donc un net progrès m car ça réagit mais les mélanges sont pas encore top. Il y a sûrement un problème au niveau du code car le branchement , en principe, est correct. Une idée, peut-être?